diff --git a/packages/addons/repository/repository.unofficial.addon.pro/changelog.txt b/packages/addons/repository/repository.unofficial.addon.pro/changelog.txt index 68576b0ebe..eaffc01254 100644 --- a/packages/addons/repository/repository.unofficial.addon.pro/changelog.txt +++ b/packages/addons/repository/repository.unofficial.addon.pro/changelog.txt @@ -1,3 +1,6 @@ +6.0.1 +- update repo minversion for kodi 15 + 6.0.0 - rebuild for OpenELEC-6.0 diff --git a/packages/addons/repository/repository.unofficial.addon.pro/package.mk b/packages/addons/repository/repository.unofficial.addon.pro/package.mk index dc05d04bf8..9677682f88 100644 --- a/packages/addons/repository/repository.unofficial.addon.pro/package.mk +++ b/packages/addons/repository/repository.unofficial.addon.pro/package.mk @@ -20,7 +20,7 @@ PKG_NAME="repository.unofficial.addon.pro" PKG_VERSION="6.0" -PKG_REV="0" +PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://unofficial.addon.pro" diff --git a/packages/addons/repository/repository.unofficial.addon.pro/sources/addon.xml b/packages/addons/repository/repository.unofficial.addon.pro/sources/addon.xml index f065e8389a..156c6bc83f 100644 --- a/packages/addons/repository/repository.unofficial.addon.pro/sources/addon.xml +++ b/packages/addons/repository/repository.unofficial.addon.pro/sources/addon.xml @@ -10,7 +10,7 @@ http://unofficial.addon.pro/addons/4.3/@PROJECT@/@ARCH@/addons.xml.md5 http://unofficial.addon.pro/addons/4.3/@PROJECT@/@ARCH@ - + http://unofficial.addon.pro/addons/6.0/@PROJECT@/@ARCH@/addons.xml http://unofficial.addon.pro/addons/6.0/@PROJECT@/@ARCH@/addons.xml.md5 http://unofficial.addon.pro/addons/6.0/@PROJECT@/@ARCH@ diff --git a/packages/databases/sqlite/package.mk b/packages/databases/sqlite/package.mk index a5c8d4dab2..b29805058e 100644 --- a/packages/databases/sqlite/package.mk +++ b/packages/databases/sqlite/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="sqlite" -PKG_VERSION="autoconf-3081002" +PKG_VERSION="autoconf-3081101" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="PublicDomain" diff --git a/packages/devel/binutils/package.mk b/packages/devel/binutils/package.mk index acef8764f3..c617e9436b 100644 --- a/packages/devel/binutils/package.mk +++ b/packages/devel/binutils/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="binutils" -PKG_VERSION="2.25" +PKG_VERSION="2.25.1" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/devel/cmake/package.mk b/packages/devel/cmake/package.mk index 411eb52745..301795e146 100644 --- a/packages/devel/cmake/package.mk +++ b/packages/devel/cmake/package.mk @@ -17,12 +17,12 @@ ################################################################################ PKG_NAME="cmake" -PKG_VERSION="3.2.3" +PKG_VERSION="3.3.1" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="BSD" PKG_SITE="http://www.cmake.org/" -PKG_URL="http://www.cmake.org/files/v3.2/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_URL="http://www.cmake.org/files/v3.3/$PKG_NAME-$PKG_VERSION.tar.gz" PKG_DEPENDS_HOST="ccache:host" PKG_PRIORITY="optional" PKG_SECTION="toolchain/devel" @@ -51,6 +51,9 @@ SET(CMAKE_SYSTEM_NAME Linux) #this one not so much SET(CMAKE_SYSTEM_VERSION 1) +# processor (or hardware) of the target system +SET(CMAKE_SYSTEM_PROCESSOR $TARGET_ARCH) + # specify the cross compiler SET(CMAKE_C_COMPILER $TARGET_CC) SET(CMAKE_CXX_COMPILER $TARGET_CXX) diff --git a/packages/devel/gettext/package.mk b/packages/devel/gettext/package.mk index dd6188c403..169fd95976 100644 --- a/packages/devel/gettext/package.mk +++ b/packages/devel/gettext/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="gettext" -PKG_VERSION="0.19.5" +PKG_VERSION="0.19.5.1" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/devel/libcec/patches/libcec-01-add-repeating-keypress.patch b/packages/devel/libcec/patches/libcec-01-add-repeating-keypress.patch new file mode 100644 index 0000000000..8366a69656 --- /dev/null +++ b/packages/devel/libcec/patches/libcec-01-add-repeating-keypress.patch @@ -0,0 +1,859 @@ +From ec982e9800ae312972d306b67779215a2add6cde Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 24 Oct 2014 13:45:21 +0100 +Subject: [PATCH 1/6] Make released key polling wait for exact time until key + gets released + +--- + src/libcec/CECClient.cpp | 16 ++++++++++++++-- + src/libcec/CECClient.h | 2 +- + src/libcec/CECProcessor.cpp | 8 +++++--- + src/libcec/LibCEC.cpp | 10 ++++++++-- + src/libcec/LibCEC.h | 4 +++- + 5 files changed, 31 insertions(+), 9 deletions(-) + +diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp +index 35c2d3e..e307c0e 100644 +--- a/src/libcec/CECClient.cpp ++++ b/src/libcec/CECClient.cpp +@@ -1067,7 +1067,7 @@ void CCECClient::SetCurrentButton(const cec_user_control_code iButtonCode) + AddKey(key); + } + +-void CCECClient::CheckKeypressTimeout(void) ++uint16_t CCECClient::CheckKeypressTimeout(void) + { + cec_keypress key; + +@@ -1091,12 +1091,24 @@ void CCECClient::CheckKeypressTimeout(void) + } + else + { +- return; ++ // time when this keypress will be released and we'd like to be called again ++ unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) ++ timeout = iTimeoutMs - (iNow - m_buttontime) + 1; ++ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey) ++ timeout = CEC_BUTTON_TIMEOUT - (iNow - m_buttontime) + 1; ++ if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) ++ { ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_buttontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); ++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ } ++ return timeout; + } + } + + LIB_CEC->AddLog(CEC_LOG_DEBUG, "key auto-released: %s (%1x)", ToString(key.keycode), key.keycode); + QueueAddKey(key); ++ return CEC_PROCESSOR_SIGNAL_WAIT_TIME; + } + + bool CCECClient::EnableCallbacks(void *cbParam, ICECCallbacks *callbacks) +diff --git a/src/libcec/CECClient.h b/src/libcec/CECClient.h +index 12f8a3b..c9ce5e3 100644 +--- a/src/libcec/CECClient.h ++++ b/src/libcec/CECClient.h +@@ -272,7 +272,7 @@ namespace CEC + virtual void AddKey(bool bSendComboKey = false); + virtual void AddKey(const cec_keypress &key); + virtual void SetCurrentButton(const cec_user_control_code iButtonCode); +- virtual void CheckKeypressTimeout(void); ++ virtual uint16_t CheckKeypressTimeout(void); + virtual void SourceActivated(const cec_logical_address logicalAddress); + virtual void SourceDeactivated(const cec_logical_address logicalAddress); + +diff --git a/src/libcec/CECProcessor.cpp b/src/libcec/CECProcessor.cpp +index 99f71aa..604b950 100644 +--- a/src/libcec/CECProcessor.cpp ++++ b/src/libcec/CECProcessor.cpp +@@ -52,7 +52,6 @@ + using namespace CEC; + using namespace PLATFORM; + +-#define CEC_PROCESSOR_SIGNAL_WAIT_TIME 1000 + #define ACTIVE_SOURCE_CHECK_INTERVAL 500 + #define TV_PRESENT_CHECK_INTERVAL 30000 + +@@ -260,6 +259,7 @@ bool CCECProcessor::OnCommandReceived(const cec_command &command) + + void *CCECProcessor::Process(void) + { ++ uint16_t timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; + m_libcec->AddLog(CEC_LOG_DEBUG, "processor thread started"); + + if (!m_connCheck) +@@ -274,13 +274,13 @@ void *CCECProcessor::Process(void) + while (!IsStopped() && m_communication->IsOpen()) + { + // wait for a new incoming command, and process it +- if (m_inBuffer.Pop(command, CEC_PROCESSOR_SIGNAL_WAIT_TIME)) ++ if (m_inBuffer.Pop(command, timeout)) + ProcessCommand(command); + + if (CECInitialised() && !IsStopped()) + { + // check clients for keypress timeouts +- m_libcec->CheckKeypressTimeout(); ++ timeout = m_libcec->CheckKeypressTimeout(); + + // check if we need to replace handlers + ReplaceHandlers(); +@@ -311,6 +311,8 @@ void *CCECProcessor::Process(void) + tvPresentCheck.Init(TV_PRESENT_CHECK_INTERVAL); + } + } ++ else ++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; + } + + return NULL; +diff --git a/src/libcec/LibCEC.cpp b/src/libcec/LibCEC.cpp +index af36b79..5ccb8dd 100644 +--- a/src/libcec/LibCEC.cpp ++++ b/src/libcec/LibCEC.cpp +@@ -361,11 +361,17 @@ bool CLibCEC::IsValidPhysicalAddress(uint16_t iPhysicalAddress) + iPhysicalAddress <= CEC_MAX_PHYSICAL_ADDRESS; + } + +-void CLibCEC::CheckKeypressTimeout(void) ++uint16_t CLibCEC::CheckKeypressTimeout(void) + { ++ uint16_t timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; + // check all clients + for (std::vector::iterator it = m_clients.begin(); it != m_clients.end(); it++) +- (*it)->CheckKeypressTimeout(); ++ { ++ uint16_t t = (*it)->CheckKeypressTimeout(); ++ if (t < timeout) ++ timeout = t; ++ } ++ return timeout; + } + + void CLibCEC::AddLog(const cec_log_level level, const char *strFormat, ...) +diff --git a/src/libcec/LibCEC.h b/src/libcec/LibCEC.h +index 6d9a229..d9d1e7b 100644 +--- a/src/libcec/LibCEC.h ++++ b/src/libcec/LibCEC.h +@@ -39,6 +39,8 @@ + #include "CECTypeUtils.h" + #include + ++#define CEC_PROCESSOR_SIGNAL_WAIT_TIME 1000 ++ + namespace CEC + { + class CAdapterCommunication; +@@ -125,7 +127,7 @@ namespace CEC + + void AddLog(const cec_log_level level, const char *strFormat, ...); + void AddCommand(const cec_command &command); +- void CheckKeypressTimeout(void); ++ uint16_t CheckKeypressTimeout(void); + void Alert(const libcec_alert type, const libcec_parameter ¶m); + + static bool IsValidPhysicalAddress(uint16_t iPhysicalAddress); +-- +1.9.1 + + +From 41f0f3ec9ac136da3565c96fd5a7075499f3938d Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 24 Oct 2014 13:51:34 +0100 +Subject: [PATCH 2/6] Keep track of time since initial button press and last + button update + +--- + src/libcec/CECClient.cpp | 44 +++++++++++++++++++++++++++----------------- + src/libcec/CECClient.h | 3 ++- + 2 files changed, 29 insertions(+), 18 deletions(-) + +diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp +index e307c0e..e7935b9 100644 +--- a/src/libcec/CECClient.cpp ++++ b/src/libcec/CECClient.cpp +@@ -54,7 +54,8 @@ CCECClient::CCECClient(CCECProcessor *processor, const libcec_configuration &con + m_bInitialised(false), + m_bRegistered(false), + m_iCurrentButton(CEC_USER_CONTROL_CODE_UNKNOWN), +- m_buttontime(0), ++ m_initialButtontime(0), ++ m_updateButtontime(0), + m_iPreventForwardingPowerOffCommand(0), + m_iLastKeypressTime(0) + { +@@ -981,9 +982,10 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */) + CLockObject lock(m_mutex); + if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN) + { +- key.duration = (unsigned int) (GetTimeMs() - m_buttontime); ++ unsigned int duration = (unsigned int) (GetTimeMs() - m_updateButtontime); ++ key.duration = (unsigned int) (GetTimeMs() - m_initialButtontime); + +- if (key.duration > m_configuration.iComboKeyTimeoutMs || ++ if (duration > m_configuration.iComboKeyTimeoutMs || + m_configuration.iComboKeyTimeoutMs == 0 || + m_iCurrentButton != m_configuration.comboKey || + bSendComboKey) +@@ -991,14 +993,15 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */) + key.keycode = m_iCurrentButton; + + m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; +- m_buttontime = 0; ++ m_initialButtontime = 0; ++ m_updateButtontime = 0; + } + } + } + + if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) + { +- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key released: %s (%1x)", ToString(key.keycode), key.keycode); ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key released: %s (%1x) D:%dms", ToString(key.keycode), key.keycode, key.duration); + QueueAddKey(key); + } + } +@@ -1012,7 +1015,7 @@ void CCECClient::AddKey(const cec_keypress &key) + AddKey(); + return; + } +- ++ bool isrepeat = false; + cec_keypress transmitKey(key); + cec_user_control_code comboKey(m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5) ? + m_configuration.comboKey : CEC_USER_CONTROL_CODE_STOP); +@@ -1035,22 +1038,27 @@ void CCECClient::AddKey(const cec_keypress &key) + AddKey(true); + } + ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x) current(%lx) duration(%d)", ToString(transmitKey.keycode), transmitKey.keycode, m_iCurrentButton, key.duration); ++ + if (m_iCurrentButton == key.keycode) + { +- m_buttontime = GetTimeMs(); ++ m_updateButtontime = GetTimeMs(); ++ isrepeat = true; + } + else + { +- AddKey(); ++ if (m_iCurrentButton != transmitKey.keycode) ++ AddKey(); + if (key.duration == 0) + { + m_iCurrentButton = transmitKey.keycode; +- m_buttontime = m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN || key.duration > 0 ? 0 : GetTimeMs(); ++ m_initialButtontime = m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN || key.duration > 0 ? 0 : GetTimeMs(); ++ m_updateButtontime = m_initialButtontime; + } + } + } + +- if (key.keycode != comboKey || key.duration > 0) ++ if (!isrepeat && (key.keycode != comboKey || key.duration > 0)) + { + LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x)", ToString(transmitKey.keycode), transmitKey.keycode); + QueueAddKey(transmitKey); +@@ -1074,32 +1082,34 @@ uint16_t CCECClient::CheckKeypressTimeout(void) + { + CLockObject lock(m_mutex); + uint64_t iNow = GetTimeMs(); ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s T:%.3f", __FUNCTION__, iNow*1e-3); + cec_user_control_code comboKey(m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5) ? + m_configuration.comboKey : CEC_USER_CONTROL_CODE_STOP); + uint32_t iTimeoutMs(m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5) ? + m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); + + if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && +- ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_buttontime > iTimeoutMs) || +- (m_iCurrentButton != comboKey && iNow - m_buttontime > CEC_BUTTON_TIMEOUT))) ++ ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime > iTimeoutMs) || ++ (m_iCurrentButton != comboKey && iNow - m_updateButtontime > CEC_BUTTON_TIMEOUT))) + { +- key.duration = (unsigned int) (iNow - m_buttontime); ++ key.duration = (unsigned int) (iNow - m_initialButtontime); + key.keycode = m_iCurrentButton; + + m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; +- m_buttontime = 0; ++ m_initialButtontime = 0; ++ m_updateButtontime = 0; + } + else + { + // time when this keypress will be released and we'd like to be called again + unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; + if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) +- timeout = iTimeoutMs - (iNow - m_buttontime) + 1; ++ timeout = iTimeoutMs - (iNow - m_updateButtontime) + 1; + else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey) +- timeout = CEC_BUTTON_TIMEOUT - (iNow - m_buttontime) + 1; ++ timeout = CEC_BUTTON_TIMEOUT - (iNow - m_updateButtontime) + 1; + if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) + { +- LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_buttontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_updateButtontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); + timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; + } + return timeout; +diff --git a/src/libcec/CECClient.h b/src/libcec/CECClient.h +index c9ce5e3..611c68b 100644 +--- a/src/libcec/CECClient.h ++++ b/src/libcec/CECClient.h +@@ -404,7 +404,8 @@ namespace CEC + PLATFORM::CMutex m_mutex; /**< mutex for changes to this instance */ + PLATFORM::CMutex m_cbMutex; /**< mutex that is held when doing anything with callbacks */ + cec_user_control_code m_iCurrentButton; /**< the control code of the button that's currently held down (if any) */ +- int64_t m_buttontime; /**< the timestamp when the button was pressed (in seconds since epoch), or 0 if none was pressed. */ ++ int64_t m_initialButtontime; /**< the timestamp when the button was initially pressed (in seconds since epoch), or 0 if none was pressed. */ ++ int64_t m_updateButtontime; /**< the timestamp when the button was updated (in seconds since epoch), or 0 if none was pressed. */ + int64_t m_iPreventForwardingPowerOffCommand; /**< prevent forwarding standby commands until this time */ + int64_t m_iLastKeypressTime; /**< last time a key press was sent to the client */ + cec_keypress m_lastKeypress; /**< the last key press that was sent to the client */ +-- +1.9.1 + + +From 273ead6980b69eddf98810eb1eb33d94a7d74fce Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 28 Oct 2014 00:09:18 +0000 +Subject: [PATCH 3/6] Support repeating button presses with configurable repeat + rate + +--- + include/cectypes.h | 6 ++ + src/libcec/CECClient.cpp | 100 +++++++++++++++++++---- + src/libcec/CECClient.h | 6 +- + src/libcec/implementations/CECCommandHandler.cpp | 2 +- + 4 files changed, 96 insertions(+), 18 deletions(-) + +diff --git a/include/cectypes.h b/include/cectypes.h +index acff259..8f098ef 100644 +--- a/include/cectypes.h ++++ b/include/cectypes.h +@@ -1493,6 +1493,8 @@ struct libcec_configuration + XXX changed meaning in 2.2.0 to not break binary compatibility. next major (3.0) release will fix it in a nicer way */ + cec_user_control_code comboKey; /*!< key code that initiates combo keys. defaults to CEC_USER_CONTROL_CODE_F1_BLUE. CEC_USER_CONTROL_CODE_UNKNOWN to disable. added in 2.0.5 */ + uint32_t iComboKeyTimeoutMs; /*!< timeout until the combo key is sent as normal keypress */ ++ uint32_t iButtonRepeatRateMs; /*!< rate at which buttons autorepeat. 0 means rely on CEC device */ ++ uint32_t iButtonReleaseDelayMs;/*!< duration after last update until a button is considered released */ + + #ifdef __cplusplus + libcec_configuration(void) { Clear(); } +@@ -1527,6 +1529,8 @@ struct libcec_configuration + cecVersion == other.cecVersion && + adapterType == other.adapterType && + iDoubleTapTimeout50Ms == other.iDoubleTapTimeout50Ms && ++ iButtonRepeatRateMs == other.iButtonRepeatRateMs && ++ iButtonReleaseDelayMs == other.iButtonReleaseDelayMs && + (other.clientVersion <= LIBCEC_VERSION_TO_UINT(2, 0, 4) || comboKey == other.comboKey) && + (other.clientVersion <= LIBCEC_VERSION_TO_UINT(2, 0, 4) || iComboKeyTimeoutMs == other.iComboKeyTimeoutMs) && + (other.clientVersion < LIBCEC_VERSION_TO_UINT(2, 1, 0) || bPowerOnScreensaver == other.bPowerOnScreensaver)); +@@ -1567,6 +1571,8 @@ struct libcec_configuration + iDoubleTapTimeout50Ms = CEC_DOUBLE_TAP_TIMEOUT_50_MS; + comboKey = CEC_USER_CONTROL_CODE_STOP; + iComboKeyTimeoutMs = CEC_DEFAULT_COMBO_TIMEOUT_MS; ++ iButtonRepeatRateMs = 0; ++ iButtonReleaseDelayMs = CEC_BUTTON_TIMEOUT; + + memset(strDeviceName, 0, 13); + deviceTypes.Clear(); +diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp +index e7935b9..598628d 100644 +--- a/src/libcec/CECClient.cpp ++++ b/src/libcec/CECClient.cpp +@@ -56,6 +56,10 @@ CCECClient::CCECClient(CCECProcessor *processor, const libcec_configuration &con + m_iCurrentButton(CEC_USER_CONTROL_CODE_UNKNOWN), + m_initialButtontime(0), + m_updateButtontime(0), ++ m_repeatButtontime(0), ++ m_releaseButtontime(0), ++ m_pressedButtoncount(0), ++ m_releasedButtoncount(0), + m_iPreventForwardingPowerOffCommand(0), + m_iLastKeypressTime(0) + { +@@ -851,6 +855,9 @@ bool CCECClient::GetCurrentConfiguration(libcec_configuration &configuration) + configuration.bMonitorOnly = m_configuration.bMonitorOnly; + configuration.cecVersion = m_configuration.cecVersion; + configuration.adapterType = m_configuration.adapterType; ++ configuration.iDoubleTapTimeout50Ms = m_configuration.iDoubleTapTimeout50Ms; ++ configuration.iButtonRepeatRateMs = m_configuration.iButtonRepeatRateMs; ++ configuration.iButtonReleaseDelayMs = m_configuration.iButtonReleaseDelayMs; + + return true; + } +@@ -894,6 +901,9 @@ bool CCECClient::SetConfiguration(const libcec_configuration &configuration) + m_configuration.cecVersion = configuration.cecVersion; + m_configuration.adapterType = configuration.adapterType; + m_configuration.iDoubleTapTimeout50Ms = configuration.iDoubleTapTimeout50Ms; ++ m_configuration.iButtonRepeatRateMs = configuration.iButtonRepeatRateMs; ++ m_configuration.iButtonReleaseDelayMs = configuration.iButtonReleaseDelayMs; ++ + m_configuration.deviceTypes.Add(configuration.deviceTypes[0]); + + if (m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5)) +@@ -950,6 +960,7 @@ bool CCECClient::SetConfiguration(const libcec_configuration &configuration) + primary->ActivateSource(); + } + ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s: %d:%d:%d", __FUNCTION__, DoubleTapTimeoutMS(), m_configuration.iButtonRepeatRateMs, m_configuration.iButtonReleaseDelayMs); + return true; + } + +@@ -973,11 +984,15 @@ void CCECClient::AddCommand(const cec_command &command) + } + } + +-void CCECClient::AddKey(bool bSendComboKey /* = false */) ++void CCECClient::AddKey(bool bSendComboKey /* = false */, bool bButtonRelease /* = false */) + { + cec_keypress key; + key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; + ++ // we ignore button releases when supporting repeating keys ++ if (bButtonRelease && m_configuration.iButtonRepeatRateMs && m_configuration.iButtonReleaseDelayMs) ++ return; ++ + { + CLockObject lock(m_mutex); + if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN) +@@ -995,6 +1010,10 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */) + m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; + m_initialButtontime = 0; + m_updateButtontime = 0; ++ m_repeatButtontime = 0; ++ m_releaseButtontime = 0; ++ m_pressedButtoncount = 0; ++ m_releasedButtoncount = 0; + } + } + } +@@ -1012,6 +1031,7 @@ void CCECClient::AddKey(const cec_keypress &key) + key.keycode < CEC_USER_CONTROL_CODE_SELECT) + { + // send back the previous key if there is one ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Unexpected key %s (%1x) D:%dms", ToString(key.keycode), key.keycode, key.duration); + AddKey(); + return; + } +@@ -1035,7 +1055,10 @@ void CCECClient::AddKey(const cec_keypress &key) + transmitKey.keycode = CEC_USER_CONTROL_CODE_DOT; + // default, send back the previous key + else ++ { ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Combo key %s (%1x) D%dms:", ToString(key.keycode), key.keycode, key.duration); + AddKey(true); ++ } + } + + LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x) current(%lx) duration(%d)", ToString(transmitKey.keycode), transmitKey.keycode, m_iCurrentButton, key.duration); +@@ -1043,17 +1066,44 @@ void CCECClient::AddKey(const cec_keypress &key) + if (m_iCurrentButton == key.keycode) + { + m_updateButtontime = GetTimeMs(); +- isrepeat = true; ++ m_releaseButtontime = m_updateButtontime + (m_configuration.iButtonReleaseDelayMs ? m_configuration.iButtonReleaseDelayMs : CEC_BUTTON_TIMEOUT); ++ // want to have seen some updated before considering a repeat ++ if (m_configuration.iButtonRepeatRateMs) ++ { ++ if (!m_repeatButtontime && m_pressedButtoncount > 1) ++ m_repeatButtontime = m_initialButtontime + DoubleTapTimeoutMS(); ++ isrepeat = true; ++ } ++ m_pressedButtoncount++; + } + else + { + if (m_iCurrentButton != transmitKey.keycode) ++ { ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Changed key %s (%1x) D:%dms cur:%lx", ToString(transmitKey.keycode), transmitKey.keycode, transmitKey.duration, m_iCurrentButton); + AddKey(); ++ } + if (key.duration == 0) + { + m_iCurrentButton = transmitKey.keycode; +- m_initialButtontime = m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN || key.duration > 0 ? 0 : GetTimeMs(); +- m_updateButtontime = m_initialButtontime; ++ if (m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN) ++ { ++ m_initialButtontime = 0; ++ m_updateButtontime = 0; ++ m_repeatButtontime = 0; ++ m_releaseButtontime = 0; ++ m_pressedButtoncount = 0; ++ m_releasedButtoncount = 0; ++ } ++ else ++ { ++ m_initialButtontime = GetTimeMs(); ++ m_updateButtontime = m_initialButtontime; ++ m_repeatButtontime = 0; // set this on next update ++ m_releaseButtontime = m_initialButtontime + (m_configuration.iButtonReleaseDelayMs ? m_configuration.iButtonReleaseDelayMs : CEC_BUTTON_TIMEOUT); ++ m_pressedButtoncount = 1; ++ m_releasedButtoncount = 0; ++ } + } + } + } +@@ -1072,12 +1122,16 @@ void CCECClient::SetCurrentButton(const cec_user_control_code iButtonCode) + key.duration = 0; + key.keycode = iButtonCode; + ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "SetCurrentButton %s (%1x) D:%dms cur:%lx", ToString(key.keycode), key.keycode, key.duration); + AddKey(key); + } + + uint16_t CCECClient::CheckKeypressTimeout(void) + { ++ // time when we'd like to be called again ++ unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; + cec_keypress key; ++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; + + { + CLockObject lock(m_mutex); +@@ -1089,8 +1143,8 @@ uint16_t CCECClient::CheckKeypressTimeout(void) + m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); + + if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && +- ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime > iTimeoutMs) || +- (m_iCurrentButton != comboKey && iNow - m_updateButtontime > CEC_BUTTON_TIMEOUT))) ++ ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) || ++ (m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime))) + { + key.duration = (unsigned int) (iNow - m_initialButtontime); + key.keycode = m_iCurrentButton; +@@ -1098,27 +1152,41 @@ uint16_t CCECClient::CheckKeypressTimeout(void) + m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; + m_initialButtontime = 0; + m_updateButtontime = 0; ++ m_repeatButtontime = 0; ++ m_releaseButtontime = 0; ++ m_pressedButtoncount = 0; ++ m_releasedButtoncount = 0; ++ } ++ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++ (m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime)) ++ { ++ key.duration = 0; ++ key.keycode = m_iCurrentButton; ++ m_repeatButtontime = iNow + m_configuration.iButtonRepeatRateMs; ++ timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); + } + else + { +- // time when this keypress will be released and we'd like to be called again +- unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; + if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) +- timeout = iTimeoutMs - (iNow - m_updateButtontime) + 1; +- else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey) +- timeout = CEC_BUTTON_TIMEOUT - (iNow - m_updateButtontime) + 1; ++ timeout = std::min((uint64_t)timeout, m_updateButtontime - iNow + iTimeoutMs); ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey && m_releaseButtontime) ++ timeout = std::min((uint64_t)timeout, m_releaseButtontime - iNow); ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey && m_repeatButtontime) ++ timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); + if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) + { +- LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_updateButtontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); ++ LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_updateButtontime*1e-3, m_releaseButtontime*1e-3, m_iCurrentButton); + timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; + } +- return timeout; + } ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key %s: %s (%1x) timeout:%dms (rel:%d,rep:%d,prs:%d,rel:%d)", key.keycode == CEC_USER_CONTROL_CODE_UNKNOWN ? "idle" : key.duration ? "released" : "repeated", ++ ToString(m_iCurrentButton), m_iCurrentButton, timeout, (int)(m_releaseButtontime ? m_releaseButtontime - iNow : 0), (int)(m_repeatButtontime ? m_repeatButtontime - iNow : 0), m_pressedButtoncount, m_releasedButtoncount); + } + +- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key auto-released: %s (%1x)", ToString(key.keycode), key.keycode); +- QueueAddKey(key); +- return CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) ++ QueueAddKey(key); ++ ++ return timeout; + } + + bool CCECClient::EnableCallbacks(void *cbParam, ICECCallbacks *callbacks) +diff --git a/src/libcec/CECClient.h b/src/libcec/CECClient.h +index 611c68b..adeb5af 100644 +--- a/src/libcec/CECClient.h ++++ b/src/libcec/CECClient.h +@@ -269,7 +269,7 @@ namespace CEC + // callbacks + virtual void Alert(const libcec_alert type, const libcec_parameter ¶m) { QueueAlert(type, param); } + virtual void AddLog(const cec_log_message &message) { QueueAddLog(message); } +- virtual void AddKey(bool bSendComboKey = false); ++ virtual void AddKey(bool bSendComboKey = false, bool bButtonRelease = false); + virtual void AddKey(const cec_keypress &key); + virtual void SetCurrentButton(const cec_user_control_code iButtonCode); + virtual uint16_t CheckKeypressTimeout(void); +@@ -406,6 +406,10 @@ namespace CEC + cec_user_control_code m_iCurrentButton; /**< the control code of the button that's currently held down (if any) */ + int64_t m_initialButtontime; /**< the timestamp when the button was initially pressed (in seconds since epoch), or 0 if none was pressed. */ + int64_t m_updateButtontime; /**< the timestamp when the button was updated (in seconds since epoch), or 0 if none was pressed. */ ++ int64_t m_repeatButtontime; /**< the timestamp when the button will next repeat (in seconds since epoch), or 0 if repeat is disabled. */ ++ int64_t m_releaseButtontime; /**< the timestamp when the button will be released (in seconds since epoch), or 0 if none was pressed. */ ++ int32_t m_pressedButtoncount; /**< the number of times a button released message has been seen for this press. */ ++ int32_t m_releasedButtoncount; /**< the number of times a button pressed message has been seen for this press. */ + int64_t m_iPreventForwardingPowerOffCommand; /**< prevent forwarding standby commands until this time */ + int64_t m_iLastKeypressTime; /**< last time a key press was sent to the client */ + cec_keypress m_lastKeypress; /**< the last key press that was sent to the client */ +diff --git a/src/libcec/implementations/CECCommandHandler.cpp b/src/libcec/implementations/CECCommandHandler.cpp +index 6d6244e..d64186f 100644 +--- a/src/libcec/implementations/CECCommandHandler.cpp ++++ b/src/libcec/implementations/CECCommandHandler.cpp +@@ -770,7 +770,7 @@ int CCECCommandHandler::HandleUserControlRelease(const cec_command &command) + + CECClientPtr client = m_processor->GetClient(command.destination); + if (client) +- client->AddKey(); ++ client->AddKey(false, true); + + return COMMAND_HANDLED; + } +-- +1.9.1 + + +From 3336d0827f7fd159430f3431642b07090c06c869 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 28 Oct 2014 01:21:35 +0000 +Subject: [PATCH 4/6] Skip double press removal. It is handled through other + means. + +--- + src/libcec/CECClient.cpp | 18 +----------------- + src/libcec/CECClient.h | 2 -- + 2 files changed, 1 insertion(+), 19 deletions(-) + +diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp +index 598628d..dccd874 100644 +--- a/src/libcec/CECClient.cpp ++++ b/src/libcec/CECClient.cpp +@@ -60,11 +60,8 @@ CCECClient::CCECClient(CCECProcessor *processor, const libcec_configuration &con + m_releaseButtontime(0), + m_pressedButtoncount(0), + m_releasedButtoncount(0), +- m_iPreventForwardingPowerOffCommand(0), +- m_iLastKeypressTime(0) ++ m_iPreventForwardingPowerOffCommand(0) + { +- m_lastKeypress.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; +- m_lastKeypress.duration = 0; + m_configuration.Clear(); + // set the initial configuration + SetConfiguration(configuration); +@@ -1647,20 +1644,7 @@ void CCECClient::CallbackAddKey(const cec_keypress &key) + { + CLockObject lock(m_cbMutex); + if (m_configuration.callbacks && m_configuration.callbacks->CBCecKeyPress) +- { +- // prevent double taps +- int64_t now = GetTimeMs(); +- if (m_lastKeypress.keycode != key.keycode || +- key.duration > 0 || +- now - m_iLastKeypressTime >= DoubleTapTimeoutMS()) +- { +- // no double tap +- if (key.duration == 0) +- m_iLastKeypressTime = now; +- m_lastKeypress = key; + m_configuration.callbacks->CBCecKeyPress(m_configuration.callbackParam, key); +- } +- } + } + + void CCECClient::CallbackAddLog(const cec_log_message &message) +diff --git a/src/libcec/CECClient.h b/src/libcec/CECClient.h +index adeb5af..43a713b 100644 +--- a/src/libcec/CECClient.h ++++ b/src/libcec/CECClient.h +@@ -411,8 +411,6 @@ namespace CEC + int32_t m_pressedButtoncount; /**< the number of times a button released message has been seen for this press. */ + int32_t m_releasedButtoncount; /**< the number of times a button pressed message has been seen for this press. */ + int64_t m_iPreventForwardingPowerOffCommand; /**< prevent forwarding standby commands until this time */ +- int64_t m_iLastKeypressTime; /**< last time a key press was sent to the client */ +- cec_keypress m_lastKeypress; /**< the last key press that was sent to the client */ + PLATFORM::SyncedBuffer m_callbackCalls; + }; + } +-- +1.9.1 + + +From 0dd0234f620a546bfa843172648383f83d88088c Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 3 Nov 2014 23:28:04 +0000 +Subject: [PATCH 5/6] Pass through duration on all button repeats + +--- + src/libcec/CECClient.cpp | 34 ++++++++++++++++++++++++---------- + 1 file changed, 24 insertions(+), 10 deletions(-) + +diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp +index dccd874..1946148 100644 +--- a/src/libcec/CECClient.cpp ++++ b/src/libcec/CECClient.cpp +@@ -986,10 +986,6 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */, bool bButtonRelease /* + cec_keypress key; + key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; + +- // we ignore button releases when supporting repeating keys +- if (bButtonRelease && m_configuration.iButtonRepeatRateMs && m_configuration.iButtonReleaseDelayMs) +- return; +- + { + CLockObject lock(m_mutex); + if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN) +@@ -1015,6 +1011,10 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */, bool bButtonRelease /* + } + } + ++ // we don't forward releases when supporting repeating keys ++ if (bButtonRelease && m_configuration.iButtonRepeatRateMs) ++ return; ++ + if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) + { + LIB_CEC->AddLog(CEC_LOG_DEBUG, "key released: %s (%1x) D:%dms", ToString(key.keycode), key.keycode, key.duration); +@@ -1107,7 +1107,7 @@ void CCECClient::AddKey(const cec_keypress &key) + + if (!isrepeat && (key.keycode != comboKey || key.duration > 0)) + { +- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x)", ToString(transmitKey.keycode), transmitKey.keycode); ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x, %d)", ToString(transmitKey.keycode), transmitKey.keycode, transmitKey.duration); + QueueAddKey(transmitKey); + } + } +@@ -1129,6 +1129,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) + unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; + cec_keypress key; + key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++ key.duration = 0; + + { + CLockObject lock(m_mutex); +@@ -1140,8 +1141,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) + m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); + + if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && +- ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) || +- (m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime))) ++ m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) + { + key.duration = (unsigned int) (iNow - m_initialButtontime); + key.keycode = m_iCurrentButton; +@@ -1155,9 +1155,23 @@ uint16_t CCECClient::CheckKeypressTimeout(void) + m_releasedButtoncount = 0; + } + else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++ m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime) ++ { ++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++ ++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; ++ m_initialButtontime = 0; ++ m_updateButtontime = 0; ++ m_repeatButtontime = 0; ++ m_releaseButtontime = 0; ++ m_pressedButtoncount = 0; ++ m_releasedButtoncount = 0; ++ } ++ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && + (m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime)) + { +- key.duration = 0; ++ key.duration = (unsigned int) (iNow - m_initialButtontime); + key.keycode = m_iCurrentButton; + m_repeatButtontime = iNow + m_configuration.iButtonRepeatRateMs; + timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); +@@ -1176,8 +1190,8 @@ uint16_t CCECClient::CheckKeypressTimeout(void) + timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; + } + } +- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key %s: %s (%1x) timeout:%dms (rel:%d,rep:%d,prs:%d,rel:%d)", key.keycode == CEC_USER_CONTROL_CODE_UNKNOWN ? "idle" : key.duration ? "released" : "repeated", +- ToString(m_iCurrentButton), m_iCurrentButton, timeout, (int)(m_releaseButtontime ? m_releaseButtontime - iNow : 0), (int)(m_repeatButtontime ? m_repeatButtontime - iNow : 0), m_pressedButtoncount, m_releasedButtoncount); ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Key %s: %s (duration:%d) (%1x) timeout:%dms (rel:%d,rep:%d,prs:%d,rel:%d)", ToString(m_iCurrentButton), key.keycode == CEC_USER_CONTROL_CODE_UNKNOWN ? "idle" : m_repeatButtontime ? "repeated" : "released", key.duration, ++ m_iCurrentButton, timeout, (int)(m_releaseButtontime ? m_releaseButtontime - iNow : 0), (int)(m_repeatButtontime ? m_repeatButtontime - iNow : 0), m_pressedButtoncount, m_releasedButtoncount); + } + + if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) +-- +1.9.1 + + +From 1ea01f59d8186d4d53af41961aaccbbc11651115 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 5 Nov 2014 21:04:25 +0000 +Subject: [PATCH 6/6] squash: Fix for stop needing to be pressed twice + +--- + src/libcec/CECClient.cpp | 17 ++++++++--------- + 1 file changed, 8 insertions(+), 9 deletions(-) + +diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp +index 1946148..f4f114b 100644 +--- a/src/libcec/CECClient.cpp ++++ b/src/libcec/CECClient.cpp +@@ -1131,6 +1131,8 @@ uint16_t CCECClient::CheckKeypressTimeout(void) + key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; + key.duration = 0; + ++ if (m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN) ++ return timeout; + { + CLockObject lock(m_mutex); + uint64_t iNow = GetTimeMs(); +@@ -1140,8 +1142,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) + uint32_t iTimeoutMs(m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5) ? + m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); + +- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && +- m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) ++ if (m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) + { + key.duration = (unsigned int) (iNow - m_initialButtontime); + key.keycode = m_iCurrentButton; +@@ -1154,8 +1155,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) + m_pressedButtoncount = 0; + m_releasedButtoncount = 0; + } +- else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && +- m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime) ++ else if (m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime) + { + key.duration = (unsigned int) (iNow - m_initialButtontime); + key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; +@@ -1168,8 +1168,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) + m_pressedButtoncount = 0; + m_releasedButtoncount = 0; + } +- else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && +- (m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime)) ++ else if (m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime) + { + key.duration = (unsigned int) (iNow - m_initialButtontime); + key.keycode = m_iCurrentButton; +@@ -1178,11 +1177,11 @@ uint16_t CCECClient::CheckKeypressTimeout(void) + } + else + { +- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) ++ if (m_iCurrentButton == comboKey && iTimeoutMs > 0) + timeout = std::min((uint64_t)timeout, m_updateButtontime - iNow + iTimeoutMs); +- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey && m_releaseButtontime) ++ if (m_iCurrentButton != comboKey && m_releaseButtontime) + timeout = std::min((uint64_t)timeout, m_releaseButtontime - iNow); +- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey && m_repeatButtontime) ++ if (m_iCurrentButton != comboKey && m_repeatButtontime) + timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); + if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) + { +-- +1.9.1 + diff --git a/packages/graphics/bcm2835-driver/package.mk b/packages/graphics/bcm2835-driver/package.mk index f3ada01068..c6077f4ab5 100644 --- a/packages/graphics/bcm2835-driver/package.mk +++ b/packages/graphics/bcm2835-driver/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="bcm2835-driver" -PKG_VERSION="47d51d6" +PKG_VERSION="53b9bb9" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="nonfree" diff --git a/packages/graphics/libepoxy/package.mk b/packages/graphics/libepoxy/package.mk index 7908be9555..95551482ab 100644 --- a/packages/graphics/libepoxy/package.mk +++ b/packages/graphics/libepoxy/package.mk @@ -22,12 +22,12 @@ # in Xorg.log PKG_NAME="libepoxy" -PKG_VERSION="b2ae054" +PKG_VERSION="1.3.1" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="https://github.com/anholt/libepoxy" -PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="https://github.com/anholt/libepoxy/releases/download/v$PKG_VERSION/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS_TARGET="toolchain $OPENGL" PKG_PRIORITY="optional" PKG_SECTION="graphics" diff --git a/packages/graphics/libjpeg-turbo/package.mk b/packages/graphics/libjpeg-turbo/package.mk index 15c218c2d2..a5829b13da 100644 --- a/packages/graphics/libjpeg-turbo/package.mk +++ b/packages/graphics/libjpeg-turbo/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="libjpeg-turbo" -PKG_VERSION="1.4.0" +PKG_VERSION="1.4.1" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/graphics/mesa/package.mk b/packages/graphics/mesa/package.mk index 978c7cc329..93f10cdc3a 100644 --- a/packages/graphics/mesa/package.mk +++ b/packages/graphics/mesa/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="mesa" -PKG_VERSION="10.6.2" +PKG_VERSION="10.6.4" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="OSS" diff --git a/packages/linux-firmware/brcmfmac_sdio-firmware/system.d/brcmfmac_sdio-firmware-aml@.service b/packages/linux-firmware/brcmfmac_sdio-firmware/system.d/brcmfmac_sdio-firmware-aml@.service index e2638ad36a..2c84c734e9 100644 --- a/packages/linux-firmware/brcmfmac_sdio-firmware/system.d/brcmfmac_sdio-firmware-aml@.service +++ b/packages/linux-firmware/brcmfmac_sdio-firmware/system.d/brcmfmac_sdio-firmware-aml@.service @@ -3,6 +3,6 @@ Description=Broadcom sdio firmware update for %I ConditionPathExists=/dev/ttyS1 [Service] -Type=oneshot +Type=simple RemainAfterExit=yes ExecStart=/usr/bin/brcm_patchram_plus --patchram /lib/firmware/brcm/%I.hcd --baudrate 3000000 --use_baudrate_for_download /dev/ttyS1 --enable_hci --no2bytes --tosleep=50000 diff --git a/packages/linux-firmware/brcmfmac_sdio-firmware/system.d/brcmfmac_sdio-firmware-imx@.service b/packages/linux-firmware/brcmfmac_sdio-firmware/system.d/brcmfmac_sdio-firmware-imx@.service index 3515777a33..fb06133cf3 100644 --- a/packages/linux-firmware/brcmfmac_sdio-firmware/system.d/brcmfmac_sdio-firmware-imx@.service +++ b/packages/linux-firmware/brcmfmac_sdio-firmware/system.d/brcmfmac_sdio-firmware-imx@.service @@ -3,6 +3,6 @@ Description=Broadcom sdio firmware update for %I ConditionPathExists=/dev/ttymxc3 [Service] -Type=oneshot +Type=simple RemainAfterExit=yes ExecStart=/usr/bin/brcm_patchram_plus --patchram /lib/firmware/brcm/%I.hcd --baudrate 3000000 --use_baudrate_for_download /dev/ttymxc3 --enable_hci --no2bytes --tosleep=50000 diff --git a/packages/linux-firmware/dvb-firmware/package.mk b/packages/linux-firmware/dvb-firmware/package.mk index ea096ef5e7..3fba791c3f 100644 --- a/packages/linux-firmware/dvb-firmware/package.mk +++ b/packages/linux-firmware/dvb-firmware/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="dvb-firmware" -PKG_VERSION="0.0.48" +PKG_VERSION="0.0.49" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="Free-to-use" diff --git a/packages/linux-firmware/iwlwifi-firmware/package.mk b/packages/linux-firmware/iwlwifi-firmware/package.mk index 88e7d2b729..6198dff6c2 100644 --- a/packages/linux-firmware/iwlwifi-firmware/package.mk +++ b/packages/linux-firmware/iwlwifi-firmware/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="iwlwifi-firmware" -PKG_VERSION="0.0.2" +PKG_VERSION="0.0.3" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="Free-to-use" diff --git a/packages/linux/package.mk b/packages/linux/package.mk index 5feb91c204..a5fb472314 100644 --- a/packages/linux/package.mk +++ b/packages/linux/package.mk @@ -40,7 +40,7 @@ case "$LINUX" in PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET imx6-status-led imx6-soc-fan" ;; *) - PKG_VERSION="4.1.2" + PKG_VERSION="4.1.6" PKG_URL="http://www.kernel.org/pub/linux/kernel/v4.x/$PKG_NAME-$PKG_VERSION.tar.xz" ;; esac diff --git a/packages/linux/patches/4.1.2/linux-003-no_dev_console.patch b/packages/linux/patches/4.1.6/linux-003-no_dev_console.patch similarity index 100% rename from packages/linux/patches/4.1.2/linux-003-no_dev_console.patch rename to packages/linux/patches/4.1.6/linux-003-no_dev_console.patch diff --git a/packages/linux/patches/4.1.2/linux-051-ouya_controller_support.patch b/packages/linux/patches/4.1.6/linux-051-ouya_controller_support.patch similarity index 100% rename from packages/linux/patches/4.1.2/linux-051-ouya_controller_support.patch rename to packages/linux/patches/4.1.6/linux-051-ouya_controller_support.patch diff --git a/packages/linux/patches/4.1.2/linux-052-XBOX_remote_support.patch b/packages/linux/patches/4.1.6/linux-052-XBOX_remote_support.patch similarity index 100% rename from packages/linux/patches/4.1.2/linux-052-XBOX_remote_support.patch rename to packages/linux/patches/4.1.6/linux-052-XBOX_remote_support.patch diff --git a/packages/linux/patches/4.1.2/linux-053-spinelplus-remote-0.2.patch b/packages/linux/patches/4.1.6/linux-053-spinelplus-remote-0.2.patch similarity index 100% rename from packages/linux/patches/4.1.2/linux-053-spinelplus-remote-0.2.patch rename to packages/linux/patches/4.1.6/linux-053-spinelplus-remote-0.2.patch diff --git a/packages/linux/patches/4.1.2/linux-054-nuvoton_revert_d7b290a1056c5564eec8a1b169c6e84ff3.6.114c13.patch b/packages/linux/patches/4.1.6/linux-054-nuvoton_revert_d7b290a1056c5564eec8a1b169c6e84ff3.6.114c13.patch similarity index 100% rename from packages/linux/patches/4.1.2/linux-054-nuvoton_revert_d7b290a1056c5564eec8a1b169c6e84ff3.6.114c13.patch rename to packages/linux/patches/4.1.6/linux-054-nuvoton_revert_d7b290a1056c5564eec8a1b169c6e84ff3.6.114c13.patch diff --git a/packages/linux/patches/4.1.2/linux-056-add_Adaptec_eHome_Infrared_Receiver.patch b/packages/linux/patches/4.1.6/linux-056-add_Adaptec_eHome_Infrared_Receiver.patch similarity index 100% rename from packages/linux/patches/4.1.2/linux-056-add_Adaptec_eHome_Infrared_Receiver.patch rename to packages/linux/patches/4.1.6/linux-056-add_Adaptec_eHome_Infrared_Receiver.patch diff --git a/packages/linux/patches/4.1.2/linux-057-Removed-MCE-customer-code-restriction-in-rc6-decode.patch b/packages/linux/patches/4.1.6/linux-057-Removed-MCE-customer-code-restriction-in-rc6-decode.patch similarity index 100% rename from packages/linux/patches/4.1.2/linux-057-Removed-MCE-customer-code-restriction-in-rc6-decode.patch rename to packages/linux/patches/4.1.6/linux-057-Removed-MCE-customer-code-restriction-in-rc6-decode.patch diff --git a/packages/linux/patches/4.1.2/linux-057-add_SMK_Manufacturing_Inc_Infrared_Receiver.patch b/packages/linux/patches/4.1.6/linux-057-add_SMK_Manufacturing_Inc_Infrared_Receiver.patch similarity index 100% rename from packages/linux/patches/4.1.2/linux-057-add_SMK_Manufacturing_Inc_Infrared_Receiver.patch rename to packages/linux/patches/4.1.6/linux-057-add_SMK_Manufacturing_Inc_Infrared_Receiver.patch diff --git a/packages/linux/patches/4.1.2/linux-058.05-hid_sony-add_autorepeat_for_PS3_remotes.patch b/packages/linux/patches/4.1.6/linux-058.05-hid_sony-add_autorepeat_for_PS3_remotes.patch similarity index 100% rename from packages/linux/patches/4.1.2/linux-058.05-hid_sony-add_autorepeat_for_PS3_remotes.patch rename to packages/linux/patches/4.1.6/linux-058.05-hid_sony-add_autorepeat_for_PS3_remotes.patch diff --git a/packages/linux/patches/4.1.2/linux-062-imon_pad_ignore_diagonal.patch b/packages/linux/patches/4.1.6/linux-062-imon_pad_ignore_diagonal.patch similarity index 100% rename from packages/linux/patches/4.1.2/linux-062-imon_pad_ignore_diagonal.patch rename to packages/linux/patches/4.1.6/linux-062-imon_pad_ignore_diagonal.patch diff --git a/packages/linux/patches/4.1.6/linux-063-xpad-fix_xbox360_wireless.patch b/packages/linux/patches/4.1.6/linux-063-xpad-fix_xbox360_wireless.patch new file mode 100644 index 0000000000..11ffb9e7fa --- /dev/null +++ b/packages/linux/patches/4.1.6/linux-063-xpad-fix_xbox360_wireless.patch @@ -0,0 +1,932 @@ +From 0f578b91219bd354a170eb53359336f67bbfda57 Mon Sep 17 00:00:00 2001 +From: Matt DeVillier +Date: Tue, 28 Jul 2015 11:19:40 -0500 +Subject: [PATCH 1/1] linux/drivers/input/joystick/xpad: fixes for xbox360/one controllers + +merged from https://github.com/paroj/xpad + +- fixed blinking LED on Xbox 360 Wireless Controllers +- only expose actually connected Xbox 360 Wireless Controllers +- fixed kernel warnings due to submitting active URB requests +- updated Xbox One controller force feedback +- controller still works after suspend/ resume +- Xbox 360 Wireless button mappings are now compatible with Xbox 360 (non-wireless) mappings + +Signed-off-by: Matt DeVillier +--- + drivers/input/joystick/xpad.c | 647 +++++++++++++++++++++++++----------------- + 1 file changed, 387 insertions(+), 260 deletions(-) + +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index 61c7611..afecd26 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -328,10 +328,8 @@ struct usb_xpad { + unsigned char *idata; /* input data */ + dma_addr_t idata_dma; + +- struct urb *bulk_out; +- unsigned char *bdata; +- + struct urb *irq_out; /* urb for interrupt out report */ ++ int irq_out_active; /* we must not use an active URB */ + unsigned char *odata; /* output data */ + dma_addr_t odata_dma; + struct mutex odata_mutex; +@@ -344,8 +342,17 @@ struct usb_xpad { + + int mapping; /* map d-pad to buttons or to axes */ + int xtype; /* type of xbox device */ ++ unsigned long pad_nr; /* the order x360 pads were attached */ ++ const char *name; /* name of the device */ ++ struct work_struct work; /* init/remove device from callback */ ++ unsigned char odata_serial; /* serial number for xbox one protocol */ + }; + ++static unsigned long xpad_pad_seq; ++ ++static int xpad_init_input(struct usb_xpad *xpad); ++static void xpad_deinit_input(struct usb_xpad *xpad); ++ + /* + * xpad_process_packet + * +@@ -355,7 +362,6 @@ struct usb_xpad { + * The used report descriptor was taken from ITO Takayukis website: + * http://euc.jp/periphs/xbox-controller.ja.html + */ +- + static void xpad_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *data) + { + struct input_dev *dev = xpad->dev; +@@ -438,7 +444,14 @@ static void xpad360_process_packet(struct usb_xpad *xpad, + input_report_key(dev, BTN_TRIGGER_HAPPY2, data[2] & 0x08); + input_report_key(dev, BTN_TRIGGER_HAPPY3, data[2] & 0x01); + input_report_key(dev, BTN_TRIGGER_HAPPY4, data[2] & 0x02); +- } else { ++ } ++ /* this should be a simple else block. However historically xbox360w ++ * has mapped DPAD to buttons while xbox360 did not. ++ * This made no sense, but now we can not just switch back and have to ++ * support both behaviors. ++ */ ++ if (!(xpad->mapping & MAP_DPAD_TO_BUTTONS) || ++ xpad->xtype == XTYPE_XBOX360W) { + input_report_abs(dev, ABS_HAT0X, + !!(data[2] & 0x08) - !!(data[2] & 0x04)); + input_report_abs(dev, ABS_HAT0Y, +@@ -488,6 +501,24 @@ static void xpad360_process_packet(struct usb_xpad *xpad, + input_sync(dev); + } + ++static void xpad_identify_controller(struct usb_xpad *xpad); ++ ++static void presence_work_function(struct work_struct *work) ++{ ++ struct usb_xpad *xpad = container_of(work, struct usb_xpad, work); ++ int error; ++ ++ if (xpad->pad_present) { ++ error = xpad_init_input(xpad); ++ if (error) { ++ /* complain only, not much else we can do here */ ++ dev_err(&xpad->dev->dev, "unable to init device\n"); ++ } ++ } else { ++ xpad_deinit_input(xpad); ++ } ++} ++ + /* + * xpad360w_process_packet + * +@@ -502,16 +533,18 @@ static void xpad360_process_packet(struct usb_xpad *xpad, + * 01.1 - Pad state (Bytes 4+) valid + * + */ +- + static void xpad360w_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *data) + { ++ int presence; ++ + /* Presence change */ + if (data[0] & 0x08) { +- if (data[1] & 0x80) { +- xpad->pad_present = 1; +- usb_submit_urb(xpad->bulk_out, GFP_ATOMIC); +- } else +- xpad->pad_present = 0; ++ presence = (data[1] & 0x80) != 0; ++ ++ if (xpad->pad_present != presence) { ++ xpad->pad_present = presence; ++ schedule_work(&xpad->work); ++ } + } + + /* Valid pad data */ +@@ -666,28 +699,6 @@ exit: + __func__, retval); + } + +-static void xpad_bulk_out(struct urb *urb) +-{ +- struct usb_xpad *xpad = urb->context; +- struct device *dev = &xpad->intf->dev; +- +- switch (urb->status) { +- case 0: +- /* success */ +- break; +- case -ECONNRESET: +- case -ENOENT: +- case -ESHUTDOWN: +- /* this urb is terminated, clean up */ +- dev_dbg(dev, "%s - urb shutting down with status: %d\n", +- __func__, urb->status); +- break; +- default: +- dev_dbg(dev, "%s - nonzero urb status received: %d\n", +- __func__, urb->status); +- } +-} +- + static void xpad_irq_out(struct urb *urb) + { + struct usb_xpad *xpad = urb->context; +@@ -699,6 +710,7 @@ static void xpad_irq_out(struct urb *urb) + switch (status) { + case 0: + /* success */ ++ xpad->irq_out_active = 0; + return; + + case -ECONNRESET: +@@ -707,6 +719,7 @@ static void xpad_irq_out(struct urb *urb) + /* this urb is terminated, clean up */ + dev_dbg(dev, "%s - urb shutting down with status: %d\n", + __func__, status); ++ xpad->irq_out_active = 0; + return; + + default: +@@ -726,7 +739,6 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad) + { + struct usb_endpoint_descriptor *ep_irq_out; + int ep_irq_out_idx; +- int error; + + if (xpad->xtype == XTYPE_UNKNOWN) + return 0; +@@ -734,16 +746,15 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad) + xpad->odata = usb_alloc_coherent(xpad->udev, XPAD_PKT_LEN, + GFP_KERNEL, &xpad->odata_dma); + if (!xpad->odata) { +- error = -ENOMEM; +- goto fail1; ++ return -ENOMEM; + } + + mutex_init(&xpad->odata_mutex); + + xpad->irq_out = usb_alloc_urb(0, GFP_KERNEL); + if (!xpad->irq_out) { +- error = -ENOMEM; +- goto fail2; ++ usb_free_coherent(xpad->udev, XPAD_PKT_LEN, xpad->odata, xpad->odata_dma); ++ return -ENOMEM; + } + + /* Xbox One controller has in/out endpoints swapped. */ +@@ -758,9 +769,6 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad) + xpad->irq_out->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; + + return 0; +- +- fail2: usb_free_coherent(xpad->udev, XPAD_PKT_LEN, xpad->odata, xpad->odata_dma); +- fail1: return error; + } + + static void xpad_stop_output(struct usb_xpad *xpad) +@@ -782,80 +790,94 @@ static void xpad_deinit_output(struct usb_xpad *xpad) + static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect *effect) + { + struct usb_xpad *xpad = input_get_drvdata(dev); ++ __u16 strong; ++ __u16 weak; ++ int retval; + +- if (effect->type == FF_RUMBLE) { +- __u16 strong = effect->u.rumble.strong_magnitude; +- __u16 weak = effect->u.rumble.weak_magnitude; +- +- switch (xpad->xtype) { +- +- case XTYPE_XBOX: +- xpad->odata[0] = 0x00; +- xpad->odata[1] = 0x06; +- xpad->odata[2] = 0x00; +- xpad->odata[3] = strong / 256; /* left actuator */ +- xpad->odata[4] = 0x00; +- xpad->odata[5] = weak / 256; /* right actuator */ +- xpad->irq_out->transfer_buffer_length = 6; +- +- return usb_submit_urb(xpad->irq_out, GFP_ATOMIC); +- +- case XTYPE_XBOX360: +- xpad->odata[0] = 0x00; +- xpad->odata[1] = 0x08; +- xpad->odata[2] = 0x00; +- xpad->odata[3] = strong / 256; /* left actuator? */ +- xpad->odata[4] = weak / 256; /* right actuator? */ +- xpad->odata[5] = 0x00; +- xpad->odata[6] = 0x00; +- xpad->odata[7] = 0x00; +- xpad->irq_out->transfer_buffer_length = 8; +- +- return usb_submit_urb(xpad->irq_out, GFP_ATOMIC); +- +- case XTYPE_XBOX360W: +- xpad->odata[0] = 0x00; +- xpad->odata[1] = 0x01; +- xpad->odata[2] = 0x0F; +- xpad->odata[3] = 0xC0; +- xpad->odata[4] = 0x00; +- xpad->odata[5] = strong / 256; +- xpad->odata[6] = weak / 256; +- xpad->odata[7] = 0x00; +- xpad->odata[8] = 0x00; +- xpad->odata[9] = 0x00; +- xpad->odata[10] = 0x00; +- xpad->odata[11] = 0x00; +- xpad->irq_out->transfer_buffer_length = 12; +- +- return usb_submit_urb(xpad->irq_out, GFP_ATOMIC); +- +- case XTYPE_XBOXONE: +- xpad->odata[0] = 0x09; /* activate rumble */ +- xpad->odata[1] = 0x08; +- xpad->odata[2] = 0x00; +- xpad->odata[3] = 0x08; /* continuous effect */ +- xpad->odata[4] = 0x00; /* simple rumble mode */ +- xpad->odata[5] = 0x03; /* L and R actuator only */ +- xpad->odata[6] = 0x00; /* TODO: LT actuator */ +- xpad->odata[7] = 0x00; /* TODO: RT actuator */ +- xpad->odata[8] = strong / 256; /* left actuator */ +- xpad->odata[9] = weak / 256; /* right actuator */ +- xpad->odata[10] = 0x80; /* length of pulse */ +- xpad->odata[11] = 0x00; /* stop period of pulse */ +- xpad->irq_out->transfer_buffer_length = 12; +- +- return usb_submit_urb(xpad->irq_out, GFP_ATOMIC); +- +- default: +- dev_dbg(&xpad->dev->dev, +- "%s - rumble command sent to unsupported xpad type: %d\n", +- __func__, xpad->xtype); +- return -1; +- } ++ if (effect->type != FF_RUMBLE) ++ return 0; ++ ++ strong = effect->u.rumble.strong_magnitude; ++ weak = effect->u.rumble.weak_magnitude; ++ ++ mutex_lock(&xpad->odata_mutex); ++ ++ switch (xpad->xtype) { ++ case XTYPE_XBOX: ++ xpad->odata[0] = 0x00; ++ xpad->odata[1] = 0x06; ++ xpad->odata[2] = 0x00; ++ xpad->odata[3] = strong / 256; /* left actuator */ ++ xpad->odata[4] = 0x00; ++ xpad->odata[5] = weak / 256; /* right actuator */ ++ xpad->irq_out->transfer_buffer_length = 6; ++ break; ++ ++ case XTYPE_XBOX360: ++ xpad->odata[0] = 0x00; ++ xpad->odata[1] = 0x08; ++ xpad->odata[2] = 0x00; ++ xpad->odata[3] = strong / 256; /* left actuator? */ ++ xpad->odata[4] = weak / 256; /* right actuator? */ ++ xpad->odata[5] = 0x00; ++ xpad->odata[6] = 0x00; ++ xpad->odata[7] = 0x00; ++ xpad->irq_out->transfer_buffer_length = 8; ++ break; ++ ++ case XTYPE_XBOX360W: ++ xpad->odata[0] = 0x00; ++ xpad->odata[1] = 0x01; ++ xpad->odata[2] = 0x0F; ++ xpad->odata[3] = 0xC0; ++ xpad->odata[4] = 0x00; ++ xpad->odata[5] = strong / 256; ++ xpad->odata[6] = weak / 256; ++ xpad->odata[7] = 0x00; ++ xpad->odata[8] = 0x00; ++ xpad->odata[9] = 0x00; ++ xpad->odata[10] = 0x00; ++ xpad->odata[11] = 0x00; ++ xpad->irq_out->transfer_buffer_length = 12; ++ break; ++ ++ case XTYPE_XBOXONE: ++ xpad->odata[0] = 0x09; /* activate rumble */ ++ xpad->odata[1] = 0x08; ++ xpad->odata[2] = xpad->odata_serial++; ++ xpad->odata[3] = 0x08; /* continuous effect */ ++ xpad->odata[4] = 0x00; /* simple rumble mode */ ++ xpad->odata[5] = 0x03; /* L and R actuator only */ ++ xpad->odata[6] = 0x00; /* TODO: LT actuator */ ++ xpad->odata[7] = 0x00; /* TODO: RT actuator */ ++ xpad->odata[8] = strong / 512; /* left actuator */ ++ xpad->odata[9] = weak / 512; /* right actuator */ ++ xpad->odata[10] = 0x80; /* length of pulse */ ++ xpad->odata[11] = 0x00; /* stop period of pulse */ ++ xpad->odata[12] = 0x00; ++ xpad->irq_out->transfer_buffer_length = 13; ++ break; ++ ++ default: ++ mutex_unlock(&xpad->odata_mutex); ++ dev_dbg(&xpad->dev->dev, ++ "%s - rumble command sent to unsupported xpad type: %d\n", ++ __func__, xpad->xtype); ++ return -EINVAL; + } + +- return 0; ++ if (!xpad->irq_out_active) { ++ retval = usb_submit_urb(xpad->irq_out, GFP_ATOMIC); ++ xpad->irq_out_active = 1; ++ } else { ++ retval = -EIO; ++ dev_dbg(&xpad->dev->dev, "%s - dropped, irq_out is active\n", ++ __func__); ++ } ++ ++ mutex_unlock(&xpad->odata_mutex); ++ ++ return retval; + } + + static int xpad_init_ff(struct usb_xpad *xpad) +@@ -881,17 +903,78 @@ struct xpad_led { + struct usb_xpad *xpad; + }; + ++/** ++ * set the LEDs on Xbox360 / Wireless Controllers ++ * @param command ++ * 0: off ++ * 1: all blink, then previous setting ++ * 2: 1/top-left blink, then on ++ * 3: 2/top-right blink, then on ++ * 4: 3/bottom-left blink, then on ++ * 5: 4/bottom-right blink, then on ++ * 6: 1/top-left on ++ * 7: 2/top-right on ++ * 8: 3/bottom-left on ++ * 9: 4/bottom-right on ++ * 10: rotate ++ * 11: blink, based on previous setting ++ * 12: slow blink, based on previous setting ++ * 13: rotate with two lights ++ * 14: persistent slow all blink ++ * 15: blink once, then previous setting ++ */ + static void xpad_send_led_command(struct usb_xpad *xpad, int command) + { +- if (command >= 0 && command < 14) { +- mutex_lock(&xpad->odata_mutex); ++ command %= 16; ++ ++ mutex_lock(&xpad->odata_mutex); ++ ++ switch (xpad->xtype) { ++ case XTYPE_XBOX360: + xpad->odata[0] = 0x01; + xpad->odata[1] = 0x03; + xpad->odata[2] = command; + xpad->irq_out->transfer_buffer_length = 3; +- usb_submit_urb(xpad->irq_out, GFP_KERNEL); +- mutex_unlock(&xpad->odata_mutex); ++ break; ++ case XTYPE_XBOX360W: ++ xpad->odata[0] = 0x00; ++ xpad->odata[1] = 0x00; ++ xpad->odata[2] = 0x08; ++ xpad->odata[3] = 0x40 + command; ++ xpad->odata[4] = 0x00; ++ xpad->odata[5] = 0x00; ++ xpad->odata[6] = 0x00; ++ xpad->odata[7] = 0x00; ++ xpad->odata[8] = 0x00; ++ xpad->odata[9] = 0x00; ++ xpad->odata[10] = 0x00; ++ xpad->odata[11] = 0x00; ++ xpad->irq_out->transfer_buffer_length = 12; ++ break; + } ++ ++ if (!xpad->irq_out_active) { ++ usb_submit_urb(xpad->irq_out, GFP_KERNEL); ++ xpad->irq_out_active = 1; ++ } else ++ dev_dbg(&xpad->dev->dev, "%s - dropped, irq_out is active\n", ++ __func__); ++ ++ mutex_unlock(&xpad->odata_mutex); ++} ++ ++/* ++ * Light up the segment corresponding to the pad number on Xbox 360 Controllers ++ */ ++static void xpad_identify_controller(struct usb_xpad *xpad) ++{ ++ if (xpad->xtype != XTYPE_XBOX360 && xpad->xtype != XTYPE_XBOX360W) ++ return; ++ ++ xpad->pad_nr = find_first_zero_bit(&xpad_pad_seq, 32); ++ set_bit(xpad->pad_nr, &xpad_pad_seq); ++ ++ xpad_send_led_command(xpad, (xpad->pad_nr % 4) + 2); + } + + static void xpad_led_set(struct led_classdev *led_cdev, +@@ -905,22 +988,18 @@ static void xpad_led_set(struct led_classdev *led_cdev, + + static int xpad_led_probe(struct usb_xpad *xpad) + { +- static atomic_t led_seq = ATOMIC_INIT(-1); +- unsigned long led_no; + struct xpad_led *led; + struct led_classdev *led_cdev; + int error; + +- if (xpad->xtype != XTYPE_XBOX360) ++ if (xpad->xtype != XTYPE_XBOX360 && xpad->xtype != XTYPE_XBOX360W) + return 0; + + xpad->led = led = kzalloc(sizeof(struct xpad_led), GFP_KERNEL); + if (!led) + return -ENOMEM; + +- led_no = atomic_inc_return(&led_seq); +- +- snprintf(led->name, sizeof(led->name), "xpad%lu", led_no); ++ snprintf(led->name, sizeof(led->name), "xpad%lu", xpad->pad_nr); + led->xpad = xpad; + + led_cdev = &led->led_cdev; +@@ -934,11 +1013,6 @@ static int xpad_led_probe(struct usb_xpad *xpad) + return error; + } + +- /* +- * Light up the segment corresponding to controller number +- */ +- xpad_send_led_command(xpad, (led_no % 4) + 2); +- + return 0; + } + +@@ -954,12 +1028,14 @@ static void xpad_led_disconnect(struct usb_xpad *xpad) + #else + static int xpad_led_probe(struct usb_xpad *xpad) { return 0; } + static void xpad_led_disconnect(struct usb_xpad *xpad) { } ++static void xpad_identify_controller(struct usb_xpad *xpad) { } + #endif + + + static int xpad_open(struct input_dev *dev) + { + struct usb_xpad *xpad = input_get_drvdata(dev); ++ int retval; + + /* URB was submitted in probe */ + if (xpad->xtype == XTYPE_XBOX360W) +@@ -970,11 +1046,17 @@ static int xpad_open(struct input_dev *dev) + return -EIO; + + if (xpad->xtype == XTYPE_XBOXONE) { ++ mutex_lock(&xpad->odata_mutex); + /* Xbox one controller needs to be initialized. */ + xpad->odata[0] = 0x05; + xpad->odata[1] = 0x20; +- xpad->irq_out->transfer_buffer_length = 2; +- return usb_submit_urb(xpad->irq_out, GFP_KERNEL); ++ xpad->odata[2] = xpad->odata_serial++; /* packet serial */ ++ xpad->odata[3] = 0x01; /* rumble bit enable? */ ++ xpad->odata[4] = 0x00; ++ xpad->irq_out->transfer_buffer_length = 5; ++ retval = usb_submit_urb(xpad->irq_out, GFP_KERNEL); ++ mutex_unlock(&xpad->odata_mutex); ++ return retval; + } + + return 0; +@@ -1016,11 +1098,103 @@ static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs) + } + } + ++static int xpad_init_input(struct usb_xpad *xpad) ++{ ++ struct input_dev *input_dev; ++ int i, error; ++ ++ input_dev = input_allocate_device(); ++ if (!input_dev) ++ return -ENOMEM; ++ ++ xpad->dev = input_dev; ++ input_dev->name = xpad->name; ++ input_dev->phys = xpad->phys; ++ usb_to_input_id(xpad->udev, &input_dev->id); ++ input_dev->dev.parent = &xpad->intf->dev; ++ ++ input_set_drvdata(input_dev, xpad); ++ ++ input_dev->open = xpad_open; ++ input_dev->close = xpad_close; ++ ++ input_dev->evbit[0] = BIT_MASK(EV_KEY); ++ ++ if (!(xpad->mapping & MAP_STICKS_TO_NULL)) { ++ input_dev->evbit[0] |= BIT_MASK(EV_ABS); ++ /* set up axes */ ++ for (i = 0; xpad_abs[i] >= 0; i++) ++ xpad_set_up_abs(input_dev, xpad_abs[i]); ++ } ++ ++ /* set up standard buttons */ ++ for (i = 0; xpad_common_btn[i] >= 0; i++) ++ __set_bit(xpad_common_btn[i], input_dev->keybit); ++ ++ /* set up model-specific ones */ ++ if (xpad->xtype == XTYPE_XBOX360 || xpad->xtype == XTYPE_XBOX360W || ++ xpad->xtype == XTYPE_XBOXONE) { ++ for (i = 0; xpad360_btn[i] >= 0; i++) ++ __set_bit(xpad360_btn[i], input_dev->keybit); ++ } else { ++ for (i = 0; xpad_btn[i] >= 0; i++) ++ __set_bit(xpad_btn[i], input_dev->keybit); ++ } ++ ++ if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { ++ for (i = 0; xpad_btn_pad[i] >= 0; i++) ++ __set_bit(xpad_btn_pad[i], input_dev->keybit); ++ } ++ /* this should be a simple else block. However historically xbox360w ++ * has mapped DPAD to buttons while xbox360 did not. ++ * This made no sense, but now we can not just switch back and have to ++ * support both behaviors. ++ */ ++ if(!(xpad->mapping & MAP_DPAD_TO_BUTTONS) || ++ xpad->xtype == XTYPE_XBOX360W) { ++ for (i = 0; xpad_abs_pad[i] >= 0; i++) ++ xpad_set_up_abs(input_dev, xpad_abs_pad[i]); ++ } ++ ++ if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) { ++ for (i = 0; xpad_btn_triggers[i] >= 0; i++) ++ __set_bit(xpad_btn_triggers[i], input_dev->keybit); ++ } else { ++ for (i = 0; xpad_abs_triggers[i] >= 0; i++) ++ xpad_set_up_abs(input_dev, xpad_abs_triggers[i]); ++ } ++ ++ xpad_identify_controller(xpad); ++ ++ error = xpad_init_ff(xpad); ++ if (error) ++ goto fail_init_ff; ++ ++ error = xpad_led_probe(xpad); ++ if (error) ++ goto fail_init_led; ++ ++ error = input_register_device(xpad->dev); ++ if (error) ++ goto fail_input_register; ++ ++ return 0; ++ ++fail_input_register: ++ xpad_led_disconnect(xpad); ++ ++fail_init_led: ++ input_ff_destroy(input_dev); ++ ++fail_init_ff: ++ input_free_device(input_dev); ++ return error; ++} ++ + static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id) + { + struct usb_device *udev = interface_to_usbdev(intf); + struct usb_xpad *xpad; +- struct input_dev *input_dev; + struct usb_endpoint_descriptor *ep_irq_in; + int ep_irq_in_idx; + int i, error; +@@ -1042,12 +1216,14 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id + } + + xpad = kzalloc(sizeof(struct usb_xpad), GFP_KERNEL); +- input_dev = input_allocate_device(); +- if (!xpad || !input_dev) { ++ if (!xpad) { + error = -ENOMEM; + goto fail1; + } + ++ usb_make_path(udev, xpad->phys, sizeof(xpad->phys)); ++ strlcat(xpad->phys, "/input0", sizeof(xpad->phys)); ++ + xpad->idata = usb_alloc_coherent(udev, XPAD_PKT_LEN, + GFP_KERNEL, &xpad->idata_dma); + if (!xpad->idata) { +@@ -1065,6 +1241,8 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id + xpad->intf = intf; + xpad->mapping = xpad_device[i].mapping; + xpad->xtype = xpad_device[i].xtype; ++ xpad->name = xpad_device[i].name; ++ INIT_WORK(&xpad->work, presence_work_function); + + if (xpad->xtype == XTYPE_UNKNOWN) { + if (intf->cur_altsetting->desc.bInterfaceClass == USB_CLASS_VENDOR_SPEC) { +@@ -1083,71 +1261,10 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id + xpad->mapping |= MAP_STICKS_TO_NULL; + } + +- xpad->dev = input_dev; +- usb_make_path(udev, xpad->phys, sizeof(xpad->phys)); +- strlcat(xpad->phys, "/input0", sizeof(xpad->phys)); +- +- input_dev->name = xpad_device[i].name; +- input_dev->phys = xpad->phys; +- usb_to_input_id(udev, &input_dev->id); +- input_dev->dev.parent = &intf->dev; +- +- input_set_drvdata(input_dev, xpad); +- +- input_dev->open = xpad_open; +- input_dev->close = xpad_close; +- +- input_dev->evbit[0] = BIT_MASK(EV_KEY); +- +- if (!(xpad->mapping & MAP_STICKS_TO_NULL)) { +- input_dev->evbit[0] |= BIT_MASK(EV_ABS); +- /* set up axes */ +- for (i = 0; xpad_abs[i] >= 0; i++) +- xpad_set_up_abs(input_dev, xpad_abs[i]); +- } +- +- /* set up standard buttons */ +- for (i = 0; xpad_common_btn[i] >= 0; i++) +- __set_bit(xpad_common_btn[i], input_dev->keybit); +- +- /* set up model-specific ones */ +- if (xpad->xtype == XTYPE_XBOX360 || xpad->xtype == XTYPE_XBOX360W || +- xpad->xtype == XTYPE_XBOXONE) { +- for (i = 0; xpad360_btn[i] >= 0; i++) +- __set_bit(xpad360_btn[i], input_dev->keybit); +- } else { +- for (i = 0; xpad_btn[i] >= 0; i++) +- __set_bit(xpad_btn[i], input_dev->keybit); +- } +- +- if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { +- for (i = 0; xpad_btn_pad[i] >= 0; i++) +- __set_bit(xpad_btn_pad[i], input_dev->keybit); +- } else { +- for (i = 0; xpad_abs_pad[i] >= 0; i++) +- xpad_set_up_abs(input_dev, xpad_abs_pad[i]); +- } +- +- if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) { +- for (i = 0; xpad_btn_triggers[i] >= 0; i++) +- __set_bit(xpad_btn_triggers[i], input_dev->keybit); +- } else { +- for (i = 0; xpad_abs_triggers[i] >= 0; i++) +- xpad_set_up_abs(input_dev, xpad_abs_triggers[i]); +- } +- + error = xpad_init_output(intf, xpad); + if (error) + goto fail3; + +- error = xpad_init_ff(xpad); +- if (error) +- goto fail4; +- +- error = xpad_led_probe(xpad); +- if (error) +- goto fail5; +- + /* Xbox One controller has in/out endpoints swapped. */ + ep_irq_in_idx = xpad->xtype == XTYPE_XBOXONE ? 1 : 0; + ep_irq_in = &intf->cur_altsetting->endpoint[ep_irq_in_idx].desc; +@@ -1159,60 +1276,10 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id + xpad->irq_in->transfer_dma = xpad->idata_dma; + xpad->irq_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; + +- error = input_register_device(xpad->dev); +- if (error) +- goto fail6; +- + usb_set_intfdata(intf, xpad); + + if (xpad->xtype == XTYPE_XBOX360W) { + /* +- * Setup the message to set the LEDs on the +- * controller when it shows up +- */ +- xpad->bulk_out = usb_alloc_urb(0, GFP_KERNEL); +- if (!xpad->bulk_out) { +- error = -ENOMEM; +- goto fail7; +- } +- +- xpad->bdata = kzalloc(XPAD_PKT_LEN, GFP_KERNEL); +- if (!xpad->bdata) { +- error = -ENOMEM; +- goto fail8; +- } +- +- xpad->bdata[2] = 0x08; +- switch (intf->cur_altsetting->desc.bInterfaceNumber) { +- case 0: +- xpad->bdata[3] = 0x42; +- break; +- case 2: +- xpad->bdata[3] = 0x43; +- break; +- case 4: +- xpad->bdata[3] = 0x44; +- break; +- case 6: +- xpad->bdata[3] = 0x45; +- } +- +- ep_irq_in = &intf->cur_altsetting->endpoint[1].desc; +- if (usb_endpoint_is_bulk_out(ep_irq_in)) { +- usb_fill_bulk_urb(xpad->bulk_out, udev, +- usb_sndbulkpipe(udev, +- ep_irq_in->bEndpointAddress), +- xpad->bdata, XPAD_PKT_LEN, +- xpad_bulk_out, xpad); +- } else { +- usb_fill_int_urb(xpad->bulk_out, udev, +- usb_sndintpipe(udev, +- ep_irq_in->bEndpointAddress), +- xpad->bdata, XPAD_PKT_LEN, +- xpad_bulk_out, xpad, 0); +- } +- +- /* + * Submit the int URB immediately rather than waiting for open + * because we get status messages from the device whether + * or not any controllers are attached. In fact, it's +@@ -1221,56 +1288,116 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id + */ + xpad->irq_in->dev = xpad->udev; + error = usb_submit_urb(xpad->irq_in, GFP_KERNEL); ++ if (error) { ++ usb_kill_urb(xpad->irq_in); ++ goto fail4; ++ } ++ ++ /* ++ * send presence packet ++ * This will force the controller to resend connection packets. ++ * This is useful in the case we activate the module after the ++ * adapter has been plugged in, as it won't automatically ++ * send us info about the controllers. ++ */ ++ mutex_lock(&xpad->odata_mutex); ++ xpad->odata[0] = 0x08; ++ xpad->odata[1] = 0x00; ++ xpad->odata[2] = 0x0F; ++ xpad->odata[3] = 0xC0; ++ xpad->odata[4] = 0x00; ++ xpad->odata[5] = 0x00; ++ xpad->odata[6] = 0x00; ++ xpad->odata[7] = 0x00; ++ xpad->odata[8] = 0x00; ++ xpad->odata[9] = 0x00; ++ xpad->odata[10] = 0x00; ++ xpad->odata[11] = 0x00; ++ xpad->irq_out->transfer_buffer_length = 12; ++ ++ if (!xpad->irq_out_active) { ++ usb_submit_urb(xpad->irq_out, GFP_KERNEL); ++ xpad->irq_out_active = 1; ++ } else ++ dev_dbg(&xpad->dev->dev, ++ "%s - dropped, irq_out is active\n", __func__); ++ ++ mutex_unlock(&xpad->odata_mutex); ++ } else { ++ xpad->pad_present = 1; ++ error = xpad_init_input(xpad); + if (error) +- goto fail9; ++ goto fail4; + } + + return 0; + +- fail9: kfree(xpad->bdata); +- fail8: usb_free_urb(xpad->bulk_out); +- fail7: input_unregister_device(input_dev); +- input_dev = NULL; +- fail6: xpad_led_disconnect(xpad); +- fail5: if (input_dev) +- input_ff_destroy(input_dev); + fail4: xpad_deinit_output(xpad); + fail3: usb_free_urb(xpad->irq_in); + fail2: usb_free_coherent(udev, XPAD_PKT_LEN, xpad->idata, xpad->idata_dma); +- fail1: input_free_device(input_dev); +- kfree(xpad); ++ fail1: kfree(xpad); + return error; + + } + +-static void xpad_disconnect(struct usb_interface *intf) ++static void xpad_deinit_input(struct usb_xpad *xpad) + { +- struct usb_xpad *xpad = usb_get_intfdata (intf); +- + xpad_led_disconnect(xpad); + input_unregister_device(xpad->dev); +- xpad_deinit_output(xpad); ++ ++ if (xpad->xtype != XTYPE_XBOX360 && xpad->xtype != XTYPE_XBOX360W) ++ return; ++ ++ clear_bit(xpad->pad_nr, &xpad_pad_seq); ++} ++ ++static void xpad_stop_communication(struct usb_xpad *xpad) { ++ xpad_stop_output(xpad); + + if (xpad->xtype == XTYPE_XBOX360W) { +- usb_kill_urb(xpad->bulk_out); +- usb_free_urb(xpad->bulk_out); + usb_kill_urb(xpad->irq_in); + } + ++ cancel_work_sync(&xpad->work); ++} ++ ++static void xpad_disconnect(struct usb_interface *intf) ++{ ++ struct usb_xpad *xpad = usb_get_intfdata (intf); ++ ++ if (xpad->pad_present) ++ xpad_deinit_input(xpad); ++ ++ xpad_stop_communication(xpad); ++ ++ xpad_deinit_output(xpad); ++ + usb_free_urb(xpad->irq_in); + usb_free_coherent(xpad->udev, XPAD_PKT_LEN, + xpad->idata, xpad->idata_dma); + +- kfree(xpad->bdata); + kfree(xpad); + + usb_set_intfdata(intf, NULL); + } + ++static int xpad_suspend(struct usb_interface *intf, pm_message_t message) { ++ struct usb_xpad *xpad = usb_get_intfdata (intf); ++ xpad_stop_communication(xpad); ++ return 0; ++} ++ ++static int xpad_resume(struct usb_interface *intf) { ++ usb_queue_reset_device(intf); ++ return 0; ++} ++ + static struct usb_driver xpad_driver = { + .name = "xpad", + .probe = xpad_probe, + .disconnect = xpad_disconnect, ++ .suspend = xpad_suspend, ++ .resume = xpad_resume, + .id_table = xpad_table, + }; + +-- +1.9.1 + diff --git a/packages/linux/patches/4.1.2/linux-203-stb0899_enable_low_symbol_rate.patch b/packages/linux/patches/4.1.6/linux-203-stb0899_enable_low_symbol_rate.patch similarity index 100% rename from packages/linux/patches/4.1.2/linux-203-stb0899_enable_low_symbol_rate.patch rename to packages/linux/patches/4.1.6/linux-203-stb0899_enable_low_symbol_rate.patch diff --git a/packages/linux/patches/4.1.2/linux-212-mantis_stb0899_faster_lock.patch b/packages/linux/patches/4.1.6/linux-212-mantis_stb0899_faster_lock.patch similarity index 100% rename from packages/linux/patches/4.1.2/linux-212-mantis_stb0899_faster_lock.patch rename to packages/linux/patches/4.1.6/linux-212-mantis_stb0899_faster_lock.patch diff --git a/packages/linux/patches/4.1.2/linux-221-ngene-octopus.patch b/packages/linux/patches/4.1.6/linux-221-ngene-octopus.patch similarity index 100% rename from packages/linux/patches/4.1.2/linux-221-ngene-octopus.patch rename to packages/linux/patches/4.1.6/linux-221-ngene-octopus.patch diff --git a/packages/linux/patches/4.1.2/linux-222-stb0899_signal_quality.patch b/packages/linux/patches/4.1.6/linux-222-stb0899_signal_quality.patch similarity index 100% rename from packages/linux/patches/4.1.2/linux-222-stb0899_signal_quality.patch rename to packages/linux/patches/4.1.6/linux-222-stb0899_signal_quality.patch diff --git a/packages/linux/patches/4.1.2/linux-223-Fix-video-artifacts-with-tt-3600-s2-usb.patch b/packages/linux/patches/4.1.6/linux-223-Fix-video-artifacts-with-tt-3600-s2-usb.patch similarity index 100% rename from packages/linux/patches/4.1.2/linux-223-Fix-video-artifacts-with-tt-3600-s2-usb.patch rename to packages/linux/patches/4.1.6/linux-223-Fix-video-artifacts-with-tt-3600-s2-usb.patch diff --git a/packages/linux/patches/4.1.2/linux-224-STK1160-addFramescaling.patch b/packages/linux/patches/4.1.6/linux-224-STK1160-addFramescaling.patch similarity index 100% rename from packages/linux/patches/4.1.2/linux-224-STK1160-addFramescaling.patch rename to packages/linux/patches/4.1.6/linux-224-STK1160-addFramescaling.patch diff --git a/packages/linux/patches/4.1.2/linux-227-ds3000-invalid-symbol-rate.patch b/packages/linux/patches/4.1.6/linux-227-ds3000-invalid-symbol-rate.patch similarity index 100% rename from packages/linux/patches/4.1.2/linux-227-ds3000-invalid-symbol-rate.patch rename to packages/linux/patches/4.1.6/linux-227-ds3000-invalid-symbol-rate.patch diff --git a/packages/linux/patches/4.1.2/linux-228-fix-tt-s2-4600.patch b/packages/linux/patches/4.1.6/linux-228-fix-tt-s2-4600.patch similarity index 100% rename from packages/linux/patches/4.1.2/linux-228-fix-tt-s2-4600.patch rename to packages/linux/patches/4.1.6/linux-228-fix-tt-s2-4600.patch diff --git a/packages/linux/patches/4.1.2/linux-229-hauppauge-hvr-2205-and-2255.patch b/packages/linux/patches/4.1.6/linux-229-hauppauge-hvr-2205-and-2255.patch similarity index 92% rename from packages/linux/patches/4.1.2/linux-229-hauppauge-hvr-2205-and-2255.patch rename to packages/linux/patches/4.1.6/linux-229-hauppauge-hvr-2205-and-2255.patch index f625401e07..eff856b98f 100644 --- a/packages/linux/patches/4.1.2/linux-229-hauppauge-hvr-2205-and-2255.patch +++ b/packages/linux/patches/4.1.6/linux-229-hauppauge-hvr-2205-and-2255.patch @@ -134,7 +134,7 @@ diff -urN a/drivers/media/pci/saa7164/saa7164-cards.c b/drivers/media/pci/saa716 + .name = "SI2168-1", + .i2c_bus_nr = SAA7164_I2C_BUS_2, + .i2c_bus_addr = 0xc8 >> 1, -+ .i2c_reg_len = REGLEN_8bit, ++ .i2c_reg_len = REGLEN_0bit, + }, { + .id = 0x25, + .type = SAA7164_UNIT_TUNER, @@ -148,7 +148,7 @@ diff -urN a/drivers/media/pci/saa7164/saa7164-cards.c b/drivers/media/pci/saa716 + .name = "SI2168-2", + .i2c_bus_nr = SAA7164_I2C_BUS_2, + .i2c_bus_addr = 0xcc >> 1, -+ .i2c_reg_len = REGLEN_8bit, ++ .i2c_reg_len = REGLEN_0bit, + } }, + }, }; @@ -540,29 +540,6 @@ diff -urN a/drivers/media/pci/saa7164/saa7164-dvb.c b/drivers/media/pci/saa7164/ + return -1; } -diff -urN a/drivers/media/pci/saa7164/saa7164-encoder.c b/drivers/media/pci/saa7164/saa7164-encoder.c ---- a/drivers/media/pci/saa7164/saa7164-encoder.c 2015-06-22 08:05:43.000000000 +0300 -+++ b/drivers/media/pci/saa7164/saa7164-encoder.c 2015-06-24 18:41:23.254376349 +0300 -@@ -721,13 +721,14 @@ - sizeof(cap->card)); - sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci)); - -- cap->capabilities = -+ cap->device_caps = - V4L2_CAP_VIDEO_CAPTURE | -- V4L2_CAP_READWRITE | -- 0; -+ V4L2_CAP_READWRITE | -+ V4L2_CAP_TUNER; - -- cap->capabilities |= V4L2_CAP_TUNER; -- cap->version = 0; -+ cap->capabilities = cap->device_caps | -+ V4L2_CAP_VBI_CAPTURE | -+ V4L2_CAP_DEVICE_CAPS; - - return 0; - } diff -urN a/drivers/media/pci/saa7164/saa7164.h b/drivers/media/pci/saa7164/saa7164.h --- a/drivers/media/pci/saa7164/saa7164.h 2015-06-22 08:05:43.000000000 +0300 +++ b/drivers/media/pci/saa7164/saa7164.h 2015-06-24 18:41:57.246377117 +0300 @@ -593,26 +570,21 @@ diff -urN a/drivers/media/pci/saa7164/saa7164.h b/drivers/media/pci/saa7164/saa7 struct cmd cmds[SAA_CMD_MAX_MSG_UNITS]; struct mutex lock; -diff -urN a/drivers/media/pci/saa7164/saa7164-vbi.c b/drivers/media/pci/saa7164/saa7164-vbi.c ---- a/drivers/media/pci/saa7164/saa7164-vbi.c 2015-06-22 08:05:43.000000000 +0300 -+++ b/drivers/media/pci/saa7164/saa7164-vbi.c 2015-06-24 18:42:05.582377305 +0300 -@@ -660,13 +660,14 @@ - sizeof(cap->card)); - sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci)); - -- cap->capabilities = -+ cap->device_caps = - V4L2_CAP_VBI_CAPTURE | -- V4L2_CAP_READWRITE | -- 0; -+ V4L2_CAP_READWRITE | -+ V4L2_CAP_TUNER; - -- cap->capabilities |= V4L2_CAP_TUNER; -- cap->version = 0; -+ cap->capabilities = cap->device_caps | -+ V4L2_CAP_VIDEO_CAPTURE | -+ V4L2_CAP_DEVICE_CAPS; - - return 0; - } +diff -urN a/drivers/media/pci/saa7164/saa7164-i2c.c b/drivers/media/pci/saa7164/saa7164-i2c.c +--- a/drivers/media/pci/saa7164/saa7164-i2c.c ++++ b/drivers/media/pci/saa7164/saa7164-i2c.c +@@ -39,9 +39,10 @@ static int i2c_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, int num) + dprintk(DBGLVL_I2C, "%s(num = %d) addr = 0x%02x len = 0x%x\n", + __func__, num, msgs[i].addr, msgs[i].len); + if (msgs[i].flags & I2C_M_RD) { +- /* Unsupported - Yet*/ +- printk(KERN_ERR "%s() Unsupported - Yet\n", __func__); +- continue; ++ retval = saa7164_api_i2c_read(bus, ++ msgs[i].addr, ++ 0 /* reglen */, ++ NULL /* reg */, msgs[i].len, msgs[i].buf); + } else if (i + 1 < num && (msgs[i + 1].flags & I2C_M_RD) && + msgs[i].addr == msgs[i + 1].addr) { + /* write then read from same address */ + diff --git a/packages/linux/patches/4.1.2/linux-706-Sitecom-N300.patch b/packages/linux/patches/4.1.6/linux-706-Sitecom-N300.patch similarity index 100% rename from packages/linux/patches/4.1.2/linux-706-Sitecom-N300.patch rename to packages/linux/patches/4.1.6/linux-706-Sitecom-N300.patch diff --git a/packages/linux/patches/4.1.2/linux-950-saa716x_PCIe_interface_chipset.patch b/packages/linux/patches/4.1.6/linux-950-saa716x_PCIe_interface_chipset.patch similarity index 100% rename from packages/linux/patches/4.1.2/linux-950-saa716x_PCIe_interface_chipset.patch rename to packages/linux/patches/4.1.6/linux-950-saa716x_PCIe_interface_chipset.patch diff --git a/packages/linux/patches/4.1.2/linux-990.06-hda-Avoid-outputting-HDMI-audio-before-prepare-.patch b/packages/linux/patches/4.1.6/linux-990.06-hda-Avoid-outputting-HDMI-audio-before-prepare-.patch similarity index 100% rename from packages/linux/patches/4.1.2/linux-990.06-hda-Avoid-outputting-HDMI-audio-before-prepare-.patch rename to packages/linux/patches/4.1.6/linux-990.06-hda-Avoid-outputting-HDMI-audio-before-prepare-.patch diff --git a/packages/linux/patches/4.1.2/linux-995-CX24120-13Z_frontend.patch b/packages/linux/patches/4.1.6/linux-995-CX24120-13Z_frontend.patch similarity index 100% rename from packages/linux/patches/4.1.2/linux-995-CX24120-13Z_frontend.patch rename to packages/linux/patches/4.1.6/linux-995-CX24120-13Z_frontend.patch diff --git a/packages/linux/patches/4.1.2/linux-999-i915-use-legacy-turbo.patch b/packages/linux/patches/4.1.6/linux-999-i915-use-legacy-turbo.patch similarity index 100% rename from packages/linux/patches/4.1.2/linux-999-i915-use-legacy-turbo.patch rename to packages/linux/patches/4.1.6/linux-999-i915-use-legacy-turbo.patch diff --git a/packages/linux/patches/4.1.2/linux-999.02-0001-pm-disable-async-suspend-resume-by-default.patch b/packages/linux/patches/4.1.6/linux-999.02-0001-pm-disable-async-suspend-resume-by-default.patch similarity index 100% rename from packages/linux/patches/4.1.2/linux-999.02-0001-pm-disable-async-suspend-resume-by-default.patch rename to packages/linux/patches/4.1.6/linux-999.02-0001-pm-disable-async-suspend-resume-by-default.patch diff --git a/packages/linux/patches/4.1.2/linux-999.05-eMMC-Don-t-initialize-partitions-on-RPMB-flagged-are.patch b/packages/linux/patches/4.1.6/linux-999.05-eMMC-Don-t-initialize-partitions-on-RPMB-flagged-are.patch similarity index 100% rename from packages/linux/patches/4.1.2/linux-999.05-eMMC-Don-t-initialize-partitions-on-RPMB-flagged-are.patch rename to packages/linux/patches/4.1.6/linux-999.05-eMMC-Don-t-initialize-partitions-on-RPMB-flagged-are.patch diff --git a/packages/mediacenter/kodi-binary-addons/pvr.argustv/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.argustv/package.mk index c7a46c9b95..13c12ce71f 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.argustv/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.argustv/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="pvr.argustv" -PKG_VERSION="3e2350c" +PKG_VERSION="96c8026" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/mediacenter/kodi-binary-addons/pvr.demo/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.demo/package.mk index c76266d7e3..fedbf88ace 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.demo/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.demo/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="pvr.demo" -PKG_VERSION="92cea88" +PKG_VERSION="3b2cd18" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/mediacenter/kodi-binary-addons/pvr.dvblink/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.dvblink/package.mk index e0a523e7cf..57e7fa867c 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.dvblink/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.dvblink/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="pvr.dvblink" -PKG_VERSION="bf96fc7" +PKG_VERSION="cf756e9" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/mediacenter/kodi-binary-addons/pvr.dvbviewer/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.dvbviewer/package.mk index af84229f16..f8cdfdbca4 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.dvbviewer/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.dvbviewer/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="pvr.dvbviewer" -PKG_VERSION="ecf820e" +PKG_VERSION="cbfd455" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/mediacenter/kodi-binary-addons/pvr.filmon/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.filmon/package.mk index 06fe751531..33cd08b93f 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.filmon/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.filmon/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="pvr.filmon" -PKG_VERSION="dab922f" +PKG_VERSION="5c41f4e" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/mediacenter/kodi-binary-addons/pvr.hts/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.hts/package.mk index d3be582662..ba7b546639 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.hts/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.hts/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="pvr.hts" -PKG_VERSION="d46b745" +PKG_VERSION="5c22440" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/mediacenter/kodi-binary-addons/pvr.iptvsimple/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.iptvsimple/package.mk index 99c88e4cd4..e31b410191 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.iptvsimple/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.iptvsimple/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="pvr.iptvsimple" -PKG_VERSION="0e05337" +PKG_VERSION="23defeb" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/mediacenter/kodi-binary-addons/pvr.mediaportal.tvserver/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.mediaportal.tvserver/package.mk index 958046799e..82a3c48503 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.mediaportal.tvserver/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.mediaportal.tvserver/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="pvr.mediaportal.tvserver" -PKG_VERSION="9cf9f36" +PKG_VERSION="29809d1" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/mediacenter/kodi-binary-addons/pvr.mythtv/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.mythtv/package.mk index 769e799b5c..4ed283da69 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.mythtv/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.mythtv/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="pvr.mythtv" -PKG_VERSION="30d4e6f" +PKG_VERSION="538e24d" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/mediacenter/kodi-binary-addons/pvr.nextpvr/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.nextpvr/package.mk index 5bc4e6820e..a158b2aee0 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.nextpvr/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.nextpvr/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="pvr.nextpvr" -PKG_VERSION="8d7b706" +PKG_VERSION="3a205e4" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/mediacenter/kodi-binary-addons/pvr.njoy/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.njoy/package.mk index 2a971fc28b..5aff3a3b96 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.njoy/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.njoy/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="pvr.njoy" -PKG_VERSION="e7f9458" +PKG_VERSION="4f88a09" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/mediacenter/kodi-binary-addons/pvr.pctv/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.pctv/package.mk index 4e6c49abe0..6ba5324d50 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.pctv/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.pctv/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="pvr.pctv" -PKG_VERSION="0a6b235" +PKG_VERSION="d23160c" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/mediacenter/kodi-binary-addons/pvr.stalker/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.stalker/package.mk index e153539806..979a9b7cff 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.stalker/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.stalker/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="pvr.stalker" -PKG_VERSION="c9f2ac3" +PKG_VERSION="5f6eb19" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/mediacenter/kodi-binary-addons/pvr.vbox/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.vbox/package.mk index 9c318daddb..94d1308ef7 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.vbox/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.vbox/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="pvr.vbox" -PKG_VERSION="387c70a" +PKG_VERSION="874eb88" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/mediacenter/kodi-binary-addons/pvr.vdr.vnsi/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.vdr.vnsi/package.mk index ed0dd3cdd4..d8aeb81f50 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.vdr.vnsi/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.vdr.vnsi/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="pvr.vdr.vnsi" -PKG_VERSION="c361ac4" +PKG_VERSION="550a4a2" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/mediacenter/kodi-binary-addons/pvr.vuplus/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.vuplus/package.mk index 5fd56a69b5..902c4682ee 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.vuplus/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.vuplus/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="pvr.vuplus" -PKG_VERSION="f7dfd47" +PKG_VERSION="96115e9" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/mediacenter/kodi-binary-addons/pvr.wmc/package.mk b/packages/mediacenter/kodi-binary-addons/pvr.wmc/package.mk index 48c91e7b41..8d67f8b74d 100644 --- a/packages/mediacenter/kodi-binary-addons/pvr.wmc/package.mk +++ b/packages/mediacenter/kodi-binary-addons/pvr.wmc/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="pvr.wmc" -PKG_VERSION="162053c" +PKG_VERSION="e19c3e9" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/mediacenter/kodi-theme-Confluence/package.mk b/packages/mediacenter/kodi-theme-Confluence/package.mk index f4827e5a91..c5d61e2ae3 100644 --- a/packages/mediacenter/kodi-theme-Confluence/package.mk +++ b/packages/mediacenter/kodi-theme-Confluence/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="kodi-theme-Confluence" -PKG_VERSION="15.0-rc2-0aa930b" +PKG_VERSION="15.1-f4dda26" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/mediacenter/kodi/config/appliance.xml b/packages/mediacenter/kodi/config/appliance.xml index d002421bff..4111c93b1e 100644 --- a/packages/mediacenter/kodi/config/appliance.xml +++ b/packages/mediacenter/kodi/config/appliance.xml @@ -37,26 +37,26 @@
- + - + true - + true - + false - + /usr/bin/setwakeup.sh diff --git a/packages/mediacenter/kodi/package.mk b/packages/mediacenter/kodi/package.mk index 7b051c4fb3..ccbeeda321 100644 --- a/packages/mediacenter/kodi/package.mk +++ b/packages/mediacenter/kodi/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="kodi" -PKG_VERSION="15.0-rc2-0aa930b" +PKG_VERSION="15.1-f4dda26" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/mediacenter/kodi/patches/kodi-995.10-devinputmappings.patch b/packages/mediacenter/kodi/patches/kodi-995.10-devinputmappings.patch new file mode 100644 index 0000000000..e553b6fd10 --- /dev/null +++ b/packages/mediacenter/kodi/patches/kodi-995.10-devinputmappings.patch @@ -0,0 +1,106 @@ +diff -Naur kodi-15.0-2f34a0c/system/Lircmap.xml kodi-15.0-2f34a0c.patch/system/Lircmap.xml +--- kodi-15.0-2f34a0c/system/Lircmap.xml 2015-07-22 10:07:05.000000000 +0200 ++++ kodi-15.0-2f34a0c.patch/system/Lircmap.xml 2015-07-28 10:47:41.202213181 +0200 +@@ -493,6 +493,7 @@ + KEY_TEXT + KEY_DELETE + ++ + + pause + stop +@@ -544,50 +545,93 @@ + KEY_UP + KEY_DOWN + +- KEY_ENTER ++ ++ ++ + KEY_DELETE ++ KEY_ESC + KEY_MEDIA ++ KEY_HOME + KEY_EXIT ++ KEY_BACK ++ KEY_BACKSPACE ++ KEY_ESC ++ KEY_E + KEY_RECORD + KEY_PLAY ++ KEY_PLAYPAUSE + KEY_PAUSE + KEY_STOP ++ KEY_STOPCD + KEY_FASTFORWARD ++ KEY_FFORWARD ++ KEY_FORWARD + KEY_REWIND + KEY_VOLUMEUP ++ KEY_VOLUP + KEY_VOLUMEDOWN ++ KEY_VOLDOWN + KEY_CHANNELUP ++ KEY_CHUP ++ KEY_PAGEUP + KEY_CHANNELDOWN ++ KEY_CHDOWN ++ KEY_PAGEDOWN + KEY_NEXT ++ KEY_NEXTSONG + KEY_PREVIOUS ++ KEY_PREVIOUSSONG + KEY_EPG ++ KEY_TV2 ++ KEY_CONTEXT_MENU + KEY_SUBTITLE ++ KEY_TITLE + KEY_LANGUAGE + KEY_INFO ++ KEY_PROPS + KEY_ZOOM ++ KEY_ANGLE + KEY_MUTE + KEY_POWER ++ KEY_SLEEP ++ KEY_WAKEUP + KEY_EJECTCD + KEY_EJECTCLOSECD + KEY_DVD + KEY_MENU + KEY_VIDEO + KEY_AUDIO ++ KEY_MP3 + KEY_CAMERA ++ KEY_IMAGES + KEY_TUNER + KEY_TV ++ KEY_PVR + KEY_TEXT ++ KEY_1 + KEY_NUMERIC_1 ++ KEY_2 + KEY_NUMERIC_2 ++ KEY_3 + KEY_NUMERIC_3 ++ KEY_4 + KEY_NUMERIC_4 ++ KEY_5 + KEY_NUMERIC_5 ++ KEY_6 + KEY_NUMERIC_6 ++ KEY_7 + KEY_NUMERIC_7 ++ KEY_8 + KEY_NUMERIC_8 ++ KEY_9 + KEY_NUMERIC_9 ++ KEY_0 + KEY_NUMERIC_0 ++ KEY_STAR ++ KEY_KPASTERISK + KEY_NUMERIC_STAR ++ KEY_POUND + KEY_NUMERIC_POUND + KEY_RED + KEY_GREEN diff --git a/packages/mediacenter/kodi/patches/kodi-995.11-keyboard.xml_record_mappings.patch b/packages/mediacenter/kodi/patches/kodi-995.11-keyboard.xml_record_mappings.patch new file mode 100644 index 0000000000..3727e85ff6 --- /dev/null +++ b/packages/mediacenter/kodi/patches/kodi-995.11-keyboard.xml_record_mappings.patch @@ -0,0 +1,27 @@ +diff -Naur kodi-15.0-2f34a0c/system/keymaps/keyboard.xml kodi-15.0-2f34a0c.patch/system/keymaps/keyboard.xml +--- kodi-15.0-2f34a0c/system/keymaps/keyboard.xml 2015-07-22 10:07:05.000000000 +0200 ++++ kodi-15.0-2f34a0c.patch/system/keymaps/keyboard.xml 2015-07-30 21:05:38.691232224 +0200 +@@ -139,6 +139,8 @@ + SkipNext + SkipPrevious + Info ++ Record ++ PreviousMenu + VolumeUp + VolumeDown + Mute +diff -Naur kodi-15.0-2f34a0c/system/keymaps/mouse.xml kodi-15.0-2f34a0c.patch/system/keymaps/mouse.xml +--- kodi-15.0-2f34a0c/system/keymaps/mouse.xml 2015-07-22 10:07:05.000000000 +0200 ++++ kodi-15.0-2f34a0c.patch/system/keymaps/mouse.xml 2015-07-30 20:37:26.697642374 +0200 +@@ -29,4 +29,11 @@ + NextPicture + + ++ ++ ++ Info ++ ++ ++ ++ + diff --git a/packages/mediacenter/kodi/patches/kodi-999.99-buildfix.patch b/packages/mediacenter/kodi/patches/kodi-999.99-buildfix.patch deleted file mode 100644 index b0cb92442d..0000000000 --- a/packages/mediacenter/kodi/patches/kodi-999.99-buildfix.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -Naur kodi-15.0-rc1-9ff25f8/configure.ac kodi-15.0-rc1-9ff25f8.patch/configure.ac ---- kodi-15.0-rc1-9ff25f8/configure.ac 2015-07-02 23:35:21.000000000 +0200 -+++ kodi-15.0-rc1-9ff25f8.patch/configure.ac 2015-07-04 08:15:52.284856500 +0200 -@@ -1051,7 +1051,7 @@ - AC_DEFINE([HAVE_LIBEGL],[1],["Define to 1 if you have the `EGL' library (-lEGL)."]) - AC_DEFINE([HAVE_LIBGLESV2],[1],["Define to 1 if you have the `GLESv2' library (-lGLESv2)."]) - AC_MSG_RESULT(== WARNING: OpenGLES support is assumed.) -- LIBS="$LIBS -lEGL -lGLESv2 -lbcm_host -lvcos -lvchiq_arm -lmmal -lmmal_core -lmmal_util" -+ LIBS="$LIBS -lEGL -lGLESv2 -lbcm_host -lvcos -lvchiq_arm -lmmal -lmmal_core -lmmal_util -lvcsm" - else - AC_CHECK_LIB([EGL], [main],, AC_MSG_ERROR($missing_library)) - AC_CHECK_LIB([GLESv2],[main],, AC_MSG_ERROR($missing_library)) diff --git a/packages/multimedia/ffmpeg/package.mk b/packages/multimedia/ffmpeg/package.mk index 526e632552..511c777736 100644 --- a/packages/multimedia/ffmpeg/package.mk +++ b/packages/multimedia/ffmpeg/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="ffmpeg" -PKG_VERSION="2.6.3" +PKG_VERSION="2.6.4" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="LGPL" diff --git a/packages/network/connman/package.mk b/packages/network/connman/package.mk index b22d0825b6..57866d6fea 100644 --- a/packages/network/connman/package.mk +++ b/packages/network/connman/package.mk @@ -92,7 +92,8 @@ post_makeinstall_target() { -e "s|^# PreferredTechnologies.*|PreferredTechnologies = ethernet,wifi,cellular|g" \ -e "s|^# TetheringTechnologies.*|TetheringTechnologies = wifi|g" \ -e "s|^# AllowHostnameUpdates.*|AllowHostnameUpdates = false|g" \ - -e "s|^# PersistentTetheringMode.*|PersistentTetheringMode = true|g" + -e "s|^# PersistentTetheringMode.*|PersistentTetheringMode = true|g" \ + -e "s|^# NetworkInterfaceBlacklist = vmnet,vboxnet,virbr,ifb|NetworkInterfaceBlacklist = vmnet,vboxnet,virbr,ifb,docker,veth|g" mkdir -p $INSTALL/usr/config cp $PKG_DIR/config/hosts.conf $INSTALL/usr/config diff --git a/packages/network/connman/system.d/connman.service b/packages/network/connman/system.d/connman.service index cdb5d8535d..ccca00e77c 100644 --- a/packages/network/connman/system.d/connman.service +++ b/packages/network/connman/system.d/connman.service @@ -10,6 +10,7 @@ Type=dbus BusName=net.connman Restart=on-failure EnvironmentFile=-/run/openelec/debug/connman.conf +ExecStartPre=-/bin/sh -c "echo -e 'nameserver 8.8.8.8\nnameserver 8.8.4.4' > /etc/resolv.conf" ExecStartPre=-/bin/sh -c "cat /storage/.cache/hostname > /proc/sys/kernel/hostname" ExecStartPre=-/bin/sh -c "cat /storage/.config/hosts.conf > /etc/hosts" ExecStartPre=/sbin/ifconfig lo 127.0.0.1 netmask 255.0.0.0 up diff --git a/packages/network/libtirpc/package.mk b/packages/network/libtirpc/package.mk index cb571c9089..0af7c6ac0f 100644 --- a/packages/network/libtirpc/package.mk +++ b/packages/network/libtirpc/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="libtirpc" -PKG_VERSION="0.2.5" +PKG_VERSION="0.3.2" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/network/libtirpc/patches/libtirpc-0.3.2-api_fixes-1.patch b/packages/network/libtirpc/patches/libtirpc-0.3.2-api_fixes-1.patch new file mode 100644 index 0000000000..059c2bfd0b --- /dev/null +++ b/packages/network/libtirpc/patches/libtirpc-0.3.2-api_fixes-1.patch @@ -0,0 +1,95 @@ +Submitted By: Douglas R. Reno +Date: 2015-06-24 +Initial Package Version: 0.3.2 +Origin: BLFS Ticket #6616, Armin K. +Upstream Status: Applied +Description: Restore some old API functions that were taken out. Thanks goes to Armin K. for the patch. + +diff -Naur a/src/Makefile.am b/src/Makefile.am +--- a/src/Makefile.am 2015-06-16 17:35:08.000000000 +0200 ++++ b/src/Makefile.am 2015-06-17 21:23:05.185276962 +0200 +@@ -69,7 +69,7 @@ + endif + + libtirpc_la_SOURCES += key_call.c key_prot_xdr.c getpublickey.c +-libtirpc_la_SOURCES += netname.c netnamer.c rtime.c ++libtirpc_la_SOURCES += netname.c netnamer.c rpcdname.c rtime.c + + CLEANFILES = cscope.* *~ + DISTCLEANFILES = Makefile.in +diff -Naur a/src/rpcdname.c b/src/rpcdname.c +--- a/src/rpcdname.c 1970-01-01 01:00:00.000000000 +0100 ++++ b/src/rpcdname.c 2015-06-17 21:23:05.186276982 +0200 +@@ -0,0 +1,72 @@ ++/* ++ * Copyright (c) 2009, Sun Microsystems, Inc. ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions are met: ++ * - Redistributions of source code must retain the above copyright notice, ++ * this list of conditions and the following disclaimer. ++ * - Redistributions in binary form must reproduce the above copyright notice, ++ * this list of conditions and the following disclaimer in the documentation ++ * and/or other materials provided with the distribution. ++ * - Neither the name of Sun Microsystems, Inc. nor the names of its ++ * contributors may be used to endorse or promote products derived ++ * from this software without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE ++ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ++ * POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++/* ++ * rpcdname.c ++ * Gets the default domain name ++ */ ++ ++#include ++#include ++#include ++ ++static char *default_domain = 0; ++ ++static char * ++get_default_domain() ++{ ++ char temp[256]; ++ ++ if (default_domain) ++ return (default_domain); ++ if (getdomainname(temp, sizeof(temp)) < 0) ++ return (0); ++ if ((int) strlen(temp) > 0) { ++ default_domain = (char *)malloc((strlen(temp)+(unsigned)1)); ++ if (default_domain == 0) ++ return (0); ++ (void) strcpy(default_domain, temp); ++ return (default_domain); ++ } ++ return (0); ++} ++ ++/* ++ * This is a wrapper for the system call getdomainname which returns a ++ * ypclnt.h error code in the failure case. It also checks to see that ++ * the domain name is non-null, knowing that the null string is going to ++ * get rejected elsewhere in the NIS client package. ++ */ ++int ++__rpc_get_default_domain(domain) ++ char **domain; ++{ ++ if ((*domain = get_default_domain()) != 0) ++ return (0); ++ return (-1); ++} diff --git a/packages/network/openssh/package.mk b/packages/network/openssh/package.mk index 15fdb36cfe..bc262e4945 100644 --- a/packages/network/openssh/package.mk +++ b/packages/network/openssh/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="openssh" -PKG_VERSION="6.9p1" +PKG_VERSION="7.0p1" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="OSS" diff --git a/packages/network/wireless-regdb/package.mk b/packages/network/wireless-regdb/package.mk index 0ed407019c..2da5740bce 100644 --- a/packages/network/wireless-regdb/package.mk +++ b/packages/network/wireless-regdb/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="wireless-regdb" -PKG_VERSION="2015.06.05" +PKG_VERSION="2015.07.20" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/sysutils/eventlircd/evmap/03_03eb_0002.evmap b/packages/sysutils/eventlircd/evmap/03_03eb_0002.evmap index 13ab6ebb26..6da7459e54 100644 --- a/packages/sysutils/eventlircd/evmap/03_03eb_0002.evmap +++ b/packages/sysutils/eventlircd/evmap/03_03eb_0002.evmap @@ -1,39 +1,8 @@ -KEY_0 = KEY_NUMERIC_0 # 0 -KEY_1 = KEY_NUMERIC_1 # 1 -KEY_2 = KEY_NUMERIC_2 # 2 -KEY_3 = KEY_NUMERIC_3 # 3 -KEY_4 = KEY_NUMERIC_4 # 4 -KEY_5 = KEY_NUMERIC_5 # 5 -KEY_6 = KEY_NUMERIC_6 # 6 -KEY_7 = KEY_NUMERIC_7 # 7 -KEY_8 = KEY_NUMERIC_8 # 8 -KEY_9 = KEY_NUMERIC_9 # 9 -KEY_MUTE = KEY_MUTE # Mute -KEY_PAUSE = KEY_PAUSE # Pause -KEY_INFO = KEY_INFO # Info KEY_VOLDOWN = KEY_VOLUMEDOWN # Volume Down KEY_VOLUP = KEY_VOLUMEUP # Volume Up KEY_CHDOWN = KEY_CHANNELDOWN # Channel Down KEY_CHUP = KEY_CHANNELUP # Channel Up -KEY_FORWARD = KEY_FORWARD # Forward -KEY_PLAY = KEY_PLAY -KEY_CLEAR = KEY_CLEAR # Clear -KEY_BACK = KEY_BACK # BACK/Clear -KEY_UP = KEY_UP # Up -KEY_DOWN = KEY_DOWN # Direction Down -KEY_MENU = KEY_MENU # Menu -KEY_EXIT = KEY_EXIT # Back/Exit -KEY_LEFT = KEY_LEFT # Direction Left -KEY_RIGHT = KEY_RIGHT # Right Arrow -KEY_OK = KEY_OK # Direction OK (also used for Enter) -KEY_ENTER = KEY_ENTER # Enter (also used for Direction OK) -KEY_STOP = KEY_STOP # Stop +KEY_OK = KEY_ENTER # Direction OK (also used for Enter) KEY_FFORWARD = KEY_FASTFORWARD # Forward -KEY_REWIND = KEY_REWIND # Rewind -KEY_RED = KEY_RED # Red -KEY_GREEN = KEY_GREEN # Green -KEY_YELLOW = KEY_YELLOW # Yellow -KEY_BLUE = KEY_BLUE # Blue KEY_GUIDE = KEY_EPG # EPG -KEY_RECORD = KEY_RECORD # Record diff --git a/packages/sysutils/eventlircd/evmap/03_0419_0001.evmap b/packages/sysutils/eventlircd/evmap/03_0419_0001.evmap index 2cf6c66180..a1eaeaf53b 100644 --- a/packages/sysutils/eventlircd/evmap/03_0419_0001.evmap +++ b/packages/sysutils/eventlircd/evmap/03_0419_0001.evmap @@ -1,4 +1,3 @@ -# = # Power ctrl+shift+alt+KEY_2 = KEY_PVR # TV/DVR ctrl+shift+alt+KEY_H = KEY_PRINT # Print alt+KEY_F4 = KEY_CLOSE # Close @@ -6,36 +5,13 @@ ctrl+shift+alt+KEY_4 = KEY_MEDIA # Pictures ctrl+shift+alt+KEY_5 = KEY_VIDEO # Videos ctrl+shift+alt+KEY_1 = KEY_CONTEXT_MENU # DVD/Menu -#KEY_UP = KEY_UP # Up -#KEY_DOWN = KEY_DOWN # Down -#KEY_LEFT = KEY_LEFT # Left -#KEY_RIGHT = KEY_RIGHT # Right - KEY_BACKSPACE = KEY_BACK # Back - KEY_ENTER = KEY_OK # Ok - KEY_TAB = KEY_TAB # Tab ctrl+KEY_B = KEY_PREVIOUS # Previous ctrl+KEY_P = KEY_PLAYPAUSE # Play/Pause ctrl+KEY_F = KEY_NEXT # Next ctrl+shift+KEY_B = KEY_REWIND # Rew ctrl+KEY_S = KEY_STOP # Stop ctrl+shift+KEY_F = KEY_FORWARD # Fwd -# = KEY_VOLUMEDOWN # Vol- -# = KEY_VOLUMEUP # Vol+ ctrl+shift+alt+KEY_HOME = KEY_MENU # Home -#KEY_PAGEDOWN = KEY_PAGEDOWN # Ch- -#KEY_PAGEUP = KEY_PAGEUP # Ch+ -# = KEY_MUTE # Mute ctrl+KEY_R = KEY_RECORD # Record -# = # Toggle - KEY_1 = KEY_NUMERIC_1 # 1 - KEY_2 = KEY_NUMERIC_2 # 2 - KEY_3 = KEY_NUMERIC_3 # 3 - KEY_4 = KEY_NUMERIC_4 # 4 - KEY_5 = KEY_NUMERIC_5 # 5 - KEY_6 = KEY_NUMERIC_6 # 6 - KEY_7 = KEY_NUMERIC_7 # 7 - KEY_8 = KEY_NUMERIC_8 # 8 - KEY_9 = KEY_NUMERIC_9 # 9 - KEY_0 = KEY_NUMERIC_0 # 0 ctrl+shift+alt+KEY_F = KEY_SHUFFLE # Shuffle ctrl+shift+alt+KEY_B = KEY_MEDIA_REPEAT # Repeat diff --git a/packages/sysutils/eventlircd/evmap/03_046d_c101.evmap b/packages/sysutils/eventlircd/evmap/03_046d_c101.evmap index 99f01ca5e5..bb6da67c64 100644 --- a/packages/sysutils/eventlircd/evmap/03_046d_c101.evmap +++ b/packages/sysutils/eventlircd/evmap/03_046d_c101.evmap @@ -1,61 +1,14 @@ # Logitech, Inc. UltraX Media Remote # Bus=001 Device=009 Product=046d Version=c101 - KEY_RED = KEY_RED # Red - KEY_HOME = KEY_HOME # Home - KEY_CLOSE = KEY_CLOSE # Close - - KEY_TV = KEY_TV # Live TV - KEY_DVD = KEY_DVD # DVD - KEY_MEDIA = KEY_MEDIA # Pictures - KEY_VIDEO = KEY_VIDEO # Videos - KEY_MP3 = KEY_AUDIO # Music - - KEY_1 = KEY_NUMERIC_1 # 1 - KEY_2 = KEY_NUMERIC_2 # 2 - KEY_3 = KEY_NUMERIC_3 # 3 - KEY_4 = KEY_NUMERIC_4 # 4 - KEY_5 = KEY_NUMERIC_5 # 5 - KEY_6 = KEY_NUMERIC_6 # 6 - KEY_7 = KEY_NUMERIC_7 # 7 - KEY_8 = KEY_NUMERIC_8 # 8 - KEY_9 = KEY_NUMERIC_9 # 9 - KEY_0 = KEY_NUMERIC_0 # 0 - - KEY_DELETE = KEY_DELETE # Delete/Clear - KEY_KPENTER = KEY_OK # Enter/OK - KEY_ENTER = KEY_OK # OK - - KEY_VOLUMEDOWN = KEY_VOLUMEDOWN # Vol - - KEY_VOLUMEUP = KEY_VOLUMEUP # Vol + - KEY_MUTE = KEY_MUTE # Mute - - KEY_UP = KEY_UP # Up Arrow - KEY_DOWN = KEY_DOWN # Down Arrow - KEY_LEFT = KEY_LEFT # Left Arrow - KEY_RIGHT = KEY_RIGHT # Right Arrow - - KEY_RECORD = KEY_RECORD # Record + KEY_KPENTER = KEY_ENTER # Enter/OK KEY_STOPCD = KEY_STOP # Stop KEY_PREVIOUSSONG = KEY_PREVIOUS # Prev KEY_NEXTSONG = KEY_NEXT # Next KEY_PLAYPAUSE = KEY_PLAY # Play/Pause - KEY_REWIND = KEY_REWIND # Rev KEY_FASTFORWARD = KEY_FASTFORWARD # Fwd - KEY_CHANNELUP = KEY_CHANNELUP # Channel Up - KEY_CHANNELDOWN = KEY_CHANNELDOWN # Channel Down - - KEY_EXIT = KEY_EXIT # Back KEY_BACK = KEY_EXIT # Back - KEY_MENU = KEY_MENU # Menu - KEY_ANGLE = KEY_ANGLE # Angle - KEY_AUDIO = KEY_AUDIO # Audio - KEY_LAST = KEY_LAST # Last - KEY_LANGUAGE = KEY_LANGUAGE # Language KEY_AGAIN = KEY_MEDIA_REPEAT # Repeat KEY_PROPS = KEY_INFO # Info/EPG - KEY_SUBTITLE = KEY_SUBTITLE # Subtitle - KEY_SHUFFLE = KEY_SHUFFLE # Shuffle - KEY_TEXT = KEY_TEXT # Teletext diff --git a/packages/sysutils/eventlircd/evmap/03_05a4_9881.evmap b/packages/sysutils/eventlircd/evmap/03_05a4_9881.evmap index f50cfa39a7..fcd08f468d 100644 --- a/packages/sysutils/eventlircd/evmap/03_05a4_9881.evmap +++ b/packages/sysutils/eventlircd/evmap/03_05a4_9881.evmap @@ -22,7 +22,7 @@ KEY_DOWN = KEY_DOWN # Direction Down KEY_LEFT = KEY_LEFT # Direction Left KEY_RIGHT = KEY_RIGHT # Direction Right - KEY_ENTER = KEY_OK # Direction OK (also used for Enter) + KEY_ENTER = KEY_ENTER # Direction OK (also used for Enter) BTN_MOUSE = BTN_LEFT # Mouse Left #BTN_RIGHT = KEY_INFO # Mouse Right (also used for Information) KEY_VOLUMEUP = KEY_VOLUMEUP # Volume Up diff --git a/packages/sysutils/eventlircd/evmap/03_05ac_8241.evmap b/packages/sysutils/eventlircd/evmap/03_05ac_8241.evmap index c575ca77ca..9cb59bbfe2 100644 --- a/packages/sysutils/eventlircd/evmap/03_05ac_8241.evmap +++ b/packages/sysutils/eventlircd/evmap/03_05ac_8241.evmap @@ -1,8 +1,4 @@ # Apple Infrared Remote Controller - KEY_VOLUMEDOWN = KEY_VOLUMEDOWN # Vol - - KEY_VOLUMEUP = KEY_VOLUMEUP # Vol + KEY_FORWARD = KEY_NEXT # Next KEY_BACK = KEY_PREVIOUS # Prev - KEY_PLAYPAUSE = KEY_PLAYPAUSE # Play/Pause - KEY_MENU = KEY_MENU # Menu diff --git a/packages/sysutils/eventlircd/evmap/03_0709_9137.evmap b/packages/sysutils/eventlircd/evmap/03_0709_9137.evmap index 81e0627ae5..ac672550a8 100644 --- a/packages/sysutils/eventlircd/evmap/03_0709_9137.evmap +++ b/packages/sysutils/eventlircd/evmap/03_0709_9137.evmap @@ -1,36 +1,10 @@ # Giada N20 Remote # Bus=0003 Vendor=0709 Product=9137 Version=0111 - KEY_1 = KEY_NUMERIC_1 # 1 - KEY_2 = KEY_NUMERIC_2 # 2 - KEY_3 = KEY_NUMERIC_3 # 3 - KEY_4 = KEY_NUMERIC_4 # 4 - KEY_5 = KEY_NUMERIC_5 # 5 - KEY_6 = KEY_NUMERIC_6 # 6 - KEY_7 = KEY_NUMERIC_7 # 7 - KEY_8 = KEY_NUMERIC_8 # 8 - KEY_9 = KEY_NUMERIC_9 # 9 - KEY_0 = KEY_NUMERIC_0 # 0 - - KEY_UP = KEY_UP # Up Arrow - KEY_DOWN = KEY_DOWN # Down Arrow - KEY_LEFT = KEY_LEFT # Left Arrow - KEY_RIGHT = KEY_RIGHT # Right Arrow - - KEY_ENTER = KEY_OK # Enter & Ok KEY_BACK = KEY_EXIT # Back KEY_ESC = KEY_CLEAR # Clear - KEY_VOLUMEDOWN = KEY_VOLUMEDOWN # Vol - - KEY_VOLUMEUP = KEY_VOLUMEUP # Vol + - KEY_MUTE = KEY_MUTE # Mute - KEY_CHANNELUP = KEY_CHANNELUP # CH/PG up - KEY_CHANNELDOWN = KEY_CHANNELDOWN # CH/PG down - - KEY_PLAY = KEY_PLAY # Play KEY_STOPCD = KEY_STOP # Stop - KEY_PAUSE = KEY_PAUSE # Pause - KEY_RECORD = KEY_RECORD # Record KEY_NEXTSONG = KEY_NEXT # Next KEY_PREVIOUSSONG = KEY_PREVIOUS # Prev KEY_REWIND = KEY_REWIND # Rev @@ -41,5 +15,3 @@ shift+KEY_3 = KEY_NUMERIC_POUND # Hash (#) shift+KEY_8 = KEY_NUMERIC_STAR # Star (*) - - KEY_POWER = KEY_POWER # Power diff --git a/packages/sysutils/eventlircd/evmap/03_0755_2626.evmap b/packages/sysutils/eventlircd/evmap/03_0755_2626.evmap index a2f4d0af67..e5e57c9023 100644 --- a/packages/sysutils/eventlircd/evmap/03_0755_2626.evmap +++ b/packages/sysutils/eventlircd/evmap/03_0755_2626.evmap @@ -1,41 +1,12 @@ # Remote 0755:2626 Aureal Semiconductor (iRF Media Technology W-01RN USB_V3.1) - KEY_NUMERIC_1 = KEY_NUMERIC_1 # 1 - KEY_NUMERIC_2 = KEY_NUMERIC_2 # 2 - KEY_NUMERIC_3 = KEY_NUMERIC_3 # 3 - KEY_NUMERIC_4 = KEY_NUMERIC_4 # 4 - KEY_NUMERIC_5 = KEY_NUMERIC_5 # 5 - KEY_NUMERIC_6 = KEY_NUMERIC_6 # 6 - KEY_NUMERIC_7 = KEY_NUMERIC_7 # 7 - KEY_NUMERIC_8 = KEY_NUMERIC_8 # 8 - KEY_NUMERIC_9 = KEY_NUMERIC_9 # 9 - KEY_NUMERIC_0 = KEY_NUMERIC_0 # 0 - KEY_NUMERIC_STAR = KEY_NUMERIC_STAR # * - KEY_NUMERIC_POUND = KEY_NUMERIC_POUND # # - - KEY_1 = KEY_NUMERIC_1 # 1 - KEY_2 = KEY_NUMERIC_2 # 2 - KEY_3 = KEY_NUMERIC_3 # 3 - KEY_4 = KEY_NUMERIC_4 # 4 - KEY_5 = KEY_NUMERIC_5 # 5 - KEY_6 = KEY_NUMERIC_6 # 6 - KEY_7 = KEY_NUMERIC_7 # 7 - KEY_8 = KEY_NUMERIC_8 # 8 - KEY_9 = KEY_NUMERIC_9 # 9 - KEY_0 = KEY_NUMERIC_0 # 0 shift+KEY_8 = KEY_NUMERIC_STAR # * shift+KEY_3 = KEY_NUMERIC_POUND # # - KEY_UP = KEY_UP # Up Arrow - KEY_DOWN = KEY_DOWN # Down Arrow - KEY_LEFT = KEY_LEFT # Left Arrow - KEY_RIGHT = KEY_RIGHT # Right Arrow - ctrl+shift+KEY_B = KEY_REWIND # Rewind ctrl+KEY_LEFT = NULL # Rew (Hide) ctrl+shift+KEY_LEFT = NULL # Rew - KEY_FASTFORWARD = KEY_FASTFORWARD # Forward ctrl+shift+KEY_F = NULL # Fwd (Hide) ctrl+KEY_RIGHT = NULL # Fwd (Hide) ctrl+shift+KEY_RIGHT = NULL # Fwd @@ -58,11 +29,7 @@ KEY_PAGEUP = KEY_CHANNELUP # CH/PG up KEY_PAGEDOWN = KEY_CHANNELDOWN # CH/PG down - KEY_VOLUMEDOWN = KEY_VOLUMEDOWN # Vol - - KEY_VOLUMEUP = KEY_VOLUMEUP # Vol + - KEY_MUTE = KEY_MUTE # Mute - KEY_RED = KEY_RED # Red Key KEY_HOMEPAGE = KEY_GREEN # Green Key KEY_MAIL = KEY_YELLOW # Yellow Key @@ -71,9 +38,7 @@ ctrl+KEY_I = KEY_CAMERA # Pictures ctrl+shift+KEY_M = KEY_DVD # DVD/VCD ctrl+KEY_E = KEY_VIDEO # Videos - KEY_RADIO = KEY_RADIO # Radio ctrl+KEY_A = KEY_RADIO # Radio - KEY_TUNER = KEY_TUNER # Tuner ctrl+shift+KEY_T = KEY_TUNER # Tuner KEY_PVR = KEY_TV # PVR @@ -81,22 +46,11 @@ ctrl+KEY_ENTER = NULL # Full Screen (Hide) alt+KEY_ENTER = KEY_ZOOM # Full Screen - KEY_INFO = KEY_INFO # Info - KEY_EPG = KEY_EPG # EPG - KEY_SUBTITLE = KEY_SUBTITLE # Subtitle - - KEY_ENTER = KEY_OK # Enter - KEY_OK = KEY_OK # Ok - KEY_DELETE = KEY_DELETE # Clear - KEY_EXIT = KEY_EXIT # BACK + KEY_OK = KEY_ENTER # Ok KEY_BACKSPACE = KEY_EXIT # BACK - KEY_POWER = KEY_POWER # Power - alt+KEY_F4 = KEY_CLOSE # Close meta+KEY_D = KEY_INFO # Desktop, remapped to Info in XBMC KEY_COMPOSE = KEY_EPG # More, remapped to Context Menu in XBMC ctrl+KEY_R = KEY_RECORD # Record - KEY_BACK = KEY_BACK # Previous - KEY_FORWARD = KEY_FORWARD # Next KEY_ESC = KEY_DELETE # Clear diff --git a/packages/sysutils/eventlircd/evmap/03_0bc7_0006.evmap b/packages/sysutils/eventlircd/evmap/03_0bc7_0006.evmap index 280c802aa5..484df5657e 100644 --- a/packages/sysutils/eventlircd/evmap/03_0bc7_0006.evmap +++ b/packages/sysutils/eventlircd/evmap/03_0bc7_0006.evmap @@ -1,65 +1,13 @@ # X10 Remote - KEY_POWER = KEY_POWER # Power - KEY_0 = KEY_NUMERIC_0 # 0 - KEY_1 = KEY_NUMERIC_1 # 1 - KEY_2 = KEY_NUMERIC_2 # 2 - KEY_3 = KEY_NUMERIC_3 # 3 - KEY_4 = KEY_NUMERIC_4 # 4 - KEY_5 = KEY_NUMERIC_5 # 5 - KEY_6 = KEY_NUMERIC_6 # 6 - KEY_7 = KEY_NUMERIC_7 # 7 - KEY_8 = KEY_NUMERIC_8 # 8 - KEY_9 = KEY_NUMERIC_9 # 9 - - KEY_VOLUMEUP = KEY_VOLUMEUP # Volume Up - KEY_VOLUMEDOWN = KEY_VOLUMEDOWN # Volume Down - KEY_MUTE = KEY_MUTE # Mute - - KEY_CHANNELUP = KEY_CHANNELUP # Channel Up - KEY_CHANNELDOWN = KEY_CHANNELDOWN # Channel Down - - KEY_OK = KEY_OK # Direction OK (also used for Enter) - KEY_UP = KEY_UP # Direction Up - KEY_DOWN = KEY_DOWN # Direction Down - KEY_LEFT = KEY_LEFT # Direction Left - KEY_RIGHT = KEY_RIGHT # Direction Right - - KEY_PLAY = KEY_PLAY # Play (also used for Pause) - KEY_STOP = KEY_STOP # Stop #deprecated + KEY_OK = KEY_ENTER # Direction OK (also used for Enter) KEY_STOPCD = KEY_STOP # Stop - KEY_PAUSE = KEY_PAUSE # PAUSE - KEY_RECORD = KEY_RECORD # Record - KEY_FORWARD = KEY_FORWARD # Forward # deprecated KEY_FASTFORWARD = KEY_FORWARD # Forward - KEY_REWIND = KEY_REWIND # Reverse - KEY_NEXT = KEY_NEXT # Next track - KEY_PREVIOUS = KEY_PREVIOUS # Pre-track - KEY_LAST = KEY_LAST # Last - KEY_VIDEO = KEY_VIDEO # My Videos - KEY_DVD = KEY_DVD # DVD Menu - KEY_AUDIO = KEY_AUDIO # My Music KEY_IMAGES = KEY_CAMERA # My Pictures - KEY_CAMERA = KEY_CAMERA # Camera KEY_TV = KEY_TUNER # My TV - KEY_RADIO = KEY_RADIO # My Radio - KEY_TEXT = KEY_TEXT # Text - KEY_EPG = KEY_EPG # EPG - KEY_MENU = KEY_MENU # Menu KEY_SELECT = KEY_MEDIA # Start Key/Select Key - KEY_INFO = KEY_INFO # Info KEY_BACK = KEY_EXIT # Back -# KEY_RED = KEY_LANGUAGE # Red/Audio -# KEY_GREEN = KEY_SUBTITLE # Green/Subtitle -# KEY_YELLOW = KEY_ZOOM # Yellow/Angle -# KEY_BLUE = KEY_INFO # Blue/Title - - KEY_RED = KEY_RED # Red/Audio - KEY_GREEN = KEY_GREEN # Green/Subtitle - KEY_YELLOW = KEY_YELLOW # Yellow/Angle - KEY_BLUE = KEY_BLUE # Blue/Title - diff --git a/packages/sysutils/eventlircd/evmap/03_1241_e000.evmap b/packages/sysutils/eventlircd/evmap/03_1241_e000.evmap index 740d009128..9a8973638c 100644 --- a/packages/sysutils/eventlircd/evmap/03_1241_e000.evmap +++ b/packages/sysutils/eventlircd/evmap/03_1241_e000.evmap @@ -2,23 +2,10 @@ # mode 1, keyboard red # keyboard on # mode 2, mouse blue # mouse on - KEY_1 = KEY_NUMERIC_1 # 1 - KEY_2 = KEY_NUMERIC_2 # 2 - KEY_3 = KEY_NUMERIC_3 # 3 - KEY_4 = KEY_NUMERIC_4 # 4 - KEY_5 = KEY_NUMERIC_5 # 5 - KEY_6 = KEY_NUMERIC_6 # 6 - KEY_7 = KEY_NUMERIC_7 # 7 - KEY_8 = KEY_NUMERIC_8 # 8 - KEY_9 = KEY_NUMERIC_9 # 9 - KEY_0 = KEY_NUMERIC_0 # 0 shift+KEY_8 = KEY_NUMERIC_STAR # * BTN_LEFT = KEY_NUMERIC_POUND # # - KEY_POWER = KEY_POWER # Power alt+KEY_F4 = KEY_POWER # Power -#? KEY_SLEEP = KEY_POWER # Sleep # remapped to Power -#? KEY_WAKEUP = KEY_POWER # WakeUp # remapped to Power ctrl+KEY_R = KEY_RECORD # Record ctrl+KEY_P = KEY_PAUSE # Pause @@ -38,14 +25,7 @@ KEY_COMPOSE = KEY_INFO # Info/EPG alt+meta+KEY_ENTER = KEY_MEDIA # Media - KEY_LEFT = KEY_LEFT # Left Arrow - KEY_RIGHT = KEY_RIGHT # Right Arrow - KEY_UP = KEY_UP # Up Arrow - KEY_DOWN = KEY_DOWN # Down Arrow - KEY_ENTER = KEY_OK # Enter & Ok - KEY_VOLUMEUP = KEY_VOLUMEUP # Vol + KEY_F10 = KEY_VOLUMEUP # Vol + - KEY_VOLUMEDOWN = KEY_VOLUMEDOWN # Vol - KEY_F9 = KEY_VOLUMEDOWN # Vol - KEY_PAGEUP = KEY_CHANNELUP # CH/PG up KEY_PAGEDOWN = KEY_CHANNELDOWN # CH/PG down @@ -56,17 +36,12 @@ ctrl+KEY_U = KEY_SUBTITLE # Subtitles ctrl+KEY_G = KEY_EPG # Program # remapped to EPG (Contextmenu) - KEY_VIDEO = KEY_VIDEO # Videos - KEY_DVD = KEY_DVD # DVD ctrl+shift+KEY_M = KEY_DVD # DVD KEY_MP3 = KEY_AUDIO # Music ctrl+KEY_M = KEY_AUDIO # Audio - KEY_CAMERA = KEY_CAMERA # Pictures ctrl+KEY_T = KEY_TUNER # LiveTV ctrl+KEY_E = KEY_TUNER # TV ctrl+KEY_O = KEY_PVR # RecordedTV -# KEY_RED = KEY_RED # Red ctrl+KEY_I = KEY_GREEN # Green alt+KEY_TAB = KEY_YELLOW # Yellow -# KEY_BLUE = KEY_BLUE # Blue diff --git a/packages/sysutils/eventlircd/evmap/03_13ec_0006.evmap b/packages/sysutils/eventlircd/evmap/03_13ec_0006.evmap index d9a58cf149..0bb87989ec 100644 --- a/packages/sysutils/eventlircd/evmap/03_13ec_0006.evmap +++ b/packages/sysutils/eventlircd/evmap/03_13ec_0006.evmap @@ -2,46 +2,15 @@ KEY_SLEEP = KEY_POWER # Power - KEY_1 = KEY_NUMERIC_1 # 1 - KEY_2 = KEY_NUMERIC_2 # 2 - KEY_3 = KEY_NUMERIC_3 # 3 - KEY_4 = KEY_NUMERIC_4 # 4 - KEY_5 = KEY_NUMERIC_5 # 5 - KEY_6 = KEY_NUMERIC_6 # 6 - KEY_7 = KEY_NUMERIC_7 # 7 - KEY_8 = KEY_NUMERIC_8 # 8 - KEY_9 = KEY_NUMERIC_9 # 9 - KEY_0 = KEY_NUMERIC_0 # 0 - - KEY_UP = KEY_UP # Up Arrow - KEY_DOWN = KEY_DOWN # Down Arrow - KEY_LEFT = KEY_LEFT # Left Arrow - KEY_RIGHT = KEY_RIGHT # Right Arrow - KEY_BACKSPACE = KEY_EXIT # Backspace - KEY_ENTER = KEY_OK # Enter KEY_PLAYPAUSE = KEY_PLAY # Play/Pause KEY_STOPCD = KEY_STOP # Stop - KEY_RECORD = KEY_RECORD # Record KEY_PREVIOUSSONG = KEY_PREVIOUS # Prev KEY_NEXTSONG = KEY_NEXT # Next - KEY_REWIND = KEY_REWIND # Rev - KEY_FASTFORWARD = KEY_FASTFORWARD # Fwd - - KEY_VOLUMEDOWN = KEY_VOLUMEDOWN # Vol - - KEY_VOLUMEUP = KEY_VOLUMEUP # Vol + - KEY_MUTE = KEY_MUTE # Mute - - KEY_CHANNELUP = KEY_CHANNELUP # CH/PG up - KEY_CHANNELDOWN = KEY_CHANNELDOWN # CH/PG down KEY_PVR = KEY_MEDIA # Home - KEY_TV = KEY_TV # Live TV - KEY_AUDIO = KEY_AUDIO # Audio KEY_AUX = KEY_CAMERA # Photo - KEY_VIDEO = KEY_VIDEO # Videos - KEY_DVD = KEY_DVD # DVD/VCD KEY_MENU = KEY_EPG # Menu (used for XBMC's context menu) KEY_K = KEY_EPG # Title (used for XBMC's context menu) diff --git a/packages/sysutils/eventlircd/evmap/03_147a_e02d.evmap b/packages/sysutils/eventlircd/evmap/03_147a_e02d.evmap index a1727d57f1..9358a9f625 100644 --- a/packages/sysutils/eventlircd/evmap/03_147a_e02d.evmap +++ b/packages/sysutils/eventlircd/evmap/03_147a_e02d.evmap @@ -1,13 +1,3 @@ - KEY_1 = KEY_NUMERIC_1 - KEY_2 = KEY_NUMERIC_2 - KEY_3 = KEY_NUMERIC_3 - KEY_4 = KEY_NUMERIC_4 - KEY_5 = KEY_NUMERIC_5 - KEY_6 = KEY_NUMERIC_6 - KEY_7 = KEY_NUMERIC_7 - KEY_8 = KEY_NUMERIC_8 - KEY_9 = KEY_NUMERIC_9 - KEY_0 = KEY_NUMERIC_0 KEY_M = KEY_MUTE KEY_R = KEY_VOLUMEDOWN # -/-- key KEY_S = KEY_VOLUMEUP # A/B key @@ -15,11 +5,6 @@ KEY_F6 = KEY_PREVIOUS # KEY_GREEN KEY_F7 = KEY_NEXT # KEY_YELLOW KEY_F8 = KEY_BLUE - KEY_ENTER = KEY_OK - KEY_UP = KEY_UP - KEY_DOWN = KEY_DOWN - KEY_LEFT = KEY_LEFT - KEY_RIGHT = KEY_RIGHT KEY_E = KEY_PROGRAM KEY_F = KEY_EXIT KEY_I = KEY_INFO diff --git a/packages/sysutils/eventlircd/evmap/03_18b1_0037.evmap b/packages/sysutils/eventlircd/evmap/03_18b1_0037.evmap index fe5c5e6b84..f97c6130c9 100644 --- a/packages/sysutils/eventlircd/evmap/03_18b1_0037.evmap +++ b/packages/sysutils/eventlircd/evmap/03_18b1_0037.evmap @@ -1,23 +1,5 @@ # Remote 18b1:0037 Petalynx Maxter - KEY_NUMERIC_1 = KEY_NUMERIC_1 # 1 - KEY_NUMERIC_2 = KEY_NUMERIC_2 # 2 - KEY_NUMERIC_3 = KEY_NUMERIC_3 # 3 - KEY_NUMERIC_4 = KEY_NUMERIC_4 # 4 - KEY_NUMERIC_5 = KEY_NUMERIC_5 # 5 - KEY_NUMERIC_6 = KEY_NUMERIC_6 # 6 - KEY_NUMERIC_7 = KEY_NUMERIC_7 # 7 - KEY_NUMERIC_8 = KEY_NUMERIC_8 # 8 - KEY_NUMERIC_9 = KEY_NUMERIC_9 # 9 - KEY_NUMERIC_0 = KEY_NUMERIC_0 # 0 - KEY_NUMERIC_STAR = KEY_NUMERIC_STAR # * - KEY_NUMERIC_POUND = KEY_NUMERIC_POUND # # - - KEY_UP = KEY_UP # Up Arrow - KEY_DOWN = KEY_DOWN # Down Arrow - KEY_LEFT = KEY_LEFT # Left Arrow - KEY_RIGHT = KEY_RIGHT # Right Arrow - KEY_PREVIOUSSONG = KEY_PREVIOUS # Prev KEY_NEXTSONG = KEY_NEXT # Next @@ -30,29 +12,13 @@ KEY_PAGEUP = KEY_CHANNELUP # CH/PG up KEY_PAGEDOWN = KEY_CHANNELDOWN # CH/PG down - KEY_VOLUMEDOWN = KEY_VOLUMEDOWN # Vol - - KEY_VOLUMEUP = KEY_VOLUMEUP # Vol + - KEY_MUTE = KEY_MUTE # Mute - KEY_RED = KEY_RED # Red Key - KEY_GREEN = KEY_GREEN # Green Key - KEY_YELLOW = KEY_YELLOW # Yellow Key - KEY_BLUE = KEY_BLUE # Blue Key - - KEY_RADIO = KEY_RADIO # Radio - KEY_TUNER = KEY_TUNER # Tuner KEY_PVR = KEY_TV # PVR - KEY_EPG = KEY_EPG # EPG - KEY_SUBTITLE = KEY_SUBTITLE # Subtitle - - KEY_ENTER = KEY_OK # Enter - KEY_OK = KEY_OK # Ok - KEY_DELETE = KEY_DELETE # Clear + KEY_OK = KEY_ENTER # Ok KEY_EXIT = KEY_EXIT # BACK KEY_SLEEP = KEY_POWER # Power - KEY_POWER = KEY_POWER # Power KEY_ESC = KEY_ESC # Escape KEY_BACK = KEY_EXIT # Back diff --git a/packages/sysutils/eventlircd/evmap/03_1d57_ac01.evmap b/packages/sysutils/eventlircd/evmap/03_1d57_ac01.evmap index 270c9c992b..eb8ec8373e 100644 --- a/packages/sysutils/eventlircd/evmap/03_1d57_ac01.evmap +++ b/packages/sysutils/eventlircd/evmap/03_1d57_ac01.evmap @@ -1,38 +1,16 @@ # 1d57:ac01 MS-Tech - KEY_POWER = KEY_POWER # Power - - KEY_1 = KEY_NUMERIC_1 # 1 - KEY_2 = KEY_NUMERIC_2 # 2 - KEY_3 = KEY_NUMERIC_3 # 3 - KEY_4 = KEY_NUMERIC_4 # 4 - KEY_5 = KEY_NUMERIC_5 # 5 - KEY_6 = KEY_NUMERIC_6 # 6 - KEY_7 = KEY_NUMERIC_7 # 7 - KEY_8 = KEY_NUMERIC_8 # 8 - KEY_9 = KEY_NUMERIC_9 # 9 - KEY_0 = KEY_NUMERIC_0 # 0 shift+KEY_8 = KEY_NUMERIC_STAR # * shift+KEY_3 = KEY_NUMERIC_POUND # # - KEY_VOLUMEUP = KEY_VOLUMEUP # Vol + - KEY_VOLUMEDOWN = KEY_VOLUMEDOWN # Vol - - KEY_MUTE = KEY_MUTE # Mute KEY_PAGEUP = KEY_CHANNELUP # CH/PG up KEY_PAGEDOWN = KEY_CHANNELDOWN # CH/PG down ctrl+KEY_F = KEY_NEXT # Next ctrl+KEY_B = KEY_PREVIOUS # Prev - KEY_DELETE = KEY_DELETE # Delete/Clear alt+KEY_F4 = KEY_EXIT # Exit KEY_BACKSPACE = KEY_EXIT # Back - KEY_LEFT = KEY_LEFT # Left Arrow - KEY_RIGHT = KEY_RIGHT # Right Arrow - KEY_UP = KEY_UP # Up Arrow - KEY_DOWN = KEY_DOWN # Down Arrow - KEY_ENTER = KEY_OK # Enter & Ok - KEY_COMPOSE = KEY_INFO # Info ctrl+KEY_R = KEY_RECORD # Record ctrl+KEY_P = KEY_PAUSE # Pause diff --git a/packages/sysutils/eventlircd/evmap/bdremoteng.evmap b/packages/sysutils/eventlircd/evmap/bdremoteng.evmap index 7e6d021dd5..9a4cc17854 100644 --- a/packages/sysutils/eventlircd/evmap/bdremoteng.evmap +++ b/packages/sysutils/eventlircd/evmap/bdremoteng.evmap @@ -5,13 +5,3 @@ BTN_X = KEY_F4 BNT_Y = KEY_F5 BTN_Z = KEY_F6 BTN_START = KEY_ENTER -KEY_0 = KEY_NUMERIC_0 -KEY_1 = KEY_NUMERIC_1 -KEY_2 = KEY_NUMERIC_2 -KEY_3 = KEY_NUMERIC_3 -KEY_4 = KEY_NUMERIC_4 -KEY_5 = KEY_NUMERIC_5 -KEY_6 = KEY_NUMERIC_6 -KEY_7 = KEY_NUMERIC_7 -KEY_8 = KEY_NUMERIC_8 -KEY_9 = KEY_NUMERIC_9 diff --git a/packages/sysutils/eventlircd/evmap/cypress.evmap b/packages/sysutils/eventlircd/evmap/cypress.evmap index 779df2b951..86f5fb7ae3 100644 --- a/packages/sysutils/eventlircd/evmap/cypress.evmap +++ b/packages/sysutils/eventlircd/evmap/cypress.evmap @@ -4,16 +4,12 @@ # Bus=0003 Vendor=04b4 Product=0100 Version=0001 # N: Name="Cyp Se WitheHome" - KEY_POWER = KEY_POWER # Power alt+meta+KEY_ENTER = KEY_MEDIA # Start Key ctrl+shift+KEY_P = KEY_PLAY # Play ctrl+KEY_R = KEY_RECORD # Record ctrl+KEY_P = KEY_PAUSE # Pause ctrl+KEY_S = KEY_STOP # Stop ctrl+shift+KEY_S = KEY_STOP # Stop - KEY_VOLUMEUP = KEY_VOLUMEUP # Volume Up - KEY_VOLUMEDOWN = KEY_VOLUMEDOWN # Volume Down - KEY_MUTE = KEY_MUTE # Mute ctrl+shift+KEY_F = KEY_FASTFORWARD # Forward ctrl+shift+KEY_B = KEY_REWIND # Reverse @@ -23,26 +19,10 @@ KEY_PAGEDOWN = KEY_CHANNELDOWN # Channel Up KEY_PAGEUP = KEY_CHANNELUP # Channel Down - KEY_0 = KEY_NUMERIC_0 # 0 - KEY_1 = KEY_NUMERIC_1 # 1 - KEY_2 = KEY_NUMERIC_2 # 2 - KEY_3 = KEY_NUMERIC_3 # 3 - KEY_4 = KEY_NUMERIC_4 # 4 - KEY_5 = KEY_NUMERIC_5 # 5 - KEY_6 = KEY_NUMERIC_6 # 6 - KEY_7 = KEY_NUMERIC_7 # 7 - KEY_8 = KEY_NUMERIC_8 # 8 - KEY_9 = KEY_NUMERIC_9 # 9 KEY_KPASTERISK = KEY_NUMERIC_STAR # * shift+KEY_3 = KEY_NUMERIC_POUND # # - KEY_UP = KEY_UP # Direction Up - KEY_DOWN = KEY_DOWN # Direction Down - KEY_LEFT = KEY_LEFT # Direction Left - KEY_RIGHT = KEY_RIGHT # Direction Right - KEY_ENTER = KEY_OK # Direction OK (also used for Enter) KEY_BACKSPACE = KEY_EXIT # Back - KEY_DELETE = KEY_DELETE # Clear ctrl+KEY_V = KEY_MENU # Menu ctrl+shift+KEY_M = KEY_MENU # Menu diff --git a/packages/sysutils/eventlircd/evmap/default.evmap b/packages/sysutils/eventlircd/evmap/default.evmap index 2480b5a45b..1e502ed1da 100644 --- a/packages/sysutils/eventlircd/evmap/default.evmap +++ b/packages/sysutils/eventlircd/evmap/default.evmap @@ -1,24 +1 @@ -KEY_1 = KEY_NUMERIC_1 -KEY_2 = KEY_NUMERIC_2 -KEY_3 = KEY_NUMERIC_3 -KEY_4 = KEY_NUMERIC_4 -KEY_5 = KEY_NUMERIC_5 -KEY_6 = KEY_NUMERIC_6 -KEY_7 = KEY_NUMERIC_7 -KEY_8 = KEY_NUMERIC_8 -KEY_9 = KEY_NUMERIC_9 -KEY_0 = KEY_NUMERIC_0 -KEY_E = KEY_BACK -KEY_KP1 = KEY_NUMERIC_1 -KEY_KP2 = KEY_NUMERIC_2 -KEY_KP3 = KEY_NUMERIC_3 -KEY_KP4 = KEY_NUMERIC_4 -KEY_KP5 = KEY_NUMERIC_5 -KEY_KP6 = KEY_NUMERIC_6 -KEY_KP7 = KEY_NUMERIC_7 -KEY_KP8 = KEY_NUMERIC_8 -KEY_KP9 = KEY_NUMERIC_9 -KEY_KP0 = KEY_NUMERIC_0 -KEY_KPASTERISK = KEY_NUMERIC_STAR - -KEY_ENTER = KEY_OK \ No newline at end of file +# nothing to remap \ No newline at end of file diff --git a/packages/sysutils/eventlircd/evmap/ircore.evmap b/packages/sysutils/eventlircd/evmap/ircore.evmap deleted file mode 100644 index c186264c56..0000000000 --- a/packages/sysutils/eventlircd/evmap/ircore.evmap +++ /dev/null @@ -1,45 +0,0 @@ -KEY_1 = KEY_NUMERIC_1 -KEY_2 = KEY_NUMERIC_2 -KEY_3 = KEY_NUMERIC_3 -KEY_4 = KEY_NUMERIC_4 -KEY_5 = KEY_NUMERIC_5 -KEY_6 = KEY_NUMERIC_6 -KEY_7 = KEY_NUMERIC_7 -KEY_8 = KEY_NUMERIC_8 -KEY_9 = KEY_NUMERIC_9 -KEY_0 = KEY_NUMERIC_0 -KEY_STAR = KEY_NUMERIC_STAR -KEY_POUND = KEY_NUMERIC_POUND -KEY_KP1 = KEY_NUMERIC_1 -KEY_KP2 = KEY_NUMERIC_2 -KEY_KP3 = KEY_NUMERIC_3 -KEY_KP4 = KEY_NUMERIC_4 -KEY_KP5 = KEY_NUMERIC_5 -KEY_KP6 = KEY_NUMERIC_6 -KEY_KP7 = KEY_NUMERIC_7 -KEY_KP8 = KEY_NUMERIC_8 -KEY_KP9 = KEY_NUMERIC_9 -KEY_KP0 = KEY_NUMERIC_0 -KEY_KPASTERISK = KEY_NUMERIC_STAR - -KEY_E = KEY_EXIT -KEY_BACK = KEY_EXIT -KEY_BACKSPACE = KEY_EXIT -KEY_ESC = KEY_EXIT -KEY_STOPCD = KEY_STOP -KEY_NEXTSONG = KEY_NEXT -KEY_PREVIOUSSONG = KEY_PREVIOUS -KEY_PROPS = KEY_INFO -KEY_ANGLE = KEY_ZOOM -KEY_MP3 = KEY_AUDIO -KEY_TEXT = KEY_TEXT -KEY_EPG = KEY_EPG - -KEY_ENTER = KEY_OK -KEY_PLAYPAUSE = KEY_PLAY -KEY_TITLE = KEY_SUBTITLE -KEY_CONTEXT_MENU = KEY_EPG # used for context menu -KEY_EJECTCLOSECD = KEY_EJECT -KEY_EJECTCD = KEY_EJECT - -KEY_SLEEP = KEY_POWER diff --git a/packages/sysutils/eventlircd/evmap/mcekbd.evmap b/packages/sysutils/eventlircd/evmap/mcekbd.evmap index 604a8948cd..c453edacb9 100644 --- a/packages/sysutils/eventlircd/evmap/mcekbd.evmap +++ b/packages/sysutils/eventlircd/evmap/mcekbd.evmap @@ -1,22 +1,5 @@ -KEY_UP = KEY_UP -KEY_DOWN = KEY_DOWN -KEY_LEFT = KEY_LEFT -KEY_RIGHT = KEY_RIGHT -KEY_ENTER = KEY_OK -KEY_PAGEDOWN = KEY_PAGEDOWN -KEY_PAGEUP = KEY_PAGEUP alt+meta+KEY_ENTER = KEY_MENU KEY_BACKSPACE = KEY_BACK -KEY_1 = KEY_NUMERIC_1 -KEY_2 = KEY_NUMERIC_2 -KEY_3 = KEY_NUMERIC_3 -KEY_4 = KEY_NUMERIC_4 -KEY_5 = KEY_NUMERIC_5 -KEY_6 = KEY_NUMERIC_6 -KEY_7 = KEY_NUMERIC_7 -KEY_8 = KEY_NUMERIC_8 -KEY_9 = KEY_NUMERIC_9 -KEY_0 = KEY_NUMERIC_0 KEY_EQUAL = KEY_CHANNELUP ctrl+KEY_EQUAL = KEY_CHANNELUP KEY_MINUS = KEY_CHANNELDOWN diff --git a/packages/sysutils/eventlircd/evmap/power.evmap b/packages/sysutils/eventlircd/evmap/power.evmap deleted file mode 100644 index 8b6529c7b5..0000000000 --- a/packages/sysutils/eventlircd/evmap/power.evmap +++ /dev/null @@ -1,2 +0,0 @@ -# Power Button (ACPI) - KEY_POWER = KEY_POWER diff --git a/packages/sysutils/eventlircd/evmap/ps3remote.evmap b/packages/sysutils/eventlircd/evmap/ps3remote.evmap index 9e35f5eb26..bc391f5e8d 100644 --- a/packages/sysutils/eventlircd/evmap/ps3remote.evmap +++ b/packages/sysutils/eventlircd/evmap/ps3remote.evmap @@ -2,30 +2,10 @@ KEY_EJECTCD = KEY_EJECT # Eject -KEY_1 = KEY_NUMERIC_1 # 1 -KEY_2 = KEY_NUMERIC_2 # 2 -KEY_3 = KEY_NUMERIC_3 # 3 -KEY_4 = KEY_NUMERIC_4 # 4 -KEY_5 = KEY_NUMERIC_5 # 5 -KEY_6 = KEY_NUMERIC_6 # 6 -KEY_7 = KEY_NUMERIC_7 # 7 -KEY_8 = KEY_NUMERIC_8 # 8 -KEY_9 = KEY_NUMERIC_9 # 9 -KEY_0 = KEY_NUMERIC_0 # 0 - KEY_AUDIO = KEY_LANGUAGE # Audio -KEY_SUBTITLE = KEY_SUBTITLE # Subtitle KEY_ANGLE = KEY_ZOOM # Angle KEY_CLEAR = KEY_DELETE # Clear -KEY_TIME = KEY_TIME # Time -KEY_RED = KEY_RED # Red -KEY_GREEN = KEY_GREEN # Green -KEY_YELLOW = KEY_YELLOW # Yellow -KEY_BLUE = KEY_BLUE # Blue - -KEY_INFO = KEY_INFO # Display -KEY_MENU = KEY_MENU # Top Menu KEY_CONTEXT_MENU = KEY_EPG # Pop UP/MENU KEY_ESC = KEY_EXIT # Return @@ -34,30 +14,16 @@ KEY_OPTION = KEY_OPTION # Options KEY_SCREEN = KEY_SCREEN # View BTN_0 = KEY_EXIT # X -KEY_UP = KEY_UP # Direction Up -KEY_DOWN = KEY_DOWN # Direction Down -KEY_LEFT = KEY_LEFT # Direction Left -KEY_RIGHT = KEY_RIGHT # Direction Right -KEY_ENTER = KEY_OK # Enter - BTN_TL = KEY_VOLUMEUP # L1 -> Volume Upn BTN_TL2 = KEY_VOLUMEDOWN # L2 -> Volume down BTN_THUMBL = KEY_MUTE # L3 -> Mute KEY_HOMEPAGE = KEY_MEDIA # PS3 Menu KEY_SELECT = KEY_RECORD # Select -BTN_START = KEY_OK # Start +BTN_START = KEY_ENTER # Start BTN_TR = KEY_CHANNELUP # R1 -> Channel Up BTN_TR2 = KEY_CHANNELDOWN # R2 -> Channel down BTN_THUMBR = KEY_PREVIOUS # R3 -> Previous Channel -KEY_PLAY = KEY_PLAY # Play -KEY_STOP = KEY_STOP # Stop -KEY_PAUSE = KEY_PAUSE # Pause -KEY_REWIND = KEY_REWIND # Reverse KEY_FORWARD = KEY_FASTFORWARD # Forward -KEY_PREVIOUS = KEY_PREVIOUS # Pre-track -KEY_NEXT = KEY_NEXT # Next track -KEY_FRAMEBACK = KEY_FRAMEBACK # Step back -KEY_FRAMEFORWARD = KEY_FRAMEFORWARD # Step forward diff --git a/packages/sysutils/eventlircd/evmap/spinelplus.evmap b/packages/sysutils/eventlircd/evmap/spinelplus.evmap index 5a9e79b1b8..de59d094e5 100644 --- a/packages/sysutils/eventlircd/evmap/spinelplus.evmap +++ b/packages/sysutils/eventlircd/evmap/spinelplus.evmap @@ -2,55 +2,18 @@ # 0471:206c PHILIPS MCE USB IR Receiver- Spinel plus # 0471:20cc PHILIPS MCE USB IR Receiver- Spinel plus - KEY_1 = KEY_NUMERIC_1 # 1 - KEY_2 = KEY_NUMERIC_2 # 2 - KEY_3 = KEY_NUMERIC_3 # 3 - KEY_4 = KEY_NUMERIC_4 # 4 - KEY_5 = KEY_NUMERIC_5 # 5 - KEY_6 = KEY_NUMERIC_6 # 6 - KEY_7 = KEY_NUMERIC_7 # 7 - KEY_8 = KEY_NUMERIC_8 # 8 - KEY_9 = KEY_NUMERIC_9 # 9 - KEY_0 = KEY_NUMERIC_0 # 0 - shift+KEY_8 = KEY_NUMERIC_STAR # * - shift+KEY_3 = KEY_NUMERIC_POUND # # +shift+KEY_8 = KEY_NUMERIC_STAR # * +shift+KEY_3 = KEY_NUMERIC_POUND # # - KEY_POWER = KEY_POWER # Power - KEY_SLEEP = KEY_POWER # Sleep # remapped to Power - KEY_WAKEUP = KEY_POWER # WakeUp # remapped to Power - KEY_RECORD = KEY_RECORD # Record - KEY_PAUSE = KEY_PAUSE # Pause - KEY_STOPCD = KEY_STOP # Stop - KEY_REWIND = KEY_REWIND # Rev - KEY_PLAY = KEY_PLAY # Play - KEY_PLAYPAUSE = KEY_PLAY # Play/Pause - KEY_FASTFORWARD = KEY_FASTFORWARD # Fwd - KEY_PREVIOUSSONG = KEY_PREVIOUS # Prev - KEY_NEXTSONG = KEY_NEXT # Next - KEY_BACK = KEY_EXIT # BACK - KEY_PROPS = KEY_INFO # Info/EPG - KEY_LEFT = KEY_LEFT # Left Arrow - KEY_RIGHT = KEY_RIGHT # Right Arrow - KEY_UP = KEY_UP # Up Arrow - KEY_DOWN = KEY_DOWN # Down Arrow - KEY_ENTER = KEY_OK # Enter & Ok - KEY_VOLUMEUP = KEY_VOLUMEUP # Vol + - KEY_VOLUMEDOWN = KEY_VOLUMEDOWN # Vol - - KEY_CHANNELUP = KEY_CHANNELUP # CH/PG up - KEY_CHANNELDOWN = KEY_CHANNELDOWN # CH/PG down - KEY_MUTE = KEY_MUTE # Mute - KEY_PROGRAM = KEY_EPG # Program # remapped to EPG (Contextmenu) - KEY_ESC = KEY_DELETE # Delete/Clear - KEY_HOME = KEY_DELETE # Delete/Clear - KEY_TEXT = KEY_TEXT # Teletext - KEY_MEDIA = KEY_MEDIA # Media - - KEY_VIDEO = KEY_VIDEO # Videos - KEY_DVD = KEY_DVD # DVD - KEY_MP3 = KEY_AUDIO # Music - KEY_CAMERA = KEY_CAMERA # Pictures - - KEY_RED = KEY_RED # Red - KEY_GREEN = KEY_GREEN # Green - KEY_YELLOW = KEY_YELLOW # Yellow - KEY_BLUE = KEY_BLUE # Blue +KEY_SLEEP = KEY_POWER # Sleep # remapped to Power +KEY_WAKEUP = KEY_POWER # WakeUp # remapped to Power +KEY_STOPCD = KEY_STOP # Stop +KEY_PLAYPAUSE = KEY_PLAY # Play/Pause +KEY_PREVIOUSSONG = KEY_PREVIOUS # Prev +KEY_NEXTSONG = KEY_NEXT # Next +KEY_BACK = KEY_EXIT # BACK +KEY_PROPS = KEY_INFO # Info/EPG +KEY_PROGRAM = KEY_EPG # Program # remapped to EPG (Contextmenu) +KEY_ESC = KEY_DELETE # Delete/Clear +KEY_HOME = KEY_DELETE # Delete/Clear +KEY_MP3 = KEY_AUDIO # Music diff --git a/packages/sysutils/eventlircd/evmap/tevii_s660.evmap b/packages/sysutils/eventlircd/evmap/tevii_s660.evmap index cc069b7896..35bc514b59 100644 --- a/packages/sysutils/eventlircd/evmap/tevii_s660.evmap +++ b/packages/sysutils/eventlircd/evmap/tevii_s660.evmap @@ -1,43 +1,15 @@ # TiVii S660 Remote # Bus=0003 Vendor=9022 Product=d660 Version=0000 - KEY_POWER = KEY_POWER # Power - - KEY_1 = KEY_NUMERIC_1 # 1 - KEY_2 = KEY_NUMERIC_2 # 2 - KEY_3 = KEY_NUMERIC_3 # 3 - KEY_4 = KEY_NUMERIC_4 # 4 - KEY_5 = KEY_NUMERIC_5 # 5 - KEY_6 = KEY_NUMERIC_6 # 6 - KEY_7 = KEY_NUMERIC_7 # 7 - KEY_8 = KEY_NUMERIC_8 # 8 - KEY_9 = KEY_NUMERIC_9 # 9 - KEY_0 = KEY_NUMERIC_0 # 0 - - KEY_VOLUMEDOWN = KEY_VOLUMEDOWN # Vol - - KEY_VOLUMEUP = KEY_VOLUMEUP # Vol + - KEY_MUTE = KEY_MUTE # Mute - KEY_CHANNELUP = KEY_CHANNELUP # CH/PG up - KEY_CHANNELDOWN = KEY_CHANNELDOWN # CH/PG down - - KEY_UP = KEY_UP # Up Arrow - KEY_DOWN = KEY_DOWN # Down Arrow - KEY_LEFT = KEY_LEFT # Left Arrow - KEY_RIGHT = KEY_RIGHT # Right Arrow - - KEY_OK = KEY_OK # Ok - KEY_F5 = KEY_OK # Enter + KEY_OK = KEY_ENTER # Ok + KEY_F5 = KEY_ENTER # Enter KEY_PLAYPAUSE = KEY_PLAY # Play/Pause - KEY_RECORD = KEY_RECORD # Record KEY_EPG = KEY_STOP # remap EPG to STOP, because there is no STOP button - KEY_REWIND = KEY_REWIND # Rev - KEY_FASTFORWARD = KEY_FASTFORWARD # Fwd KEY_OPEN = KEY_NEXT # Next KEY_TIME = KEY_PREVIOUS # Prev KEY_F6 = KEY_MEDIA # HOME - KEY_INFO = KEY_INFO # Info KEY_AUDIO = KEY_NUMERIC_POUND # Audio KEY_SUBTITLE = KEY_NUMERIC_STAR # Subtitle diff --git a/packages/sysutils/eventlircd/evmap/topseed.evmap b/packages/sysutils/eventlircd/evmap/topseed.evmap index 2aefa5bba6..244a1296bd 100644 --- a/packages/sysutils/eventlircd/evmap/topseed.evmap +++ b/packages/sysutils/eventlircd/evmap/topseed.evmap @@ -5,67 +5,21 @@ # 0766:0204 Topseed Cyberlink # 1784:0004 Topseed 2 RF Combo - KEY_1 = KEY_NUMERIC_1 # 1 - KEY_2 = KEY_NUMERIC_2 # 2 - KEY_3 = KEY_NUMERIC_3 # 3 - KEY_4 = KEY_NUMERIC_4 # 4 - KEY_5 = KEY_NUMERIC_5 # 5 - KEY_6 = KEY_NUMERIC_6 # 6 - KEY_7 = KEY_NUMERIC_7 # 7 - KEY_8 = KEY_NUMERIC_8 # 8 - KEY_9 = KEY_NUMERIC_9 # 9 - KEY_0 = KEY_NUMERIC_0 # 0 shift+KEY_8 = KEY_NUMERIC_STAR # * shift+KEY_3 = KEY_NUMERIC_POUND # # - KEY_UP = KEY_UP # Up Arrow - KEY_DOWN = KEY_DOWN # Down Arrow - KEY_LEFT = KEY_LEFT # Left Arrow - KEY_RIGHT = KEY_RIGHT # Right Arrow - KEY_ENTER = KEY_OK # Enter & Ok - KEY_DELETE = KEY_DELETE # Delete/Clear KEY_BACK = KEY_EXIT # BACK KEY_ESC = KEY_DELETE # Delete/Clear - KEY_HOME = KEY_HOME # Home - KEY_MEDIA = KEY_MEDIA # Home KEY_SLEEP = KEY_POWER # Power - KEY_VOLUMEDOWN = KEY_VOLUMEDOWN # Vol - - KEY_VOLUMEUP = KEY_VOLUMEUP # Vol + - KEY_MUTE = KEY_MUTE # Mute - KEY_CHANNELUP = KEY_CHANNELUP # CH/PG up - KEY_CHANNELDOWN = KEY_CHANNELDOWN # CH/PG down - KEY_PLAY = KEY_PLAY # Play - KEY_RECORD = KEY_RECORD # Record - KEY_REWIND = KEY_REWIND # Rev - KEY_PAUSE = KEY_PAUSE # Pause - KEY_FASTFORWARD = KEY_FASTFORWARD # Fwd - KEY_PREVIOUSSONG = KEY_PREVIOUS # Prev KEY_STOPCD = KEY_STOP # Stop KEY_NEXTSONG = KEY_NEXT # Next - KEY_DVD = KEY_DVD # DVD/VCD KEY_MP3 = KEY_AUDIO # Music - KEY_CAMERA = KEY_CAMERA # Pictures - KEY_VIDEO = KEY_VIDEO # Videos KEY_RADIO = KEY_ZOOM # Radio # Remap because we need the zoom key - KEY_AUDIO = KEY_AUDIO # SAP - KEY_TV = KEY_TV # Live TV KEY_TV2 = KEY_EPG # EPG - KEY_TEXT = KEY_TEXT # Teletext/CC - KEY_LAST = KEY_LAST # Last CH - KEY_SUBTITLE = KEY_SUBTITLE # Subtitle KEY_PROGRAM = KEY_SUBTITLE # Program # remapped to Subtitle - KEY_LANGUAGE = KEY_LANGUAGE # Language - KEY_ANGLE = KEY_ANGLE # Angle - KEY_MODE = KEY_MODE # Radio # Remap because we need the zoom key KEY_PROPS = KEY_INFO # Info/EPG - KEY_MENU = KEY_MENU # DVD Menu - - KEY_RED = KEY_RED # Red - KEY_GREEN = KEY_GREEN # Green - KEY_YELLOW = KEY_YELLOW # Yellow - KEY_BLUE = KEY_BLUE # Blue diff --git a/packages/sysutils/eventlircd/evmap/wiimote.evmap b/packages/sysutils/eventlircd/evmap/wiimote.evmap index dc5e004335..16d1999684 100644 --- a/packages/sysutils/eventlircd/evmap/wiimote.evmap +++ b/packages/sysutils/eventlircd/evmap/wiimote.evmap @@ -1,11 +1,6 @@ -BTN_A = KEY_OK # Ok +BTN_A = KEY_ENTER # Ok BTN_B = KEY_EXIT # Back/Exit -KEY_UP = KEY_UP # Up -KEY_DOWN = KEY_DOWN # Down -KEY_LEFT = KEY_LEFT # Left -KEY_RIGHT = KEY_RIGHT # Right - KEY_PREVIOUS = KEY_VOLUMEDOWN # Vol- KEY_NEXT = KEY_VOLUMEUP # Vol+ diff --git a/packages/sysutils/eventlircd/udev.d/98-eventlircd.rules b/packages/sysutils/eventlircd/udev.d/98-eventlircd.rules index 82da47d98a..097640a7f4 100644 --- a/packages/sysutils/eventlircd/udev.d/98-eventlircd.rules +++ b/packages/sysutils/eventlircd/udev.d/98-eventlircd.rules @@ -55,19 +55,19 @@ ATTRS{name}=="bdremoteng", \ #------------------------------------------------------------------------------- SUBSYSTEMS=="rc", \ ENV{eventlircd_enable}="true", \ - ENV{eventlircd_evmap}="ircore.evmap" + ENV{eventlircd_evmap}="default.evmap" #------------------------------------------------------------------------------- # Ask eventlircd to handle power button. #------------------------------------------------------------------------------- SUBSYSTEMS=="acpi", ATTRS{hid}=="LNXPWRBN", \ ENV{eventlircd_enable}="true", \ - ENV{eventlircd_evmap}="power.evmap" + ENV{eventlircd_evmap}="default.evmap" # WeTek Play keyboard (power button) SUBSYSTEMS=="input", ATTRS{name}=="key_input", \ ENV{eventlircd_enable}="true", \ - ENV{eventlircd_evmap}="power.evmap" + ENV{eventlircd_evmap}="default.evmap" #------------------------------------------------------------------------------- # Ask eventlircd to handle USB HID devices that show up as event devices and are diff --git a/packages/sysutils/imx6-status-led/profile.d/01-system_type.conf b/packages/sysutils/imx6-status-led/profile.d/01-system_type.conf index d7260629da..c7ffb66634 100644 --- a/packages/sysutils/imx6-status-led/profile.d/01-system_type.conf +++ b/packages/sysutils/imx6-status-led/profile.d/01-system_type.conf @@ -35,6 +35,9 @@ case "$SYSTEM_TYPE" in "SolidRun Cubox-i Dual/Quad") export SYSTEM_TYPE="cuboxi" ;; + "Udoo i.MX6 Dual-lite Board"|"Udoo i.MX6 Quad Board") + export SYSTEM_TYPE="udoo" + ;; *) export SYSTEM_TYPE="undef" ;; diff --git a/packages/tools/bcm2835-bootloader/package.mk b/packages/tools/bcm2835-bootloader/package.mk index f452782e43..a06fef5e63 100644 --- a/packages/tools/bcm2835-bootloader/package.mk +++ b/packages/tools/bcm2835-bootloader/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="bcm2835-bootloader" -PKG_VERSION="47d51d6" +PKG_VERSION="53b9bb9" PKG_REV="1" PKG_ARCH="arm" PKG_LICENSE="nonfree" diff --git a/packages/tools/installer/scripts/installer b/packages/tools/installer/scripts/installer index b953397754..4cbca24d8d 100755 --- a/packages/tools/installer/scripts/installer +++ b/packages/tools/installer/scripts/installer @@ -206,14 +206,8 @@ do_install_quick() { esac prompt_gpt - prompt_ssh prompt_backup_unpack - EXTLINUX_SSH="" - if [ "$SSH" = "1" ]; then - EXTLINUX_SSH="ssh" - fi - # check for confirmation (twice!) MSG_TITLE="\Z1[ Confirmation before installing ]\Zn" MSG_DETAIL="\nIf you continue the target disk will be wiped out:\n\n$INSTALL_DEVICE_FULL\n\n" @@ -329,7 +323,7 @@ do_install_quick() { echo " " >> $TMPDIR/part1/extlinux.conf echo "LABEL linux" >> $TMPDIR/part1/extlinux.conf echo " KERNEL /KERNEL" >> $TMPDIR/part1/extlinux.conf - echo " APPEND boot=LABEL=$DISKLABEL_SYSTEM disk=LABEL=$DISKLABEL_STORAGE $EXTLINUX_PARAMETERS $EXTLINUX_SSH quiet" >> $TMPDIR/part1/extlinux.conf + echo " APPEND boot=LABEL=$DISKLABEL_SYSTEM disk=LABEL=$DISKLABEL_STORAGE $EXTLINUX_PARAMETERS quiet" >> $TMPDIR/part1/extlinux.conf # uefi boot / hybrid mode if [ "$UEFI" = "1" ]; then mv $TMPDIR/part1/extlinux.conf $TMPDIR/part1/syslinux.cfg @@ -565,21 +559,6 @@ prompt_gpt() { fi } -prompt_ssh() { - # Prompt for SSH enabling - # usage: prompt_ssh - # uses: - # provides: SSH - MSG_TITLE="\Z1[ Enable SSH Server on start ]\Zn" - MSG_DETAIL="Enable SSH server per default.\nYou should only enable SSH server if you know what you are doing." - DIALOG_OPTIONS="--defaultno" - if dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" $DIALOG_OPTIONS --yesno "$MSG_DETAIL" 0 0; then - SSH="1" - else - SSH="0" - fi -} - prompt_backup_unpack() { # Prompt for unpacking backup files to /storage # usage: prompt_backup_unpack diff --git a/packages/tools/u-boot/package.mk b/packages/tools/u-boot/package.mk index 3764fe2ce0..c99758e693 100644 --- a/packages/tools/u-boot/package.mk +++ b/packages/tools/u-boot/package.mk @@ -74,8 +74,8 @@ make_target() { TARGET_NAME="cuboxi" elif [ "$UBOOT_TARGET" = "matrix" ]; then TARGET_NAME="matrix" - elif [ "$UBOOT_TARGET" = "udoo_quad_config" ]; then - TARGET_NAME="udoo_quad" + elif [ "$UBOOT_TARGET" = "udoo_config" ]; then + TARGET_NAME="udoo" else TARGET_NAME="undef" fi diff --git a/packages/wayland/libinput/package.mk b/packages/wayland/libinput/package.mk index 1859dddd15..3a70f9f1f6 100644 --- a/packages/wayland/libinput/package.mk +++ b/packages/wayland/libinput/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="libinput" -PKG_VERSION="0.19.0" +PKG_VERSION="0.21.0" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/web/curl/package.mk b/packages/web/curl/package.mk index b30d619a83..7e9a599ac3 100644 --- a/packages/web/curl/package.mk +++ b/packages/web/curl/package.mk @@ -25,7 +25,7 @@ # there: http://forum.xbmc.org/showthread.php?tid=177557 PKG_NAME="curl" -PKG_VERSION="7.43.0" +PKG_VERSION="7.44.0" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="MIT" diff --git a/packages/x11/data/xkeyboard-config/package.mk b/packages/x11/data/xkeyboard-config/package.mk index 00c8aff3de..0012f032f0 100644 --- a/packages/x11/data/xkeyboard-config/package.mk +++ b/packages/x11/data/xkeyboard-config/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="xkeyboard-config" -PKG_VERSION="2.10.1" +PKG_VERSION="2.15" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="OSS" diff --git a/packages/x11/data/xkeyboard-config/patches/xkeyboard-config-01_autoconf-macrodir.patch b/packages/x11/data/xkeyboard-config/patches/xkeyboard-config-01_autoconf-macrodir.patch.bk similarity index 100% rename from packages/x11/data/xkeyboard-config/patches/xkeyboard-config-01_autoconf-macrodir.patch rename to packages/x11/data/xkeyboard-config/patches/xkeyboard-config-01_autoconf-macrodir.patch.bk diff --git a/packages/x11/driver/xf86-input-libinput/package.mk b/packages/x11/driver/xf86-input-libinput/package.mk index 9dbb8bd9a4..ba5d021977 100644 --- a/packages/x11/driver/xf86-input-libinput/package.mk +++ b/packages/x11/driver/xf86-input-libinput/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="xf86-input-libinput" -PKG_VERSION="0.11.0" +PKG_VERSION="0.13.0" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/x11/driver/xf86-video-nvidia/package.mk b/packages/x11/driver/xf86-video-nvidia/package.mk index 3dcdbdf252..31eab50898 100644 --- a/packages/x11/driver/xf86-video-nvidia/package.mk +++ b/packages/x11/driver/xf86-video-nvidia/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="xf86-video-nvidia" -PKG_VERSION="352.21" +PKG_VERSION="352.30" PKG_REV="1" PKG_ARCH="x86_64" PKG_LICENSE="nonfree" diff --git a/projects/Generic/linux/linux.x86_64.conf b/projects/Generic/linux/linux.x86_64.conf index aa94083d3a..9892cd45cd 100644 --- a/projects/Generic/linux/linux.x86_64.conf +++ b/projects/Generic/linux/linux.x86_64.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86_64 4.1.0-rc8 Kernel Configuration +# Linux/x86_64 4.1.3 Kernel Configuration # CONFIG_64BIT=y CONFIG_X86_64=y @@ -152,16 +152,30 @@ CONFIG_NUMA_BALANCING=y CONFIG_NUMA_BALANCING_DEFAULT_ENABLED=y CONFIG_CGROUPS=y # CONFIG_CGROUP_DEBUG is not set -# CONFIG_CGROUP_FREEZER is not set -# CONFIG_CGROUP_DEVICE is not set -# CONFIG_CPUSETS is not set -# CONFIG_CGROUP_CPUACCT is not set -# CONFIG_MEMCG is not set -# CONFIG_CGROUP_PERF is not set -# CONFIG_CGROUP_SCHED is not set -# CONFIG_BLK_CGROUP is not set +CONFIG_CGROUP_FREEZER=y +CONFIG_CGROUP_DEVICE=y +CONFIG_CPUSETS=y +CONFIG_PROC_PID_CPUSET=y +CONFIG_CGROUP_CPUACCT=y +CONFIG_PAGE_COUNTER=y +CONFIG_MEMCG=y +CONFIG_MEMCG_SWAP=y +CONFIG_MEMCG_SWAP_ENABLED=y +CONFIG_MEMCG_KMEM=y +CONFIG_CGROUP_PERF=y +CONFIG_CGROUP_SCHED=y +CONFIG_FAIR_GROUP_SCHED=y +CONFIG_CFS_BANDWIDTH=y +CONFIG_RT_GROUP_SCHED=y +CONFIG_BLK_CGROUP=y +# CONFIG_DEBUG_BLK_CGROUP is not set # CONFIG_CHECKPOINT_RESTORE is not set -# CONFIG_NAMESPACES is not set +CONFIG_NAMESPACES=y +CONFIG_UTS_NS=y +CONFIG_IPC_NS=y +# CONFIG_USER_NS is not set +CONFIG_PID_NS=y +CONFIG_NET_NS=y # CONFIG_SCHED_AUTOGROUP is not set # CONFIG_SYSFS_DEPRECATED is not set CONFIG_RELAY=y @@ -296,6 +310,7 @@ CONFIG_BLOCK=y CONFIG_BLK_DEV_BSG=y CONFIG_BLK_DEV_BSGLIB=y # CONFIG_BLK_DEV_INTEGRITY is not set +# CONFIG_BLK_DEV_THROTTLING is not set # CONFIG_BLK_CMDLINE_PARSER is not set # @@ -330,6 +345,7 @@ CONFIG_BLOCK_COMPAT=y CONFIG_IOSCHED_NOOP=y # CONFIG_IOSCHED_DEADLINE is not set CONFIG_IOSCHED_CFQ=y +# CONFIG_CFQ_GROUP_IOSCHED is not set CONFIG_DEFAULT_CFQ=y # CONFIG_DEFAULT_NOOP is not set CONFIG_DEFAULT_IOSCHED="cfq" @@ -618,6 +634,7 @@ CONFIG_PCIEASPM_DEFAULT=y # CONFIG_PCIEASPM_POWERSAVE is not set # CONFIG_PCIEASPM_PERFORMANCE is not set CONFIG_PCIE_PME=y +CONFIG_PCI_BUS_ADDR_T_64BIT=y CONFIG_PCI_MSI=y # CONFIG_PCI_DEBUG is not set # CONFIG_PCI_REALLOC_ENABLE_AUTO is not set @@ -727,7 +744,7 @@ CONFIG_NET_PTP_CLASSIFY=y CONFIG_NETFILTER=y # CONFIG_NETFILTER_DEBUG is not set CONFIG_NETFILTER_ADVANCED=y -# CONFIG_BRIDGE_NETFILTER is not set +CONFIG_BRIDGE_NETFILTER=m # # Core Netfilter Configuration @@ -797,7 +814,7 @@ CONFIG_NETFILTER_XT_NAT=m # # Xtables matches # -# CONFIG_NETFILTER_XT_MATCH_ADDRTYPE is not set +CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m # CONFIG_NETFILTER_XT_MATCH_BPF is not set # CONFIG_NETFILTER_XT_MATCH_CGROUP is not set # CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set @@ -806,7 +823,7 @@ CONFIG_NETFILTER_XT_NAT=m # CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set # CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set # CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set -# CONFIG_NETFILTER_XT_MATCH_CONNTRACK is not set +CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m # CONFIG_NETFILTER_XT_MATCH_CPU is not set # CONFIG_NETFILTER_XT_MATCH_DCCP is not set # CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set @@ -827,6 +844,7 @@ CONFIG_NETFILTER_XT_MATCH_IPRANGE=m # CONFIG_NETFILTER_XT_MATCH_NFACCT is not set # CONFIG_NETFILTER_XT_MATCH_OSF is not set CONFIG_NETFILTER_XT_MATCH_OWNER=m +# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set # CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set # CONFIG_NETFILTER_XT_MATCH_QUOTA is not set # CONFIG_NETFILTER_XT_MATCH_RATEEST is not set @@ -1356,14 +1374,15 @@ CONFIG_NET_CORE=y # CONFIG_EQUALIZER is not set # CONFIG_NET_FC is not set # CONFIG_NET_TEAM is not set -# CONFIG_MACVLAN is not set +CONFIG_MACVLAN=m +# CONFIG_MACVTAP is not set # CONFIG_IPVLAN is not set # CONFIG_VXLAN is not set CONFIG_NETCONSOLE=y CONFIG_NETPOLL=y CONFIG_NET_POLL_CONTROLLER=y CONFIG_TUN=y -# CONFIG_VETH is not set +CONFIG_VETH=m # CONFIG_NLMON is not set # CONFIG_ARCNET is not set @@ -1518,7 +1537,7 @@ CONFIG_REALTEK_PHY=y # CONFIG_FIXED_PHY is not set # CONFIG_MDIO_BITBANG is not set # CONFIG_MDIO_BCM_UNIMAC is not set -CONFIG_PPP=y +CONFIG_PPP=m CONFIG_PPP_BSDCOMP=m CONFIG_PPP_DEFLATE=m # CONFIG_PPP_FILTER is not set @@ -1528,7 +1547,7 @@ CONFIG_PPPOE=m CONFIG_PPP_ASYNC=m # CONFIG_PPP_SYNC_TTY is not set # CONFIG_SLIP is not set -CONFIG_SLHC=y +CONFIG_SLHC=m CONFIG_USB_NET_DRIVERS=y # CONFIG_USB_CATC is not set # CONFIG_USB_KAWETH is not set @@ -1865,7 +1884,7 @@ CONFIG_VT_CONSOLE_SLEEP=y CONFIG_HW_CONSOLE=y CONFIG_VT_HW_CONSOLE_BINDING=y CONFIG_UNIX98_PTYS=y -# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set +CONFIG_DEVPTS_MULTIPLE_INSTANCES=y # CONFIG_LEGACY_PTYS is not set # CONFIG_SERIAL_NONSTANDARD is not set # CONFIG_NOZOMI is not set @@ -3717,8 +3736,8 @@ CONFIG_DCACHE_WORD_ACCESS=y # CONFIG_EXT3_FS is not set CONFIG_EXT4_FS=y CONFIG_EXT4_USE_FOR_EXT23=y -# CONFIG_EXT4_FS_POSIX_ACL is not set -# CONFIG_EXT4_FS_SECURITY is not set +CONFIG_EXT4_FS_POSIX_ACL=y +CONFIG_EXT4_FS_SECURITY=y # CONFIG_EXT4_ENCRYPTION is not set # CONFIG_EXT4_DEBUG is not set CONFIG_JBD2=y @@ -3764,7 +3783,7 @@ CONFIG_FANOTIFY=y CONFIG_AUTOFS4_FS=y CONFIG_FUSE_FS=m # CONFIG_CUSE is not set -# CONFIG_OVERLAY_FS is not set +CONFIG_OVERLAY_FS=m # # Caches diff --git a/projects/Nvidia_Legacy/linux/linux.x86_64.conf b/projects/Nvidia_Legacy/linux/linux.x86_64.conf index 4917a75227..1ee06cf62e 100644 --- a/projects/Nvidia_Legacy/linux/linux.x86_64.conf +++ b/projects/Nvidia_Legacy/linux/linux.x86_64.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86_64 4.1.0-rc8 Kernel Configuration +# Linux/x86_64 4.1.2 Kernel Configuration # CONFIG_64BIT=y CONFIG_X86_64=y @@ -1518,7 +1518,7 @@ CONFIG_REALTEK_PHY=y # CONFIG_FIXED_PHY is not set # CONFIG_MDIO_BITBANG is not set # CONFIG_MDIO_BCM_UNIMAC is not set -CONFIG_PPP=y +CONFIG_PPP=m CONFIG_PPP_BSDCOMP=m CONFIG_PPP_DEFLATE=m # CONFIG_PPP_FILTER is not set @@ -1528,7 +1528,7 @@ CONFIG_PPPOE=m CONFIG_PPP_ASYNC=m # CONFIG_PPP_SYNC_TTY is not set # CONFIG_SLIP is not set -CONFIG_SLHC=y +CONFIG_SLHC=m CONFIG_USB_NET_DRIVERS=y # CONFIG_USB_CATC is not set # CONFIG_USB_KAWETH is not set diff --git a/projects/RPi/linux/linux.arm.conf b/projects/RPi/linux/linux.arm.conf index e14652cd96..007b5eaba9 100644 --- a/projects/RPi/linux/linux.arm.conf +++ b/projects/RPi/linux/linux.arm.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 4.1.0-rc8 Kernel Configuration +# Linux/arm 4.1.2 Kernel Configuration # CONFIG_ARM=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y @@ -1098,7 +1098,7 @@ CONFIG_PHYLIB=y # CONFIG_MDIO_BUS_MUX_MMIOREG is not set # CONFIG_MDIO_BCM_UNIMAC is not set # CONFIG_MICREL_KS8995MA is not set -CONFIG_PPP=y +CONFIG_PPP=m CONFIG_PPP_BSDCOMP=m CONFIG_PPP_DEFLATE=m # CONFIG_PPP_FILTER is not set @@ -1108,7 +1108,7 @@ CONFIG_PPPOE=m CONFIG_PPP_ASYNC=m # CONFIG_PPP_SYNC_TTY is not set # CONFIG_SLIP is not set -CONFIG_SLHC=y +CONFIG_SLHC=m CONFIG_USB_NET_DRIVERS=y # CONFIG_USB_CATC is not set # CONFIG_USB_KAWETH is not set @@ -1289,6 +1289,7 @@ CONFIG_INPUT_JOYSTICK=y CONFIG_JOYSTICK_XPAD=m CONFIG_JOYSTICK_XPAD_FF=y CONFIG_JOYSTICK_XPAD_LEDS=y +# CONFIG_JOYSTICK_RPISENSE is not set # CONFIG_INPUT_TABLET is not set # CONFIG_INPUT_TOUCHSCREEN is not set CONFIG_INPUT_MISC=y @@ -1381,6 +1382,7 @@ CONFIG_HW_RANDOM_BCM2708=m CONFIG_BRCM_CHAR_DRIVERS=y CONFIG_BCM_VC_CMA=y CONFIG_BCM2708_VCMEM=y +CONFIG_BCM_VCIO=y CONFIG_BCM_VC_SM=y # CONFIG_XILLYBUS is not set @@ -1782,6 +1784,7 @@ CONFIG_BCMA_DRIVER_GMAC_CMN=y # Multifunction device drivers # CONFIG_MFD_CORE=y +# CONFIG_MFD_RPISENSE_CORE is not set # CONFIG_MFD_AS3711 is not set # CONFIG_MFD_AS3722 is not set # CONFIG_PMIC_ADP5520 is not set @@ -2305,6 +2308,7 @@ CONFIG_FB_BCM2708=y # CONFIG_FB_AUO_K190X is not set # CONFIG_FB_SIMPLE is not set # CONFIG_FB_SSD1307 is not set +# CONFIG_FB_RPISENSE is not set # CONFIG_BACKLIGHT_LCD_SUPPORT is not set # CONFIG_VGASTATE is not set @@ -2455,7 +2459,7 @@ CONFIG_SND_SOC_WM8731=m # CONFIG_SND_SOC_WM8770 is not set # CONFIG_SND_SOC_WM8776 is not set CONFIG_SND_SOC_WM8804=m -# CONFIG_SND_SOC_WM8804_I2C is not set +CONFIG_SND_SOC_WM8804_I2C=m # CONFIG_SND_SOC_WM8804_SPI is not set # CONFIG_SND_SOC_WM8903 is not set # CONFIG_SND_SOC_WM8962 is not set @@ -3018,6 +3022,7 @@ CONFIG_BCM2708_MBOX=y # CONFIG_ARM_MHU is not set # CONFIG_PL320_MBOX is not set # CONFIG_ALTERA_MBOX is not set +CONFIG_BCM2835_MBOX=y # CONFIG_IOMMU_SUPPORT is not set # @@ -3032,7 +3037,6 @@ CONFIG_BCM2708_MBOX=y # # SOC (System On Chip) specific Drivers # -CONFIG_BCM2708_POWER=y # CONFIG_SOC_TI is not set # CONFIG_PM_DEVFREQ is not set CONFIG_EXTCON=m @@ -3070,6 +3074,7 @@ CONFIG_IRQCHIP=y # Firmware Drivers # # CONFIG_FIRMWARE_MEMMAP is not set +CONFIG_RASPBERRYPI_FIRMWARE=y # # File systems diff --git a/projects/RPi/patches/kodi/kodi-001-isengard-rpb-backports.patch b/projects/RPi/patches/kodi/kodi-001-isengard-rpb-backports.patch index e1ec4be1b1..0699fba75b 100644 --- a/projects/RPi/patches/kodi/kodi-001-isengard-rpb-backports.patch +++ b/projects/RPi/patches/kodi/kodi-001-isengard-rpb-backports.patch @@ -1,7 +1,7 @@ -From d4dbab9f0c3bc4ab02ba312ba0d4aa9f41371fdf Mon Sep 17 00:00:00 2001 +From fca20ce71da054984d648316b362c9318dfeab10 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 7 Apr 2014 18:19:32 +0100 -Subject: [PATCH 01/58] [rbp/omxplayer] When opening a stream don't try to +Subject: [PATCH 01/87] [rbp/omxplayer] When opening a stream don't try to update gui so often --- @@ -9,7 +9,7 @@ Subject: [PATCH 01/58] [rbp/omxplayer] When opening a stream don't try to 1 file changed, 4 insertions(+) diff --git a/xbmc/dialogs/GUIDialogBusy.cpp b/xbmc/dialogs/GUIDialogBusy.cpp -index 2faceea..889d7a2 100644 +index 318ecec..59698f6 100644 --- a/xbmc/dialogs/GUIDialogBusy.cpp +++ b/xbmc/dialogs/GUIDialogBusy.cpp @@ -68,7 +68,11 @@ bool CGUIDialogBusy::WaitOnEvent(CEvent &event, unsigned int displaytime /* = 10 @@ -25,10 +25,10 @@ index 2faceea..889d7a2 100644 g_windowManager.ProcessRenderLoop(false); if (allowCancel && dialog->IsCanceled()) -From 1ecf22c5b4c919e3aed5274c67f748bbae86fbf0 Mon Sep 17 00:00:00 2001 +From cda1cae0c13be8b8db75d61f64879291a994426c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 8 Mar 2014 15:36:06 +0000 -Subject: [PATCH 03/58] [hifiberry] Hack: force it to be recognised as IEC958 +Subject: [PATCH 03/87] [hifiberry] Hack: force it to be recognised as IEC958 capable to enable passthrough options --- @@ -51,10 +51,10 @@ index e22db7a..0120bd5 100644 info.m_displayName.substr(info.m_displayName.size()-5) == " HDMI") { -From ac054e5b5efd9ec9205598f9b7549a8e953272fd Mon Sep 17 00:00:00 2001 +From b8992693e016eed3d5e89ddc437aa4c59b561d13 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Thu, 1 May 2014 16:28:39 +0100 -Subject: [PATCH 04/58] Improved file buffering in CArchive +Subject: [PATCH 04/87] Improved file buffering in CArchive Even though memcpy is typically inlined by the compiler into byte/word loads and stores (at least for release builds), the frequency with which 1, 2 and 4 @@ -114,20 +114,20 @@ index 6ed0f8f..8506d95 100644 } else -From 1a7d63a938850a884f08bd3af66808bef91b7588 Mon Sep 17 00:00:00 2001 +From 396257e8ed99f16e3088a650f47d1356410ae912 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 12 Aug 2014 00:31:36 +0100 -Subject: [PATCH 05/58] [omxcodec] Don't force software codec with dvds +Subject: [PATCH 05/87] [omxcodec] Don't force software codec with dvds --- xbmc/cores/dvdplayer/DVDPlayer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 82b5baa..70b1ac3 100644 +index 7c84557..87463a7 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -3421,7 +3421,9 @@ bool CDVDPlayer::OpenVideoStream(CDVDStreamInfo& hint, bool reset) +@@ -3417,7 +3417,9 @@ bool CDVDPlayer::OpenVideoStream(CDVDStreamInfo& hint, bool reset) hint.aspect = aspect; hint.forced_aspect = true; } @@ -138,10 +138,10 @@ index 82b5baa..70b1ac3 100644 else if (m_pInputStream && m_pInputStream->IsStreamType(DVDSTREAM_TYPE_PVRMANAGER)) { -From 47e9b3430cd67a4e9e17de65df96f9c0dbb7c39c Mon Sep 17 00:00:00 2001 +From c44cf37f3ab1c1b836044c503f51609190c6d1cc Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 10 Aug 2014 16:45:16 +0100 -Subject: [PATCH 06/58] filesystem: Make support of browsing into archives +Subject: [PATCH 06/87] filesystem: Make support of browsing into archives optional The ability to browse, scan and play content in archives can cause problems on low powered/low memory devices. @@ -159,10 +159,10 @@ We'll let people who don't use archives disable it manually 3 files changed, 18 insertions(+) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index ff32bfd..5345dc2 100644 +index faf423c..52117a2 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16582,6 +16582,15 @@ msgstr "" +@@ -16605,6 +16605,15 @@ msgstr "" #: system/settings/rbp.xml msgctxt "#38010" msgid "GPU accelerated" @@ -179,7 +179,7 @@ index ff32bfd..5345dc2 100644 #. Setting #38011 "Videos -> Library -> Show All Items entry" diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 8f69bcb..cbcde85 100644 +index 3ef33e0..10e8552 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -304,6 +304,11 @@ @@ -224,10 +224,10 @@ index 5af92e7..568a1a8 100644 { // XBMC Smart playlist - just XML renamed to XSP // read the name of the playlist in -From e863fd0253902d92c56ed85e589bffadc98b245f Mon Sep 17 00:00:00 2001 +From 39ca696d7683f645fab217a4971e8f884f0f4bfc Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 27 Oct 2014 13:06:57 +0000 -Subject: [PATCH 08/58] [rbp] Make cachemembuffersize default depend on memory +Subject: [PATCH 08/87] [rbp] Make cachemembuffersize default depend on memory size --- @@ -329,10 +329,11 @@ index 2e3282c..d1606a2 100644 } -From 06bd0674846783738e6b81f351ba49bb633c473b Mon Sep 17 00:00:00 2001 + +From f9d47dcf9d04a28308404a77b516e28d57b97f2a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 30 May 2014 14:58:43 +0100 -Subject: [PATCH 10/58] [settings] Experiment: Report DESKTOP resolution in +Subject: [PATCH 10/87] [settings] Experiment: Report DESKTOP resolution in video settings --- @@ -354,10 +355,10 @@ index 4376463..fc4e5ea 100644 StringUtils::Format("%dx%d%s", resolution->width, resolution->height, ModeFlagsToString(resolution->flags, false).c_str()), -From c2b0eafa1ed07258aa09a24a443d4535db8b3a1e Mon Sep 17 00:00:00 2001 +From 76c5fd374e30835b61684da8a62ed6c6ddefa4cb Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 9 Sep 2014 12:04:26 +0100 -Subject: [PATCH 11/58] egl: Treat unknown display aspect ratio as square pixel +Subject: [PATCH 11/87] egl: Treat unknown display aspect ratio as square pixel --- xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 4 ++-- @@ -386,10 +387,10 @@ index bda7430..68fc647 100644 SetResolutionString(m_desktopRes); -From 5f1821e4d8157a890c795744841dcb895a1349b4 Mon Sep 17 00:00:00 2001 +From af06dc9a5a99bcf774a760bf46f88989ae03c6c4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 19 Sep 2014 11:54:49 +0100 -Subject: [PATCH 12/58] [dvdplayer/rbp] Add pi specific option to maintain +Subject: [PATCH 12/87] [dvdplayer/rbp] Add pi specific option to maintain vsync with pll adjustment New A/V sync option in settings/video/playback to do "Adjust PLL". @@ -414,7 +415,7 @@ Needed updated firmware 9 files changed, 91 insertions(+), 7 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 5345dc2..6d08156 100644 +index 52117a2..530b3d4 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -6321,7 +6321,22 @@ msgctxt "#13459" @@ -441,7 +442,7 @@ index 5345dc2..6d08156 100644 #: system/settings/settings.xml msgctxt "#13505" -@@ -16628,3 +16643,10 @@ msgstr "" +@@ -16651,3 +16666,10 @@ msgstr "" msgctxt "#38016" msgid "%d fps" msgstr "" @@ -453,7 +454,7 @@ index 5345dc2..6d08156 100644 +msgstr "" + diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index cbcde85..a3d4728 100644 +index 10e8552..f493675 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -572,6 +572,20 @@ @@ -681,10 +682,10 @@ index 7df1bf7..732b69d 100644 float m_audioPlayCountMinimumPercent; bool m_dvdplayerIgnoreDTSinWAV; -From 6ead5d132f5d43c6ea3063c5fcd1c7d3b23eca18 Mon Sep 17 00:00:00 2001 +From 855155cecdc39ff1586f84cec624bdbc1689ad41 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 24 Sep 2014 23:13:52 +0100 -Subject: [PATCH 13/58] [audio] Add settings option to boost centre channel +Subject: [PATCH 13/87] [audio] Add settings option to boost centre channel when downmixing This allows a dB volume increase to be added to centre channel. @@ -702,10 +703,10 @@ Should work with Pi Sink (dvdplayer/paplayer) and omxplayer 5 files changed, 45 insertions(+) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 6d08156..6e36b42 100644 +index 530b3d4..bedbd87 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16650,3 +16650,17 @@ msgctxt "#38006" +@@ -16673,3 +16673,17 @@ msgctxt "#38006" msgid "Audio has to stay in sync, this can either be done by resampling, or adjusting the PLL" msgstr "" @@ -724,7 +725,7 @@ index 6d08156..6e36b42 100644 +msgid "%i dB" +msgstr "" diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index a3d4728..09c3d10 100644 +index f493675..4843ab8 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -2597,6 +2597,18 @@ @@ -806,10 +807,10 @@ index f99c0e6..1911189 100644 // stereo upmix if (upmix && m_src_channels == 2 && m_dst_channels > 2) -From aca0d43f243143b6776e1cc8ef259197d2bee97a Mon Sep 17 00:00:00 2001 +From e46c99c1b4d75dd9f162d80c9cec1ebf1a8d3074 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 27 Oct 2014 15:23:51 +0000 -Subject: [PATCH 14/58] [rbp] Default extract thumbnails to false +Subject: [PATCH 14/87] [rbp] Default extract thumbnails to false It can take 80 seconds for a single file on a Pi. It can cause crashes with out-of-memory errors. It genereates a lot of support issues. Best to default to disabled and let users enable it if they must @@ -839,10 +840,1065 @@ index 50fe36a..a54a4c4 100644
-From 35f0f171ab8a9c37b2ebb5aca81b2242834fda72 Mon Sep 17 00:00:00 2001 +From b860125828104f62039468f8af95cd8b82fedaa5 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 10 Feb 2015 15:29:16 +0000 +Subject: [PATCH 15/87] [libcec] Add repeating keypress patch from popcornmix' + repo + +--- + tools/depends/target/libcec/Makefile | 1 + + tools/depends/target/libcec/popcornmix.patch | 859 +++++++++++++++++++++++++++ + 2 files changed, 860 insertions(+) + create mode 100644 tools/depends/target/libcec/popcornmix.patch + +diff --git a/tools/depends/target/libcec/Makefile b/tools/depends/target/libcec/Makefile +index f54af9e..ddf9963 100644 +--- a/tools/depends/target/libcec/Makefile ++++ b/tools/depends/target/libcec/Makefile +@@ -21,6 +21,7 @@ $(TARBALLS_LOCATION)/$(ARCHIVE): + $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) + rm -rf $(PLATFORM); mkdir -p $(PLATFORM)/build + cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) ++ cd $(PLATFORM); patch -p1 < ../popcornmix.patch + cd $(PLATFORM)/build; $(CMAKE) -DBUILD_SHARED_LIBS=1 -DSKIP_PYTHON_WRAPPER:STRING=1 -DCMAKE_INSTALL_LIBDIR=$(PREFIX)/lib .. + + $(LIBDYLIB): $(PLATFORM) +diff --git a/tools/depends/target/libcec/popcornmix.patch b/tools/depends/target/libcec/popcornmix.patch +new file mode 100644 +index 0000000..8366a69 +--- /dev/null ++++ b/tools/depends/target/libcec/popcornmix.patch +@@ -0,0 +1,859 @@ ++From ec982e9800ae312972d306b67779215a2add6cde Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Fri, 24 Oct 2014 13:45:21 +0100 ++Subject: [PATCH 1/6] Make released key polling wait for exact time until key ++ gets released ++ ++--- ++ src/libcec/CECClient.cpp | 16 ++++++++++++++-- ++ src/libcec/CECClient.h | 2 +- ++ src/libcec/CECProcessor.cpp | 8 +++++--- ++ src/libcec/LibCEC.cpp | 10 ++++++++-- ++ src/libcec/LibCEC.h | 4 +++- ++ 5 files changed, 31 insertions(+), 9 deletions(-) ++ ++diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp ++index 35c2d3e..e307c0e 100644 ++--- a/src/libcec/CECClient.cpp +++++ b/src/libcec/CECClient.cpp ++@@ -1067,7 +1067,7 @@ void CCECClient::SetCurrentButton(const cec_user_control_code iButtonCode) ++ AddKey(key); ++ } ++ ++-void CCECClient::CheckKeypressTimeout(void) +++uint16_t CCECClient::CheckKeypressTimeout(void) ++ { ++ cec_keypress key; ++ ++@@ -1091,12 +1091,24 @@ void CCECClient::CheckKeypressTimeout(void) ++ } ++ else ++ { ++- return; +++ // time when this keypress will be released and we'd like to be called again +++ unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; +++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) +++ timeout = iTimeoutMs - (iNow - m_buttontime) + 1; +++ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey) +++ timeout = CEC_BUTTON_TIMEOUT - (iNow - m_buttontime) + 1; +++ if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) +++ { +++ LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_buttontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); +++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; +++ } +++ return timeout; ++ } ++ } ++ ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key auto-released: %s (%1x)", ToString(key.keycode), key.keycode); ++ QueueAddKey(key); +++ return CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ } ++ ++ bool CCECClient::EnableCallbacks(void *cbParam, ICECCallbacks *callbacks) ++diff --git a/src/libcec/CECClient.h b/src/libcec/CECClient.h ++index 12f8a3b..c9ce5e3 100644 ++--- a/src/libcec/CECClient.h +++++ b/src/libcec/CECClient.h ++@@ -272,7 +272,7 @@ namespace CEC ++ virtual void AddKey(bool bSendComboKey = false); ++ virtual void AddKey(const cec_keypress &key); ++ virtual void SetCurrentButton(const cec_user_control_code iButtonCode); ++- virtual void CheckKeypressTimeout(void); +++ virtual uint16_t CheckKeypressTimeout(void); ++ virtual void SourceActivated(const cec_logical_address logicalAddress); ++ virtual void SourceDeactivated(const cec_logical_address logicalAddress); ++ ++diff --git a/src/libcec/CECProcessor.cpp b/src/libcec/CECProcessor.cpp ++index 99f71aa..604b950 100644 ++--- a/src/libcec/CECProcessor.cpp +++++ b/src/libcec/CECProcessor.cpp ++@@ -52,7 +52,6 @@ ++ using namespace CEC; ++ using namespace PLATFORM; ++ ++-#define CEC_PROCESSOR_SIGNAL_WAIT_TIME 1000 ++ #define ACTIVE_SOURCE_CHECK_INTERVAL 500 ++ #define TV_PRESENT_CHECK_INTERVAL 30000 ++ ++@@ -260,6 +259,7 @@ bool CCECProcessor::OnCommandReceived(const cec_command &command) ++ ++ void *CCECProcessor::Process(void) ++ { +++ uint16_t timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ m_libcec->AddLog(CEC_LOG_DEBUG, "processor thread started"); ++ ++ if (!m_connCheck) ++@@ -274,13 +274,13 @@ void *CCECProcessor::Process(void) ++ while (!IsStopped() && m_communication->IsOpen()) ++ { ++ // wait for a new incoming command, and process it ++- if (m_inBuffer.Pop(command, CEC_PROCESSOR_SIGNAL_WAIT_TIME)) +++ if (m_inBuffer.Pop(command, timeout)) ++ ProcessCommand(command); ++ ++ if (CECInitialised() && !IsStopped()) ++ { ++ // check clients for keypress timeouts ++- m_libcec->CheckKeypressTimeout(); +++ timeout = m_libcec->CheckKeypressTimeout(); ++ ++ // check if we need to replace handlers ++ ReplaceHandlers(); ++@@ -311,6 +311,8 @@ void *CCECProcessor::Process(void) ++ tvPresentCheck.Init(TV_PRESENT_CHECK_INTERVAL); ++ } ++ } +++ else +++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ } ++ ++ return NULL; ++diff --git a/src/libcec/LibCEC.cpp b/src/libcec/LibCEC.cpp ++index af36b79..5ccb8dd 100644 ++--- a/src/libcec/LibCEC.cpp +++++ b/src/libcec/LibCEC.cpp ++@@ -361,11 +361,17 @@ bool CLibCEC::IsValidPhysicalAddress(uint16_t iPhysicalAddress) ++ iPhysicalAddress <= CEC_MAX_PHYSICAL_ADDRESS; ++ } ++ ++-void CLibCEC::CheckKeypressTimeout(void) +++uint16_t CLibCEC::CheckKeypressTimeout(void) ++ { +++ uint16_t timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ // check all clients ++ for (std::vector::iterator it = m_clients.begin(); it != m_clients.end(); it++) ++- (*it)->CheckKeypressTimeout(); +++ { +++ uint16_t t = (*it)->CheckKeypressTimeout(); +++ if (t < timeout) +++ timeout = t; +++ } +++ return timeout; ++ } ++ ++ void CLibCEC::AddLog(const cec_log_level level, const char *strFormat, ...) ++diff --git a/src/libcec/LibCEC.h b/src/libcec/LibCEC.h ++index 6d9a229..d9d1e7b 100644 ++--- a/src/libcec/LibCEC.h +++++ b/src/libcec/LibCEC.h ++@@ -39,6 +39,8 @@ ++ #include "CECTypeUtils.h" ++ #include ++ +++#define CEC_PROCESSOR_SIGNAL_WAIT_TIME 1000 +++ ++ namespace CEC ++ { ++ class CAdapterCommunication; ++@@ -125,7 +127,7 @@ namespace CEC ++ ++ void AddLog(const cec_log_level level, const char *strFormat, ...); ++ void AddCommand(const cec_command &command); ++- void CheckKeypressTimeout(void); +++ uint16_t CheckKeypressTimeout(void); ++ void Alert(const libcec_alert type, const libcec_parameter ¶m); ++ ++ static bool IsValidPhysicalAddress(uint16_t iPhysicalAddress); ++-- ++1.9.1 ++ ++ ++From 41f0f3ec9ac136da3565c96fd5a7075499f3938d Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Fri, 24 Oct 2014 13:51:34 +0100 ++Subject: [PATCH 2/6] Keep track of time since initial button press and last ++ button update ++ ++--- ++ src/libcec/CECClient.cpp | 44 +++++++++++++++++++++++++++----------------- ++ src/libcec/CECClient.h | 3 ++- ++ 2 files changed, 29 insertions(+), 18 deletions(-) ++ ++diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp ++index e307c0e..e7935b9 100644 ++--- a/src/libcec/CECClient.cpp +++++ b/src/libcec/CECClient.cpp ++@@ -54,7 +54,8 @@ CCECClient::CCECClient(CCECProcessor *processor, const libcec_configuration &con ++ m_bInitialised(false), ++ m_bRegistered(false), ++ m_iCurrentButton(CEC_USER_CONTROL_CODE_UNKNOWN), ++- m_buttontime(0), +++ m_initialButtontime(0), +++ m_updateButtontime(0), ++ m_iPreventForwardingPowerOffCommand(0), ++ m_iLastKeypressTime(0) ++ { ++@@ -981,9 +982,10 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */) ++ CLockObject lock(m_mutex); ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN) ++ { ++- key.duration = (unsigned int) (GetTimeMs() - m_buttontime); +++ unsigned int duration = (unsigned int) (GetTimeMs() - m_updateButtontime); +++ key.duration = (unsigned int) (GetTimeMs() - m_initialButtontime); ++ ++- if (key.duration > m_configuration.iComboKeyTimeoutMs || +++ if (duration > m_configuration.iComboKeyTimeoutMs || ++ m_configuration.iComboKeyTimeoutMs == 0 || ++ m_iCurrentButton != m_configuration.comboKey || ++ bSendComboKey) ++@@ -991,14 +993,15 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */) ++ key.keycode = m_iCurrentButton; ++ ++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; ++- m_buttontime = 0; +++ m_initialButtontime = 0; +++ m_updateButtontime = 0; ++ } ++ } ++ } ++ ++ if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) ++ { ++- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key released: %s (%1x)", ToString(key.keycode), key.keycode); +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key released: %s (%1x) D:%dms", ToString(key.keycode), key.keycode, key.duration); ++ QueueAddKey(key); ++ } ++ } ++@@ -1012,7 +1015,7 @@ void CCECClient::AddKey(const cec_keypress &key) ++ AddKey(); ++ return; ++ } ++- +++ bool isrepeat = false; ++ cec_keypress transmitKey(key); ++ cec_user_control_code comboKey(m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5) ? ++ m_configuration.comboKey : CEC_USER_CONTROL_CODE_STOP); ++@@ -1035,22 +1038,27 @@ void CCECClient::AddKey(const cec_keypress &key) ++ AddKey(true); ++ } ++ +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x) current(%lx) duration(%d)", ToString(transmitKey.keycode), transmitKey.keycode, m_iCurrentButton, key.duration); +++ ++ if (m_iCurrentButton == key.keycode) ++ { ++- m_buttontime = GetTimeMs(); +++ m_updateButtontime = GetTimeMs(); +++ isrepeat = true; ++ } ++ else ++ { ++- AddKey(); +++ if (m_iCurrentButton != transmitKey.keycode) +++ AddKey(); ++ if (key.duration == 0) ++ { ++ m_iCurrentButton = transmitKey.keycode; ++- m_buttontime = m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN || key.duration > 0 ? 0 : GetTimeMs(); +++ m_initialButtontime = m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN || key.duration > 0 ? 0 : GetTimeMs(); +++ m_updateButtontime = m_initialButtontime; ++ } ++ } ++ } ++ ++- if (key.keycode != comboKey || key.duration > 0) +++ if (!isrepeat && (key.keycode != comboKey || key.duration > 0)) ++ { ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x)", ToString(transmitKey.keycode), transmitKey.keycode); ++ QueueAddKey(transmitKey); ++@@ -1074,32 +1082,34 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ { ++ CLockObject lock(m_mutex); ++ uint64_t iNow = GetTimeMs(); +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s T:%.3f", __FUNCTION__, iNow*1e-3); ++ cec_user_control_code comboKey(m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5) ? ++ m_configuration.comboKey : CEC_USER_CONTROL_CODE_STOP); ++ uint32_t iTimeoutMs(m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5) ? ++ m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); ++ ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++- ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_buttontime > iTimeoutMs) || ++- (m_iCurrentButton != comboKey && iNow - m_buttontime > CEC_BUTTON_TIMEOUT))) +++ ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime > iTimeoutMs) || +++ (m_iCurrentButton != comboKey && iNow - m_updateButtontime > CEC_BUTTON_TIMEOUT))) ++ { ++- key.duration = (unsigned int) (iNow - m_buttontime); +++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = m_iCurrentButton; ++ ++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; ++- m_buttontime = 0; +++ m_initialButtontime = 0; +++ m_updateButtontime = 0; ++ } ++ else ++ { ++ // time when this keypress will be released and we'd like to be called again ++ unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) ++- timeout = iTimeoutMs - (iNow - m_buttontime) + 1; +++ timeout = iTimeoutMs - (iNow - m_updateButtontime) + 1; ++ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey) ++- timeout = CEC_BUTTON_TIMEOUT - (iNow - m_buttontime) + 1; +++ timeout = CEC_BUTTON_TIMEOUT - (iNow - m_updateButtontime) + 1; ++ if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) ++ { ++- LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_buttontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); +++ LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_updateButtontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); ++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ } ++ return timeout; ++diff --git a/src/libcec/CECClient.h b/src/libcec/CECClient.h ++index c9ce5e3..611c68b 100644 ++--- a/src/libcec/CECClient.h +++++ b/src/libcec/CECClient.h ++@@ -404,7 +404,8 @@ namespace CEC ++ PLATFORM::CMutex m_mutex; /**< mutex for changes to this instance */ ++ PLATFORM::CMutex m_cbMutex; /**< mutex that is held when doing anything with callbacks */ ++ cec_user_control_code m_iCurrentButton; /**< the control code of the button that's currently held down (if any) */ ++- int64_t m_buttontime; /**< the timestamp when the button was pressed (in seconds since epoch), or 0 if none was pressed. */ +++ int64_t m_initialButtontime; /**< the timestamp when the button was initially pressed (in seconds since epoch), or 0 if none was pressed. */ +++ int64_t m_updateButtontime; /**< the timestamp when the button was updated (in seconds since epoch), or 0 if none was pressed. */ ++ int64_t m_iPreventForwardingPowerOffCommand; /**< prevent forwarding standby commands until this time */ ++ int64_t m_iLastKeypressTime; /**< last time a key press was sent to the client */ ++ cec_keypress m_lastKeypress; /**< the last key press that was sent to the client */ ++-- ++1.9.1 ++ ++ ++From 273ead6980b69eddf98810eb1eb33d94a7d74fce Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Tue, 28 Oct 2014 00:09:18 +0000 ++Subject: [PATCH 3/6] Support repeating button presses with configurable repeat ++ rate ++ ++--- ++ include/cectypes.h | 6 ++ ++ src/libcec/CECClient.cpp | 100 +++++++++++++++++++---- ++ src/libcec/CECClient.h | 6 +- ++ src/libcec/implementations/CECCommandHandler.cpp | 2 +- ++ 4 files changed, 96 insertions(+), 18 deletions(-) ++ ++diff --git a/include/cectypes.h b/include/cectypes.h ++index acff259..8f098ef 100644 ++--- a/include/cectypes.h +++++ b/include/cectypes.h ++@@ -1493,6 +1493,8 @@ struct libcec_configuration ++ XXX changed meaning in 2.2.0 to not break binary compatibility. next major (3.0) release will fix it in a nicer way */ ++ cec_user_control_code comboKey; /*!< key code that initiates combo keys. defaults to CEC_USER_CONTROL_CODE_F1_BLUE. CEC_USER_CONTROL_CODE_UNKNOWN to disable. added in 2.0.5 */ ++ uint32_t iComboKeyTimeoutMs; /*!< timeout until the combo key is sent as normal keypress */ +++ uint32_t iButtonRepeatRateMs; /*!< rate at which buttons autorepeat. 0 means rely on CEC device */ +++ uint32_t iButtonReleaseDelayMs;/*!< duration after last update until a button is considered released */ ++ ++ #ifdef __cplusplus ++ libcec_configuration(void) { Clear(); } ++@@ -1527,6 +1529,8 @@ struct libcec_configuration ++ cecVersion == other.cecVersion && ++ adapterType == other.adapterType && ++ iDoubleTapTimeout50Ms == other.iDoubleTapTimeout50Ms && +++ iButtonRepeatRateMs == other.iButtonRepeatRateMs && +++ iButtonReleaseDelayMs == other.iButtonReleaseDelayMs && ++ (other.clientVersion <= LIBCEC_VERSION_TO_UINT(2, 0, 4) || comboKey == other.comboKey) && ++ (other.clientVersion <= LIBCEC_VERSION_TO_UINT(2, 0, 4) || iComboKeyTimeoutMs == other.iComboKeyTimeoutMs) && ++ (other.clientVersion < LIBCEC_VERSION_TO_UINT(2, 1, 0) || bPowerOnScreensaver == other.bPowerOnScreensaver)); ++@@ -1567,6 +1571,8 @@ struct libcec_configuration ++ iDoubleTapTimeout50Ms = CEC_DOUBLE_TAP_TIMEOUT_50_MS; ++ comboKey = CEC_USER_CONTROL_CODE_STOP; ++ iComboKeyTimeoutMs = CEC_DEFAULT_COMBO_TIMEOUT_MS; +++ iButtonRepeatRateMs = 0; +++ iButtonReleaseDelayMs = CEC_BUTTON_TIMEOUT; ++ ++ memset(strDeviceName, 0, 13); ++ deviceTypes.Clear(); ++diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp ++index e7935b9..598628d 100644 ++--- a/src/libcec/CECClient.cpp +++++ b/src/libcec/CECClient.cpp ++@@ -56,6 +56,10 @@ CCECClient::CCECClient(CCECProcessor *processor, const libcec_configuration &con ++ m_iCurrentButton(CEC_USER_CONTROL_CODE_UNKNOWN), ++ m_initialButtontime(0), ++ m_updateButtontime(0), +++ m_repeatButtontime(0), +++ m_releaseButtontime(0), +++ m_pressedButtoncount(0), +++ m_releasedButtoncount(0), ++ m_iPreventForwardingPowerOffCommand(0), ++ m_iLastKeypressTime(0) ++ { ++@@ -851,6 +855,9 @@ bool CCECClient::GetCurrentConfiguration(libcec_configuration &configuration) ++ configuration.bMonitorOnly = m_configuration.bMonitorOnly; ++ configuration.cecVersion = m_configuration.cecVersion; ++ configuration.adapterType = m_configuration.adapterType; +++ configuration.iDoubleTapTimeout50Ms = m_configuration.iDoubleTapTimeout50Ms; +++ configuration.iButtonRepeatRateMs = m_configuration.iButtonRepeatRateMs; +++ configuration.iButtonReleaseDelayMs = m_configuration.iButtonReleaseDelayMs; ++ ++ return true; ++ } ++@@ -894,6 +901,9 @@ bool CCECClient::SetConfiguration(const libcec_configuration &configuration) ++ m_configuration.cecVersion = configuration.cecVersion; ++ m_configuration.adapterType = configuration.adapterType; ++ m_configuration.iDoubleTapTimeout50Ms = configuration.iDoubleTapTimeout50Ms; +++ m_configuration.iButtonRepeatRateMs = configuration.iButtonRepeatRateMs; +++ m_configuration.iButtonReleaseDelayMs = configuration.iButtonReleaseDelayMs; +++ ++ m_configuration.deviceTypes.Add(configuration.deviceTypes[0]); ++ ++ if (m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5)) ++@@ -950,6 +960,7 @@ bool CCECClient::SetConfiguration(const libcec_configuration &configuration) ++ primary->ActivateSource(); ++ } ++ +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s: %d:%d:%d", __FUNCTION__, DoubleTapTimeoutMS(), m_configuration.iButtonRepeatRateMs, m_configuration.iButtonReleaseDelayMs); ++ return true; ++ } ++ ++@@ -973,11 +984,15 @@ void CCECClient::AddCommand(const cec_command &command) ++ } ++ } ++ ++-void CCECClient::AddKey(bool bSendComboKey /* = false */) +++void CCECClient::AddKey(bool bSendComboKey /* = false */, bool bButtonRelease /* = false */) ++ { ++ cec_keypress key; ++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++ +++ // we ignore button releases when supporting repeating keys +++ if (bButtonRelease && m_configuration.iButtonRepeatRateMs && m_configuration.iButtonReleaseDelayMs) +++ return; +++ ++ { ++ CLockObject lock(m_mutex); ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN) ++@@ -995,6 +1010,10 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */) ++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; ++ m_initialButtontime = 0; ++ m_updateButtontime = 0; +++ m_repeatButtontime = 0; +++ m_releaseButtontime = 0; +++ m_pressedButtoncount = 0; +++ m_releasedButtoncount = 0; ++ } ++ } ++ } ++@@ -1012,6 +1031,7 @@ void CCECClient::AddKey(const cec_keypress &key) ++ key.keycode < CEC_USER_CONTROL_CODE_SELECT) ++ { ++ // send back the previous key if there is one +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Unexpected key %s (%1x) D:%dms", ToString(key.keycode), key.keycode, key.duration); ++ AddKey(); ++ return; ++ } ++@@ -1035,7 +1055,10 @@ void CCECClient::AddKey(const cec_keypress &key) ++ transmitKey.keycode = CEC_USER_CONTROL_CODE_DOT; ++ // default, send back the previous key ++ else +++ { +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Combo key %s (%1x) D%dms:", ToString(key.keycode), key.keycode, key.duration); ++ AddKey(true); +++ } ++ } ++ ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x) current(%lx) duration(%d)", ToString(transmitKey.keycode), transmitKey.keycode, m_iCurrentButton, key.duration); ++@@ -1043,17 +1066,44 @@ void CCECClient::AddKey(const cec_keypress &key) ++ if (m_iCurrentButton == key.keycode) ++ { ++ m_updateButtontime = GetTimeMs(); ++- isrepeat = true; +++ m_releaseButtontime = m_updateButtontime + (m_configuration.iButtonReleaseDelayMs ? m_configuration.iButtonReleaseDelayMs : CEC_BUTTON_TIMEOUT); +++ // want to have seen some updated before considering a repeat +++ if (m_configuration.iButtonRepeatRateMs) +++ { +++ if (!m_repeatButtontime && m_pressedButtoncount > 1) +++ m_repeatButtontime = m_initialButtontime + DoubleTapTimeoutMS(); +++ isrepeat = true; +++ } +++ m_pressedButtoncount++; ++ } ++ else ++ { ++ if (m_iCurrentButton != transmitKey.keycode) +++ { +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Changed key %s (%1x) D:%dms cur:%lx", ToString(transmitKey.keycode), transmitKey.keycode, transmitKey.duration, m_iCurrentButton); ++ AddKey(); +++ } ++ if (key.duration == 0) ++ { ++ m_iCurrentButton = transmitKey.keycode; ++- m_initialButtontime = m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN || key.duration > 0 ? 0 : GetTimeMs(); ++- m_updateButtontime = m_initialButtontime; +++ if (m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN) +++ { +++ m_initialButtontime = 0; +++ m_updateButtontime = 0; +++ m_repeatButtontime = 0; +++ m_releaseButtontime = 0; +++ m_pressedButtoncount = 0; +++ m_releasedButtoncount = 0; +++ } +++ else +++ { +++ m_initialButtontime = GetTimeMs(); +++ m_updateButtontime = m_initialButtontime; +++ m_repeatButtontime = 0; // set this on next update +++ m_releaseButtontime = m_initialButtontime + (m_configuration.iButtonReleaseDelayMs ? m_configuration.iButtonReleaseDelayMs : CEC_BUTTON_TIMEOUT); +++ m_pressedButtoncount = 1; +++ m_releasedButtoncount = 0; +++ } ++ } ++ } ++ } ++@@ -1072,12 +1122,16 @@ void CCECClient::SetCurrentButton(const cec_user_control_code iButtonCode) ++ key.duration = 0; ++ key.keycode = iButtonCode; ++ +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "SetCurrentButton %s (%1x) D:%dms cur:%lx", ToString(key.keycode), key.keycode, key.duration); ++ AddKey(key); ++ } ++ ++ uint16_t CCECClient::CheckKeypressTimeout(void) ++ { +++ // time when we'd like to be called again +++ unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ cec_keypress key; +++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++ ++ { ++ CLockObject lock(m_mutex); ++@@ -1089,8 +1143,8 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); ++ ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++- ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime > iTimeoutMs) || ++- (m_iCurrentButton != comboKey && iNow - m_updateButtontime > CEC_BUTTON_TIMEOUT))) +++ ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) || +++ (m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime))) ++ { ++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = m_iCurrentButton; ++@@ -1098,27 +1152,41 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; ++ m_initialButtontime = 0; ++ m_updateButtontime = 0; +++ m_repeatButtontime = 0; +++ m_releaseButtontime = 0; +++ m_pressedButtoncount = 0; +++ m_releasedButtoncount = 0; +++ } +++ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && +++ (m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime)) +++ { +++ key.duration = 0; +++ key.keycode = m_iCurrentButton; +++ m_repeatButtontime = iNow + m_configuration.iButtonRepeatRateMs; +++ timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); ++ } ++ else ++ { ++- // time when this keypress will be released and we'd like to be called again ++- unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) ++- timeout = iTimeoutMs - (iNow - m_updateButtontime) + 1; ++- else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey) ++- timeout = CEC_BUTTON_TIMEOUT - (iNow - m_updateButtontime) + 1; +++ timeout = std::min((uint64_t)timeout, m_updateButtontime - iNow + iTimeoutMs); +++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey && m_releaseButtontime) +++ timeout = std::min((uint64_t)timeout, m_releaseButtontime - iNow); +++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey && m_repeatButtontime) +++ timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); ++ if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) ++ { ++- LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_updateButtontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); +++ LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_updateButtontime*1e-3, m_releaseButtontime*1e-3, m_iCurrentButton); ++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ } ++- return timeout; ++ } +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key %s: %s (%1x) timeout:%dms (rel:%d,rep:%d,prs:%d,rel:%d)", key.keycode == CEC_USER_CONTROL_CODE_UNKNOWN ? "idle" : key.duration ? "released" : "repeated", +++ ToString(m_iCurrentButton), m_iCurrentButton, timeout, (int)(m_releaseButtontime ? m_releaseButtontime - iNow : 0), (int)(m_repeatButtontime ? m_repeatButtontime - iNow : 0), m_pressedButtoncount, m_releasedButtoncount); ++ } ++ ++- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key auto-released: %s (%1x)", ToString(key.keycode), key.keycode); ++- QueueAddKey(key); ++- return CEC_PROCESSOR_SIGNAL_WAIT_TIME; +++ if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) +++ QueueAddKey(key); +++ +++ return timeout; ++ } ++ ++ bool CCECClient::EnableCallbacks(void *cbParam, ICECCallbacks *callbacks) ++diff --git a/src/libcec/CECClient.h b/src/libcec/CECClient.h ++index 611c68b..adeb5af 100644 ++--- a/src/libcec/CECClient.h +++++ b/src/libcec/CECClient.h ++@@ -269,7 +269,7 @@ namespace CEC ++ // callbacks ++ virtual void Alert(const libcec_alert type, const libcec_parameter ¶m) { QueueAlert(type, param); } ++ virtual void AddLog(const cec_log_message &message) { QueueAddLog(message); } ++- virtual void AddKey(bool bSendComboKey = false); +++ virtual void AddKey(bool bSendComboKey = false, bool bButtonRelease = false); ++ virtual void AddKey(const cec_keypress &key); ++ virtual void SetCurrentButton(const cec_user_control_code iButtonCode); ++ virtual uint16_t CheckKeypressTimeout(void); ++@@ -406,6 +406,10 @@ namespace CEC ++ cec_user_control_code m_iCurrentButton; /**< the control code of the button that's currently held down (if any) */ ++ int64_t m_initialButtontime; /**< the timestamp when the button was initially pressed (in seconds since epoch), or 0 if none was pressed. */ ++ int64_t m_updateButtontime; /**< the timestamp when the button was updated (in seconds since epoch), or 0 if none was pressed. */ +++ int64_t m_repeatButtontime; /**< the timestamp when the button will next repeat (in seconds since epoch), or 0 if repeat is disabled. */ +++ int64_t m_releaseButtontime; /**< the timestamp when the button will be released (in seconds since epoch), or 0 if none was pressed. */ +++ int32_t m_pressedButtoncount; /**< the number of times a button released message has been seen for this press. */ +++ int32_t m_releasedButtoncount; /**< the number of times a button pressed message has been seen for this press. */ ++ int64_t m_iPreventForwardingPowerOffCommand; /**< prevent forwarding standby commands until this time */ ++ int64_t m_iLastKeypressTime; /**< last time a key press was sent to the client */ ++ cec_keypress m_lastKeypress; /**< the last key press that was sent to the client */ ++diff --git a/src/libcec/implementations/CECCommandHandler.cpp b/src/libcec/implementations/CECCommandHandler.cpp ++index 6d6244e..d64186f 100644 ++--- a/src/libcec/implementations/CECCommandHandler.cpp +++++ b/src/libcec/implementations/CECCommandHandler.cpp ++@@ -770,7 +770,7 @@ int CCECCommandHandler::HandleUserControlRelease(const cec_command &command) ++ ++ CECClientPtr client = m_processor->GetClient(command.destination); ++ if (client) ++- client->AddKey(); +++ client->AddKey(false, true); ++ ++ return COMMAND_HANDLED; ++ } ++-- ++1.9.1 ++ ++ ++From 3336d0827f7fd159430f3431642b07090c06c869 Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Tue, 28 Oct 2014 01:21:35 +0000 ++Subject: [PATCH 4/6] Skip double press removal. It is handled through other ++ means. ++ ++--- ++ src/libcec/CECClient.cpp | 18 +----------------- ++ src/libcec/CECClient.h | 2 -- ++ 2 files changed, 1 insertion(+), 19 deletions(-) ++ ++diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp ++index 598628d..dccd874 100644 ++--- a/src/libcec/CECClient.cpp +++++ b/src/libcec/CECClient.cpp ++@@ -60,11 +60,8 @@ CCECClient::CCECClient(CCECProcessor *processor, const libcec_configuration &con ++ m_releaseButtontime(0), ++ m_pressedButtoncount(0), ++ m_releasedButtoncount(0), ++- m_iPreventForwardingPowerOffCommand(0), ++- m_iLastKeypressTime(0) +++ m_iPreventForwardingPowerOffCommand(0) ++ { ++- m_lastKeypress.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++- m_lastKeypress.duration = 0; ++ m_configuration.Clear(); ++ // set the initial configuration ++ SetConfiguration(configuration); ++@@ -1647,20 +1644,7 @@ void CCECClient::CallbackAddKey(const cec_keypress &key) ++ { ++ CLockObject lock(m_cbMutex); ++ if (m_configuration.callbacks && m_configuration.callbacks->CBCecKeyPress) ++- { ++- // prevent double taps ++- int64_t now = GetTimeMs(); ++- if (m_lastKeypress.keycode != key.keycode || ++- key.duration > 0 || ++- now - m_iLastKeypressTime >= DoubleTapTimeoutMS()) ++- { ++- // no double tap ++- if (key.duration == 0) ++- m_iLastKeypressTime = now; ++- m_lastKeypress = key; ++ m_configuration.callbacks->CBCecKeyPress(m_configuration.callbackParam, key); ++- } ++- } ++ } ++ ++ void CCECClient::CallbackAddLog(const cec_log_message &message) ++diff --git a/src/libcec/CECClient.h b/src/libcec/CECClient.h ++index adeb5af..43a713b 100644 ++--- a/src/libcec/CECClient.h +++++ b/src/libcec/CECClient.h ++@@ -411,8 +411,6 @@ namespace CEC ++ int32_t m_pressedButtoncount; /**< the number of times a button released message has been seen for this press. */ ++ int32_t m_releasedButtoncount; /**< the number of times a button pressed message has been seen for this press. */ ++ int64_t m_iPreventForwardingPowerOffCommand; /**< prevent forwarding standby commands until this time */ ++- int64_t m_iLastKeypressTime; /**< last time a key press was sent to the client */ ++- cec_keypress m_lastKeypress; /**< the last key press that was sent to the client */ ++ PLATFORM::SyncedBuffer m_callbackCalls; ++ }; ++ } ++-- ++1.9.1 ++ ++ ++From 0dd0234f620a546bfa843172648383f83d88088c Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Mon, 3 Nov 2014 23:28:04 +0000 ++Subject: [PATCH 5/6] Pass through duration on all button repeats ++ ++--- ++ src/libcec/CECClient.cpp | 34 ++++++++++++++++++++++++---------- ++ 1 file changed, 24 insertions(+), 10 deletions(-) ++ ++diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp ++index dccd874..1946148 100644 ++--- a/src/libcec/CECClient.cpp +++++ b/src/libcec/CECClient.cpp ++@@ -986,10 +986,6 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */, bool bButtonRelease /* ++ cec_keypress key; ++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++ ++- // we ignore button releases when supporting repeating keys ++- if (bButtonRelease && m_configuration.iButtonRepeatRateMs && m_configuration.iButtonReleaseDelayMs) ++- return; ++- ++ { ++ CLockObject lock(m_mutex); ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN) ++@@ -1015,6 +1011,10 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */, bool bButtonRelease /* ++ } ++ } ++ +++ // we don't forward releases when supporting repeating keys +++ if (bButtonRelease && m_configuration.iButtonRepeatRateMs) +++ return; +++ ++ if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) ++ { ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key released: %s (%1x) D:%dms", ToString(key.keycode), key.keycode, key.duration); ++@@ -1107,7 +1107,7 @@ void CCECClient::AddKey(const cec_keypress &key) ++ ++ if (!isrepeat && (key.keycode != comboKey || key.duration > 0)) ++ { ++- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x)", ToString(transmitKey.keycode), transmitKey.keycode); +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x, %d)", ToString(transmitKey.keycode), transmitKey.keycode, transmitKey.duration); ++ QueueAddKey(transmitKey); ++ } ++ } ++@@ -1129,6 +1129,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ cec_keypress key; ++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; +++ key.duration = 0; ++ ++ { ++ CLockObject lock(m_mutex); ++@@ -1140,8 +1141,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); ++ ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++- ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) || ++- (m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime))) +++ m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) ++ { ++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = m_iCurrentButton; ++@@ -1155,9 +1155,23 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ m_releasedButtoncount = 0; ++ } ++ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && +++ m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime) +++ { +++ key.duration = (unsigned int) (iNow - m_initialButtontime); +++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; +++ +++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; +++ m_initialButtontime = 0; +++ m_updateButtontime = 0; +++ m_repeatButtontime = 0; +++ m_releaseButtontime = 0; +++ m_pressedButtoncount = 0; +++ m_releasedButtoncount = 0; +++ } +++ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++ (m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime)) ++ { ++- key.duration = 0; +++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = m_iCurrentButton; ++ m_repeatButtontime = iNow + m_configuration.iButtonRepeatRateMs; ++ timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); ++@@ -1176,8 +1190,8 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ } ++ } ++- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key %s: %s (%1x) timeout:%dms (rel:%d,rep:%d,prs:%d,rel:%d)", key.keycode == CEC_USER_CONTROL_CODE_UNKNOWN ? "idle" : key.duration ? "released" : "repeated", ++- ToString(m_iCurrentButton), m_iCurrentButton, timeout, (int)(m_releaseButtontime ? m_releaseButtontime - iNow : 0), (int)(m_repeatButtontime ? m_repeatButtontime - iNow : 0), m_pressedButtoncount, m_releasedButtoncount); +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Key %s: %s (duration:%d) (%1x) timeout:%dms (rel:%d,rep:%d,prs:%d,rel:%d)", ToString(m_iCurrentButton), key.keycode == CEC_USER_CONTROL_CODE_UNKNOWN ? "idle" : m_repeatButtontime ? "repeated" : "released", key.duration, +++ m_iCurrentButton, timeout, (int)(m_releaseButtontime ? m_releaseButtontime - iNow : 0), (int)(m_repeatButtontime ? m_repeatButtontime - iNow : 0), m_pressedButtoncount, m_releasedButtoncount); ++ } ++ ++ if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) ++-- ++1.9.1 ++ ++ ++From 1ea01f59d8186d4d53af41961aaccbbc11651115 Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Wed, 5 Nov 2014 21:04:25 +0000 ++Subject: [PATCH 6/6] squash: Fix for stop needing to be pressed twice ++ ++--- ++ src/libcec/CECClient.cpp | 17 ++++++++--------- ++ 1 file changed, 8 insertions(+), 9 deletions(-) ++ ++diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp ++index 1946148..f4f114b 100644 ++--- a/src/libcec/CECClient.cpp +++++ b/src/libcec/CECClient.cpp ++@@ -1131,6 +1131,8 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++ key.duration = 0; ++ +++ if (m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN) +++ return timeout; ++ { ++ CLockObject lock(m_mutex); ++ uint64_t iNow = GetTimeMs(); ++@@ -1140,8 +1142,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ uint32_t iTimeoutMs(m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5) ? ++ m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); ++ ++- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++- m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) +++ if (m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) ++ { ++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = m_iCurrentButton; ++@@ -1154,8 +1155,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ m_pressedButtoncount = 0; ++ m_releasedButtoncount = 0; ++ } ++- else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++- m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime) +++ else if (m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime) ++ { ++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++@@ -1168,8 +1168,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ m_pressedButtoncount = 0; ++ m_releasedButtoncount = 0; ++ } ++- else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++- (m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime)) +++ else if (m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime) ++ { ++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = m_iCurrentButton; ++@@ -1178,11 +1177,11 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ } ++ else ++ { ++- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) +++ if (m_iCurrentButton == comboKey && iTimeoutMs > 0) ++ timeout = std::min((uint64_t)timeout, m_updateButtontime - iNow + iTimeoutMs); ++- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey && m_releaseButtontime) +++ if (m_iCurrentButton != comboKey && m_releaseButtontime) ++ timeout = std::min((uint64_t)timeout, m_releaseButtontime - iNow); ++- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey && m_repeatButtontime) +++ if (m_iCurrentButton != comboKey && m_repeatButtontime) ++ timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); ++ if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) ++ { ++-- ++1.9.1 ++ + +From b55caa265c7481aaf12c99eaa3e051197492a16b Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 28 Oct 2014 00:19:40 +0000 +Subject: [PATCH 16/87] [cec] Add settings for configuring button repeats + +--- + addons/resource.language.en_gb/resources/strings.po | 15 +++++++++++++++ + system/peripherals.xml | 4 +++- + xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 16 ++++++++++++++++ + 3 files changed, 34 insertions(+), 1 deletion(-) + +diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po +index bedbd87..6db61ed 100644 +--- a/addons/resource.language.en_gb/resources/strings.po ++++ b/addons/resource.language.en_gb/resources/strings.po +@@ -16687,3 +16687,18 @@ msgstr "" + msgctxt "#38009" + msgid "%i dB" + msgstr "" ++ ++#: system/peripherals.xml ++msgctxt "#38050" ++msgid "Remote button press delay before repeating (ms)" ++msgstr "" ++ ++#: system/peripherals.xml ++msgctxt "#38051" ++msgid "Remote button press repeat rate (ms)" ++msgstr "" ++ ++#: system/peripherals.xml ++msgctxt "#38052" ++msgid "Remote button press release time (ms)" ++msgstr "" +diff --git a/system/peripherals.xml b/system/peripherals.xml +index a67dc2f..6841bda 100644 +--- a/system/peripherals.xml ++++ b/system/peripherals.xml +@@ -30,7 +30,9 @@ + + + +- ++ ++ ++ + + + +diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +index ea702e5..b5ff693 100644 +--- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp ++++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +@@ -1267,6 +1267,20 @@ void CPeripheralCecAdapter::SetConfigurationFromLibCEC(const CEC::libcec_configu + m_configuration.bSendInactiveSource = config.bSendInactiveSource; + bChanged |= SetSetting("send_inactive_source", m_configuration.bSendInactiveSource == 1); + ++#if defined(CEC_DOUBLE_TAP_TIMEOUT_MS_OLD) ++ m_configuration.iDoubleTapTimeout50Ms = config.iDoubleTapTimeout50Ms; ++ bChanged |= SetSetting("double_tap_timeout_ms", (int)m_configuration.iDoubleTapTimeout50Ms * 50); ++#else ++ m_configuration.iDoubleTapTimeoutMs = config.iDoubleTapTimeoutMs; ++ bChanged |= SetSetting("double_tap_timeout_ms", (int)m_configuration.iDoubleTapTimeoutMs; ++#endif ++ ++ m_configuration.iButtonRepeatRateMs = config.iButtonRepeatRateMs; ++ bChanged |= SetSetting("button_repeat_rate_ms", (int)m_configuration.iButtonRepeatRateMs); ++ ++ m_configuration.iButtonReleaseDelayMs = config.iButtonReleaseDelayMs; ++ bChanged |= SetSetting("button_release_delay_ms", (int)m_configuration.iButtonReleaseDelayMs); ++ + m_configuration.iFirmwareVersion = config.iFirmwareVersion; + m_configuration.bShutdownOnStandby = config.bShutdownOnStandby; + +@@ -1371,6 +1385,8 @@ void CPeripheralCecAdapter::SetConfigurationFromSettings(void) + // backwards compatibility. will be removed once the next major release of libCEC is out + m_configuration.iDoubleTapTimeoutMs = GetSettingInt("double_tap_timeout_ms"); + #endif ++ m_configuration.iButtonRepeatRateMs = GetSettingInt("button_repeat_rate_ms"); ++ m_configuration.iButtonReleaseDelayMs = GetSettingInt("button_release_delay_ms"); + } + + void CPeripheralCecAdapter::ReadLogicalAddresses(const std::string &strString, cec_logical_addresses &addresses) + +From f8b7ec7f762de88902378187148e437589c09e8c Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 3 Nov 2014 23:17:46 +0000 +Subject: [PATCH 17/87] [cec] Don't discard buttons when repeat mode is enabled + +--- + xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +index b5ff693..6086bf5 100644 +--- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp ++++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +@@ -767,7 +767,10 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) + CLog::Log(LOGDEBUG, "%s - received key %2x duration %d", __FUNCTION__, key.iButton, key.iDuration); + + CSingleLock lock(m_critSection); +- if (key.iDuration > 0) ++ // avoid the queue getting too long ++ if (m_configuration.iButtonRepeatRateMs && m_buttonQueue.size() > 5) ++ return; ++ if (m_configuration.iButtonRepeatRateMs == 0 && key.iDuration > 0) + { + if (m_currentButton.iButton == key.iButton && m_currentButton.iDuration == 0) + { + +From d36c6702a3f695ba90ab7bc60498a57f32c6eff2 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 4 Nov 2014 18:50:00 +0000 +Subject: [PATCH 18/87] [cec] Temp - more logging + +--- + xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +index 6086bf5..417b0d8 100644 +--- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp ++++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +@@ -764,12 +764,15 @@ void CPeripheralCecAdapter::GetNextKey(void) + + void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) + { +- CLog::Log(LOGDEBUG, "%s - received key %2x duration %d", __FUNCTION__, key.iButton, key.iDuration); ++ CLog::Log(LOGDEBUG, "%s - received key %2x duration %d (rep:%d size:%d)", __FUNCTION__, key.iButton, key.iDuration, m_configuration.iButtonRepeatRateMs, m_buttonQueue.size()); + + CSingleLock lock(m_critSection); + // avoid the queue getting too long + if (m_configuration.iButtonRepeatRateMs && m_buttonQueue.size() > 5) ++ { ++ CLog::Log(LOGDEBUG, "%s - discarded key %2x", __FUNCTION__, key.iButton); + return; ++ } + if (m_configuration.iButtonRepeatRateMs == 0 && key.iDuration > 0) + { + if (m_currentButton.iButton == key.iButton && m_currentButton.iDuration == 0) +@@ -778,6 +781,7 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) + if (m_bHasButton) + m_currentButton.iDuration = key.iDuration; + // ignore this one, since it's already been handled by xbmc ++ CLog::Log(LOGDEBUG, "%s - ignored key %2x", __FUNCTION__, key.iButton); + return; + } + // if we received a keypress with a duration set, try to find the same one without a duration set, and replace it +@@ -788,6 +792,7 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) + if ((*it).iDuration == 0) + { + // replace this entry ++ CLog::Log(LOGDEBUG, "%s - replaced key %2x", __FUNCTION__, key.iButton); + (*it).iDuration = key.iDuration; + return; + } +@@ -797,6 +802,7 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) + } + } + ++ CLog::Log(LOGDEBUG, "%s - added key %2x", __FUNCTION__, key.iButton); + m_buttonQueue.push_back(key); + } + + +From f4d93cf45c5ad5666ce31589c879ae2c3bfbfa0c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 15 Nov 2014 12:03:34 +0000 -Subject: [PATCH 19/58] [dvdplayer] Add lock for player creation +Subject: [PATCH 19/87] [dvdplayer] Add lock for player creation --- xbmc/cores/dvdplayer/DVDPlayer.cpp | 3 +++ @@ -850,7 +1906,7 @@ Subject: [PATCH 19/58] [dvdplayer] Add lock for player creation 2 files changed, 4 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 70b1ac3..b41c8f0 100644 +index 87463a7..0ceae20 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp @@ -517,6 +517,7 @@ int CSelectionStreams::CountSource(StreamType type, StreamSource source) const @@ -869,7 +1925,7 @@ index 70b1ac3..b41c8f0 100644 if (!m_players_created) return; delete m_dvdPlayerVideo; -@@ -4255,6 +4257,7 @@ double CDVDPlayer::GetQueueTime() +@@ -4251,6 +4253,7 @@ double CDVDPlayer::GetQueueTime() void CDVDPlayer::GetVideoStreamInfo(SPlayerVideoStreamInfo &info) { @@ -888,10 +1944,10 @@ index ab6a228..32e76c1 100644 + CCriticalSection m_players_lock; }; -From 51e261109f6a8d1cb0e96bdaa56a01aa7077633f Mon Sep 17 00:00:00 2001 +From 1f158cf501be9af72c54013f6ba3d888028fd3d2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 24 Nov 2014 22:07:25 +0000 -Subject: [PATCH 20/58] [dvdplayervideo] Prod decoder when in stills mode +Subject: [PATCH 20/87] [dvdplayervideo] Prod decoder when in stills mode An asynchronous hardware decoder doesn't only produce output pictures when new packets arrive. In dvd stills mode give it a chance to return pictures that weren't ready when frame was decoded. @@ -900,7 +1956,7 @@ In dvd stills mode give it a chance to return pictures that weren't ready when f 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index f1a7e60..9be8aae 100644 +index 46fa635..03c876d 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp @@ -314,7 +314,8 @@ void CDVDPlayerVideo::Process() @@ -968,10 +2024,10 @@ index f1a7e60..9be8aae 100644 if (pMsg->IsType(CDVDMsg::GENERAL_SYNCHRONIZE)) -From deb376b5dad3cef8f86cef69aab9a4280bac9b21 Mon Sep 17 00:00:00 2001 +From 679035ea691e5269b7f5b26f6e5f4dd42f243da9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 27 Nov 2014 16:31:56 +0000 -Subject: [PATCH 21/58] [languageinvoker] Reduce priority of python threads +Subject: [PATCH 21/87] [languageinvoker] Reduce priority of python threads --- xbmc/interfaces/generic/LanguageInvokerThread.cpp | 5 +++++ @@ -994,10 +2050,10 @@ index fcdd063..16f0c89 100644 } -From 7351fa296cd1740f04c6c5a2047c11e3b607f700 Mon Sep 17 00:00:00 2001 +From 7c15df684d52221699e7056034efa4c6584caaeb Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 14 Dec 2013 16:55:05 +0000 -Subject: [PATCH 22/58] logging: Add microsecond timer to log messages +Subject: [PATCH 22/87] logging: Add microsecond timer to log messages --- xbmc/utils/log.cpp | 17 +++++++++++++++-- @@ -1050,10 +2106,10 @@ index 3443f12..31c4a99 100644 levelNames[logLevel]) + strData; -From c2bc1032b22f6214ffbbbecb29e3538f9790f016 Mon Sep 17 00:00:00 2001 +From 1a8b62644004d8e07141ce19bd439edc3415b7e1 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 29 Nov 2014 15:25:16 +0000 -Subject: [PATCH 23/58] [rbp] hack: wait for splash to complete before changing +Subject: [PATCH 23/87] [rbp] hack: wait for splash to complete before changing hdmi mode --- @@ -1127,10 +2183,10 @@ index 68fc647..c80114e 100644 if(!m_fixedMode && GETFLAGS_GROUP(res.dwFlags) && GETFLAGS_MODE(res.dwFlags)) -From 58ed12b2f7dd77fc57b3ddbff8fbaa04a0172716 Mon Sep 17 00:00:00 2001 +From 1c92686897b4c799e85aa878ec9f2d5b940533f6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 11 Dec 2014 17:00:57 +0000 -Subject: [PATCH 24/58] Fix for UI not showing both extractflags and +Subject: [PATCH 24/87] Fix for UI not showing both extractflags and extractthumb --- @@ -1139,7 +2195,7 @@ Subject: [PATCH 24/58] Fix for UI not showing both extractflags and 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 788a831..a794cd8 100644 +index 6db61ed..9f2eb3c 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -11015,7 +11015,7 @@ msgstr "" @@ -1151,7 +2207,7 @@ index 788a831..a794cd8 100644 msgstr "" #: xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp -@@ -14549,7 +14549,7 @@ msgstr "" +@@ -14572,7 +14572,7 @@ msgstr "" #. Description of setting "Videos -> File lists -> Extract thumbnails and video information" with label #20433 #: system/settings/settings.xml msgctxt "#36178" @@ -1160,7 +2216,7 @@ index 788a831..a794cd8 100644 msgstr "" #. Description of setting "Videos -> File lists -> Replace file names with library titles" with label #20419 -@@ -14561,7 +14561,7 @@ msgstr "" +@@ -14584,7 +14584,7 @@ msgstr "" #. Description of setting "Videos -> File lists -> Extract thumbnails and video information" with label #20433 #: system/settings/settings.xml msgctxt "#36180" @@ -1169,7 +2225,7 @@ index 788a831..a794cd8 100644 msgstr "" #: system/settings/settings.xml -@@ -16679,3 +16679,8 @@ msgstr "" +@@ -16702,3 +16702,8 @@ msgstr "" msgctxt "#38052" msgid "Remote button press release time (ms)" msgstr "" @@ -1179,7 +2235,7 @@ index 788a831..a794cd8 100644 +msgid "Extract thumbnails from video files" +msgstr "" diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 09c3d10..1059b09 100644 +index 4843ab8..f1cbefa 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -861,8 +861,8 @@ @@ -1194,10 +2250,10 @@ index 09c3d10..1059b09 100644 -From 6f0adae04039766326ebb5a735433dac07787a0f Mon Sep 17 00:00:00 2001 +From 6e4957a0b614a4e8db33849e52606052e8db9708 Mon Sep 17 00:00:00 2001 From: anaconda Date: Thu, 11 Sep 2014 21:30:43 +0200 -Subject: [PATCH 25/58] Disable autoscrolling while on screensaver and while +Subject: [PATCH 25/87] Disable autoscrolling while on screensaver and while opening streams. --- @@ -1210,10 +2266,10 @@ Subject: [PATCH 25/58] Disable autoscrolling while on screensaver and while 6 files changed, 24 insertions(+), 3 deletions(-) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index 697f278..a2a7fd2 100644 +index 36e3b97..136eade 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp -@@ -4996,3 +4996,13 @@ bool CApplication::NotifyActionListeners(const CAction &action) const +@@ -4988,3 +4988,13 @@ bool CApplication::NotifyActionListeners(const CAction &action) const return false; } @@ -1228,10 +2284,10 @@ index 697f278..a2a7fd2 100644 + return onBlackDimScreenSaver || openingStreams; +} diff --git a/xbmc/Application.h b/xbmc/Application.h -index 4b50ab2..07a5da2 100644 +index fe92b99..5e24c97 100644 --- a/xbmc/Application.h +++ b/xbmc/Application.h -@@ -389,6 +389,8 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs +@@ -385,6 +385,8 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs */ void UnregisterActionListener(IActionListener *listener); @@ -1307,7 +2363,7 @@ index 759ac09..bed6ad2 100644 else { diff --git a/xbmc/guilib/GUITextBox.cpp b/xbmc/guilib/GUITextBox.cpp -index 0d5b3f7..6d23024 100644 +index 2cdbf1c..42be75d 100644 --- a/xbmc/guilib/GUITextBox.cpp +++ b/xbmc/guilib/GUITextBox.cpp @@ -23,6 +23,7 @@ @@ -1328,10 +2384,10 @@ index 0d5b3f7..6d23024 100644 if (m_lastRenderTime) m_autoScrollDelayTime += currentTime - m_lastRenderTime; -From 9b85c054f66cb5efde618d34198bd533f16f26d5 Mon Sep 17 00:00:00 2001 +From 00ad89f5921ee884ddbf242897809e95a4291587 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 13 Dec 2014 18:35:20 +0000 -Subject: [PATCH 26/58] [demuxer] Avoid memcpy on every demuxer packet +Subject: [PATCH 26/87] [demuxer] Avoid memcpy on every demuxer packet Avoids an unnecessary memcpy on every demuxer packet which for high bitrate videos can be significant. @@ -1426,10 +2482,10 @@ index ab298b2..10c5ee0 100644 } catch(...) { -From cb5bcc331593fa2d2088c0a0f8f72aefce1030e2 Mon Sep 17 00:00:00 2001 +From 1a5db9af3595fed5b65c3557d6022cee3c254f1c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 15 Feb 2015 14:06:12 +0000 -Subject: [PATCH 27/58] [mmal] Allow mmal codec for dvd stills +Subject: [PATCH 27/87] [mmal] Allow mmal codec for dvd stills --- xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp | 7 +++++++ @@ -1461,10 +2517,10 @@ index 4c363cf..b90237b 100644 { // If dvd is an mpeg2 and hint.stills -From 3873604d5ef7443bdfc33603c979495fe8a0f17c Mon Sep 17 00:00:00 2001 +From bb4863764efb8eeb96dd788fd35ee901fe0a4d9a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 31 Mar 2015 17:31:47 +0100 -Subject: [PATCH 28/58] [mmalrenderer] Add SetCodecControl function and prefer +Subject: [PATCH 28/87] [mmalrenderer] Add SetCodecControl function and prefer to return pictures when renderer is low (disabled) --- @@ -1535,10 +2591,10 @@ index 51a64d1..bde8c06 100644 CCriticalSection m_sharedSection; MMAL_COMPONENT_T *m_dec; -From 8f077b7937e519bbe44a02c3559808672696903e Mon Sep 17 00:00:00 2001 +From 756be12cafa7d396065a961354ef6fd0911f6a24 Mon Sep 17 00:00:00 2001 From: anaconda Date: Wed, 25 Feb 2015 18:22:21 +0100 -Subject: [PATCH 29/58] Load OSD dialogs on startup. +Subject: [PATCH 29/87] Load OSD dialogs on startup. Fixes skipped frames the first time they're loaded in memory on less powered devices, like a Raspberry Pi, when using DVDPlayer. @@ -1553,10 +2609,10 @@ See http://forum.kodi.tv/showthread.php?tid=211501&pid=1938811#pid1938811 6 files changed, 10 insertions(+), 4 deletions(-) diff --git a/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp b/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp -index 1194d4c..82b980f 100644 +index 0aaeebc..200dc5f 100644 --- a/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp +++ b/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp -@@ -45,6 +45,7 @@ CGUIDialogPVRChannelsOSD::CGUIDialogPVRChannelsOSD() : +@@ -48,6 +48,7 @@ CGUIDialogPVRChannelsOSD::CGUIDialogPVRChannelsOSD() : CGUIDialog(WINDOW_DIALOG_PVR_OSD_CHANNELS, "DialogPVRChannelsOSD.xml"), Observer() { @@ -1633,10 +2689,10 @@ index 9f25fa5..3ece45b 100644 CGUIDialogVideoSettings::~CGUIDialogVideoSettings() { } -From 2c96de41d5df402113fb6f675c5c6766ad48b267 Mon Sep 17 00:00:00 2001 +From 8abb0782a608715a9d059e832f18587969bb4303 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 7 Mar 2015 22:46:21 +0000 -Subject: [PATCH 30/58] configure: Add raspberry-pi2 platform +Subject: [PATCH 30/87] configure: Add raspberry-pi2 platform --- configure.ac | 14 +++++++-- @@ -1648,7 +2704,7 @@ Subject: [PATCH 30/58] configure: Add raspberry-pi2 platform 6 files changed, 44 insertions(+), 22 deletions(-) diff --git a/configure.ac b/configure.ac -index 71883d2..6beec97 100644 +index cf945a0..ab4214f 100644 --- a/configure.ac +++ b/configure.ac @@ -744,8 +744,17 @@ case $use_platform in @@ -1810,10 +2866,10 @@ index cdc2fe4..379bd1d 100644 set(CMAKE_SYSTEM_NAME Linux) endif() -From ecf7d1b7364dd7cb121825168aa51a6b14946614 Mon Sep 17 00:00:00 2001 +From 54133f8d1b482256cad949b3cfd651e2732bf218 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 10 Mar 2015 17:05:18 +0000 -Subject: [PATCH 31/58] [players] Add settings option to enable MVC support +Subject: [PATCH 31/87] [players] Add settings option to enable MVC support --- addons/resource.language.en_gb/resources/strings.po | 10 ++++++++++ @@ -1823,10 +2879,10 @@ Subject: [PATCH 31/58] [players] Add settings option to enable MVC support 4 files changed, 27 insertions(+) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index a794cd8..acb6372 100644 +index 9f2eb3c..bf956f7 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16680,6 +16680,16 @@ msgctxt "#38052" +@@ -16703,6 +16703,16 @@ msgctxt "#38052" msgid "Remote button press release time (ms)" msgstr "" @@ -1894,10 +2950,10 @@ index e4f6d86..5d324f4 100644 case AV_CODEC_ID_MPEG4: // (role name) video_decoder.mpeg4 -From 7c831c1cf47b62ee6ea8d57457b4b5ee35f29882 Mon Sep 17 00:00:00 2001 +From 50a6e59c7f8e393d93f569ab53486c9d4fbf4308 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 14 Mar 2015 12:38:08 +0000 -Subject: [PATCH 32/58] [mmalrenderer] Switch to using transform flags for 3d +Subject: [PATCH 32/87] [mmalrenderer] Switch to using transform flags for 3d modes --- @@ -1911,10 +2967,10 @@ Subject: [PATCH 32/58] [mmalrenderer] Switch to using transform flags for 3d 7 files changed, 75 insertions(+), 130 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index acb6372..e1b691d 100644 +index bf956f7..530d882 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16690,6 +16690,16 @@ msgctxt "#38111" +@@ -16713,6 +16713,16 @@ msgctxt "#38111" msgid "This option decodes frames for both eyes of MVC video. Disabling may improve performance if you don't require 3D" msgstr "" @@ -2277,10 +3333,10 @@ index c80114e..3816b55 100644 m_width, m_height, dst_rect.width, dst_rect.height, res.fRefreshRate, GETFLAGS_GROUP(res.dwFlags), GETFLAGS_MODE(res.dwFlags), (int)res.dwFlags, res.fPixelRatio); -From 404462b4bf655a3dd1f50f619162839f47f6efaa Mon Sep 17 00:00:00 2001 +From 02ab1526a5e8a6e60d59bf5f3ad285110ff66d5d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 14 Apr 2015 20:51:14 +0100 -Subject: [PATCH 35/58] [gui] Also limit GUI updates when in non full-screen +Subject: [PATCH 35/87] [gui] Also limit GUI updates when in non full-screen video mode --- @@ -2288,10 +3344,10 @@ Subject: [PATCH 35/58] [gui] Also limit GUI updates when in non full-screen 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index a2a7fd2..95ec768 100644 +index 136eade..763c1c6 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp -@@ -2507,7 +2507,7 @@ void CApplication::FrameMove(bool processEvents, bool processGUI) +@@ -2499,7 +2499,7 @@ void CApplication::FrameMove(bool processEvents, bool processGUI) #if defined(TARGET_RASPBERRY_PI) || defined(HAS_IMXVPU) // This code reduces rendering fps of the GUI layer when playing videos in fullscreen mode // it makes only sense on architectures with multiple layers @@ -2300,7 +3356,7 @@ index a2a7fd2..95ec768 100644 fps = CSettings::Get().GetInt("videoplayer.limitguiupdate"); #endif -@@ -2520,6 +2520,8 @@ void CApplication::FrameMove(bool processEvents, bool processGUI) +@@ -2512,6 +2512,8 @@ void CApplication::FrameMove(bool processEvents, bool processGUI) { if (!m_skipGuiRender) g_windowManager.Process(CTimeUtils::GetFrameTime()); @@ -2310,10 +3366,10 @@ index a2a7fd2..95ec768 100644 g_windowManager.FrameMove(); } -From f83aef5f43795b2e08d87dc1ba8723bd7c7f09a2 Mon Sep 17 00:00:00 2001 +From 7d32b47b8d6f7f8238ad230de053b9ef74d9b169 Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 18:24:42 +0200 -Subject: [PATCH 36/58] Added some vc_tv_* functions that were missing in +Subject: [PATCH 36/87] Added some vc_tv_* functions that were missing in DllBCM. --- @@ -2348,10 +3404,10 @@ index b92fdb8..9c7e293 100644 HDMI_INTERLACED_T scan_mode, EDID_MODE_MATCH_FLAG_T match_flags) { return ::vc_tv_hdmi_power_on_best(width, height, frame_rate, scan_mode, match_flags); }; -From f72df42ab7b2987446c08230917f59391f58c1ef Mon Sep 17 00:00:00 2001 +From a87701ba7de5154a5ace636f12ad1d45899f3a5a Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 18:29:03 +0200 -Subject: [PATCH 37/58] Added private utility function to map a float display +Subject: [PATCH 37/87] Added private utility function to map a float display aspect, to the respective SDTV_ASPECT_* enum value. --- @@ -2400,10 +3456,10 @@ index 3816b55..520bf95 100644 bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector &resolutions) -From dbb24dacba5c40c0d536f4f71f5ac8b3b01fab41 Mon Sep 17 00:00:00 2001 +From c6d3ccebd34ae98f96ac2f6f28762cea9685e11a Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 19:50:58 +0200 -Subject: [PATCH 38/58] Changed SDTV resolutions to be treated similarly to +Subject: [PATCH 38/87] Changed SDTV resolutions to be treated similarly to HDMI resolutions in SetNativeResolution. This means that the SDTV interface is powered up and set to the right mode. @@ -2500,10 +3556,10 @@ index 59401f5..a0acb1a 100644 int m_width; int m_height; -From 06f189a4535e06b3d21f89e43b7caee7dedbe0d3 Mon Sep 17 00:00:00 2001 +From 45464218f3129a257aa9916b0bdb8967945da4ca Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 21 Jun 2015 17:11:09 +0100 -Subject: [PATCH 39/58] Revert "[3D] don't back out from 3D handling on +Subject: [PATCH 39/87] Revert "[3D] don't back out from 3D handling on resolution changes if we're switching to a different 3D mode" This reverts commit 3c4c236a799dab8369b4bb74ff9993bc58a61a72. @@ -2538,10 +3594,10 @@ index bd7dff9..fc4cc95 100644 if(stereo_mode != m_stereoMode) -From 445dce97603e36fadc97ee3d479abe6f581f6a07 Mon Sep 17 00:00:00 2001 +From fdefdbe58bbffe647f669616892257142aef76f6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 10 Jun 2015 20:42:03 +0100 -Subject: [PATCH 40/58] [rbp] Fix zoom modes with stereoscopic videos +Subject: [PATCH 40/87] [rbp] Fix zoom modes with stereoscopic videos --- xbmc/cores/VideoRenderers/MMALRenderer.cpp | 12 ++++++++++-- @@ -2597,10 +3653,10 @@ index ba17a46..298eaff 100644 if (gui != display) { -From 84bc87e546d79c342b8a7c169f81e8521611cdb3 Mon Sep 17 00:00:00 2001 +From 2a3b2eecd8bebb09419ce6606623e664a6caf1ea Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 21 Jun 2015 17:42:03 +0100 -Subject: [PATCH 41/58] [WinSystemEGL] Remove unused Support3D function +Subject: [PATCH 41/87] [WinSystemEGL] Remove unused Support3D function --- xbmc/windowing/egl/WinSystemEGL.cpp | 29 ----------------------------- @@ -2660,10 +3716,10 @@ index 9d4baf6..1ec4225 100644 EGLConfig GetEGLConfig(); -From 1597e6d82c667d55a763e965cb1e6448e0fbc01e Mon Sep 17 00:00:00 2001 +From d3bbcba17a08b06967098276a4e63fea1ad734c8 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 16 Apr 2014 21:18:06 +0100 -Subject: [PATCH 42/58] [omxplayer] Don't propagate 3d flags based on supported +Subject: [PATCH 42/87] [omxplayer] Don't propagate 3d flags based on supported 3d modes --- @@ -2719,10 +3775,10 @@ index 298eaff..3bf7c2e 100644 unsigned int iDisplayHeight = height; -From abadc22d9bed0fdf91c3a5be16dd07d8aa8d9f79 Mon Sep 17 00:00:00 2001 +From babe2ddd56be4bcc0653ab16010de7e5f5d3815f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 21 Jun 2015 18:52:28 +0100 -Subject: [PATCH 43/58] [3d] Avoid switching stereo mode based on current +Subject: [PATCH 43/87] [3d] Avoid switching stereo mode based on current display mode --- @@ -2762,10 +3818,10 @@ index fc4cc95..e18232e 100644 RESOLUTION_INFO info_mod = GetResInfo(res); -From ecb3cd064f5df496cbf685eec4c4d680c3c79704 Mon Sep 17 00:00:00 2001 +From 5a5c6740107de97d7cbce3303179c27e4f5e17b9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jun 2015 23:13:51 +0100 -Subject: [PATCH 44/58] [rpi] Always add desktop resolution to supported list +Subject: [PATCH 44/87] [rpi] Always add desktop resolution to supported list There was an assumption that the desktop resolution would be in the probed list, but that is sometimes not the case. We don't add interlaced resolutions to list, but they can be the preferred resolution read from edid. See: @@ -2834,10 +3890,10 @@ index a1f67fd..69ce9b7 100644 CLog::Log(LOGDEBUG, "EGL mode %d: %s (%.2f) %s%s:%x\n", i, res.strMode.c_str(), res.fPixelRatio, tv->native ? "N" : "", tv->scan_mode ? "I" : "", tv->code); -From 71f32189c08f3001e0a00f3d21d799eb7b0ac9ba Mon Sep 17 00:00:00 2001 +From 76f259d5791f4dd40cd6ff6ffb4251c25496cec6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 21 Jun 2015 18:53:29 +0100 -Subject: [PATCH 45/58] [rbp] Drop reporting 3D modes and just use current +Subject: [PATCH 45/87] [rbp] Drop reporting 3D modes and just use current rendering mode to request 3D signalling --- @@ -2994,10 +4050,10 @@ index 69ce9b7..25a97ad 100644 } if (supported_modes) -From 23e4fb99f6f4ad1cc969cc8361dc55338769419f Mon Sep 17 00:00:00 2001 +From 6b731b58c0cd53ba599eab0dab2e3011fbc43425 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 30 Jun 2015 14:08:24 +0100 -Subject: [PATCH 46/58] [rbp] Ignore video stereo mode when 3D display mode is +Subject: [PATCH 46/87] [rbp] Ignore video stereo mode when 3D display mode is disabled --- @@ -3036,10 +4092,10 @@ index 3bf7c2e..5f6b402 100644 if (m_hints.orientation == 90 || m_hints.orientation == 270) { -From 72e7fc2a4f0701ce47e624c5c73f457ae8db93fd Mon Sep 17 00:00:00 2001 +From 985940529cc7737ffa0475e4b9866fd9e4763826 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 22 Jun 2015 16:27:15 +0100 -Subject: [PATCH 47/58] [EGL] Don't skip out when HDMI mode is considered the +Subject: [PATCH 47/87] [EGL] Don't skip out when HDMI mode is considered the same It might have different 3D signalling. TODO: keep track of 3D signalling @@ -3061,10 +4117,10 @@ index c43c4d0..13b75b1 100644 m_bFullScreen = fullScreen; -From 9747f3d0ba4d3fabe46c35ceaeb74d2ee5daf547 Mon Sep 17 00:00:00 2001 +From 2ffd4421782229b8243b7c479a97c63a5e2cddde Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 21 Apr 2015 14:32:07 +0100 -Subject: [PATCH 48/58] [mmalrenderer] Add sharpness control +Subject: [PATCH 48/87] [mmalrenderer] Add sharpness control --- addons/resource.language.en_gb/resources/strings.po | 2 +- @@ -3073,7 +4129,7 @@ Subject: [PATCH 48/58] [mmalrenderer] Add sharpness control 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 6d861c1..c41b177 100644 +index 26ac2d7..f06ced6 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -7503,7 +7503,7 @@ msgstr "" @@ -3136,17 +4192,17 @@ index 1404fb3..9bced7e 100644 CCriticalSection m_sharedSection; MMAL_COMPONENT_T *m_vout; -From 7995698144c5b5c44dd9f4f80f17fa7803962586 Mon Sep 17 00:00:00 2001 +From 08d327c3400b158eae3395ca17335ea53d7127c2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 24 Apr 2015 13:49:51 +0100 -Subject: [PATCH 49/58] [dvdplayer] Add back required include +Subject: [PATCH 49/87] [dvdplayer] Add back required include --- xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index 9be8aae..ebec92d 100644 +index 03c876d..c1ef9d4 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp @@ -33,6 +33,7 @@ @@ -3158,10 +4214,10 @@ index 9be8aae..ebec92d 100644 #include "guilib/GraphicContext.h" #include -From 9cb45bcb661cf5de4814e304706d982352453f48 Mon Sep 17 00:00:00 2001 +From 5c54e70d72c67d2bf1fdb6bbc9ae94ea0a2e26bf Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 5 May 2015 23:58:06 +0100 -Subject: [PATCH 50/58] [screensaver] Leave GUI contents available for +Subject: [PATCH 50/87] [screensaver] Leave GUI contents available for screensaver --- @@ -3169,7 +4225,7 @@ Subject: [PATCH 50/58] [screensaver] Leave GUI contents available for 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/xbmc/guilib/GUIWindowManager.cpp b/xbmc/guilib/GUIWindowManager.cpp -index ba33908..17ea269 100644 +index 6030c4c..ccc2922 100644 --- a/xbmc/guilib/GUIWindowManager.cpp +++ b/xbmc/guilib/GUIWindowManager.cpp @@ -796,7 +796,16 @@ void CGUIWindowManager::ActivateWindow_Internal(int iWindowID, const vector Date: Fri, 15 May 2015 14:04:11 +0100 -Subject: [PATCH 52/58] [omxplayer] Make unsupported when ac3transcode is +Subject: [PATCH 52/87] [omxplayer] Make unsupported when ac3transcode is enabled --- @@ -3219,10 +4275,10 @@ index eff47e0..b954276 100644 { // find video stream -From 8294881aca9494a55c30f7347599779fe770c50d Mon Sep 17 00:00:00 2001 +From 912660eb2e987e8226f5e403545d5e8ea8bdbf9f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 1 Jun 2015 14:14:43 +0100 -Subject: [PATCH 53/58] [omximage] Don't report failed decode of progressive +Subject: [PATCH 53/87] [omximage] Don't report failed decode of progressive jpegs as as error --- @@ -3308,10 +4364,10 @@ index a43a446..890ca88 100644 } -From 61003a22eb36823420523a2d3df994e1222e0cea Mon Sep 17 00:00:00 2001 +From 47b92523f966479950a6f836a1a641752fdbc944 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 25 May 2015 19:01:00 +0100 -Subject: [PATCH 54/58] [rbp] Allow settings option for timestamp preference +Subject: [PATCH 54/87] [rbp] Allow settings option for timestamp preference We currently have some files that play better with pts timestamps and some that play better with dts timestamps Provide a gui setting to allow users to adjust this behaviour until we have a better solution @@ -3323,10 +4379,10 @@ Provide a gui setting to allow users to adjust this behaviour until we have a be 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 0138e5f..2d043ec 100644 +index eb31d58..a631d80 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16714,3 +16714,13 @@ msgstr "" +@@ -16737,3 +16737,13 @@ msgstr "" msgctxt "#38121" msgid "This option supports 8 channel DTS HD decoding, but may use more CPU. It is only available when DTS and DTS-HD audio passthrough is disabled" msgstr "" @@ -3385,10 +4441,10 @@ index 5f6b402..ce23bec 100644 if (pts == DVD_NOPTS_VALUE) pts = dts; -From 9fc7a4289b865202e2b8d4ac9bc8174e1001e1ad Mon Sep 17 00:00:00 2001 +From 33cb5e8872ddb645f9a6cc9e7b79e337c6b44bab Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 6 Jun 2015 18:44:37 +0100 -Subject: [PATCH 55/58] [rbp] Ignore pts value when m_hints.ptsinvalid set +Subject: [PATCH 55/87] [rbp] Ignore pts value when m_hints.ptsinvalid set --- xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 2 +- @@ -3422,10 +4478,10 @@ index ce23bec..e17fdb8 100644 if (pts == DVD_NOPTS_VALUE) pts = dts; -From 08b2eeaffdfdd1dc124ee3eb2f5a21b664074eca Mon Sep 17 00:00:00 2001 +From f9f553c62aeb183dfd3e80b905cffed576673e10 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 6 Jun 2015 18:43:57 +0100 -Subject: [PATCH 56/58] ffmpeg: Automatic switch to software decode for GMC +Subject: [PATCH 56/87] ffmpeg: Automatic switch to software decode for GMC with more than one warp point --- @@ -3596,10 +4652,10 @@ index b954276..b5ee4b6 100644 else if ((hint.codec == AV_CODEC_ID_VC1 || hint.codec == AV_CODEC_ID_WMV3) && g_RBP.GetCodecWvc1()) supported = true; -From e51804ed122dd0a642104d102315787970fffb8d Mon Sep 17 00:00:00 2001 +From 7fef3d4b4ec074297b9122231677e6ca22477ce5 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 22 Jun 2015 21:46:57 +0100 -Subject: [PATCH 57/58] [rbp] Use default resampling setting on Pi2 +Subject: [PATCH 57/87] [rbp] Use default resampling setting on Pi2 --- system/settings/rbp2.xml | 5 +++++ @@ -3622,10 +4678,10 @@ index b29a428..1c8b116 100644
-From 175260bab79c330366834bd86512afc2902dba0a Mon Sep 17 00:00:00 2001 +From c1c3ee24908f125f0de27c538104fb941a97f70c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 25 Jun 2015 19:43:10 +0100 -Subject: [PATCH 58/58] [rbp] HW mouse pointer +Subject: [PATCH 58/87] [rbp] HW mouse pointer Updating the mouse point provokes a complete screen update which can make it feel laggy and results in high cpu. @@ -3644,7 +4700,7 @@ Requires recent firmware. create mode 100644 xbmc/linux/rpi_user_vcsm.h diff --git a/xbmc/guilib/GUIWindowManager.cpp b/xbmc/guilib/GUIWindowManager.cpp -index 17ea269..6965319 100644 +index ccc2922..7bcda5c 100644 --- a/xbmc/guilib/GUIWindowManager.cpp +++ b/xbmc/guilib/GUIWindowManager.cpp @@ -193,7 +193,9 @@ void CGUIWindowManager::CreateWindows() @@ -4662,3 +5718,1482 @@ index f6c8df0..5c2b583 100644 }; #endif + +From 8c2da945c14bf86a8110cadb8de8d905456bf115 Mon Sep 17 00:00:00 2001 +From: Roman Kraevskiy +Date: Fri, 10 Jul 2015 23:36:34 +0300 +Subject: [PATCH 59/87] Mouse wheel support for X11-less linux distros + (openelec) + +--- + xbmc/input/linux/LinuxInputDevices.cpp | 125 +++++++++++++++++++++------------ + xbmc/input/linux/LinuxInputDevices.h | 2 + + 2 files changed, 82 insertions(+), 45 deletions(-) + +diff --git a/xbmc/input/linux/LinuxInputDevices.cpp b/xbmc/input/linux/LinuxInputDevices.cpp +index 32a3b46..b028cd1 100644 +--- a/xbmc/input/linux/LinuxInputDevices.cpp ++++ b/xbmc/input/linux/LinuxInputDevices.cpp +@@ -558,22 +558,27 @@ bool CLinuxInputDevice::KeyEvent(const struct input_event& levt, XBMC_Event& dev + */ + bool CLinuxInputDevice::RelEvent(const struct input_event& levt, XBMC_Event& devt) + { ++ bool motion = false; ++ bool wheel = false; ++ + switch (levt.code) + { + case REL_X: + m_mouseX += levt.value; + devt.motion.xrel = levt.value; + devt.motion.yrel = 0; ++ motion = true; + break; +- + case REL_Y: + m_mouseY += levt.value; + devt.motion.xrel = 0; + devt.motion.yrel = levt.value; ++ motion = true; + break; +- +- case REL_Z: + case REL_WHEEL: ++ wheel = (levt.value != 0); // process wheel event only when there was some delta ++ break; ++ case REL_Z: + default: + CLog::Log(LOGWARNING, "CLinuxInputDevice::RelEvent: Unknown rel event code: %d\n", levt.code); + return false; +@@ -588,13 +593,35 @@ bool CLinuxInputDevice::RelEvent(const struct input_event& levt, XBMC_Event& dev + m_mouseY = std::max(0, m_mouseY); + + +- devt.type = XBMC_MOUSEMOTION; +- devt.motion.type = XBMC_MOUSEMOTION; +- devt.motion.x = m_mouseX; +- devt.motion.y = m_mouseY; +- devt.motion.state = 0; +- devt.motion.which = m_deviceIndex; +- ++ if (motion) ++ { ++ devt.type = XBMC_MOUSEMOTION; ++ devt.motion.type = XBMC_MOUSEMOTION; ++ devt.motion.x = m_mouseX; ++ devt.motion.y = m_mouseY; ++ devt.motion.state = 0; ++ devt.motion.which = m_deviceIndex; ++ } ++ else if (wheel) ++ { ++ devt.type = XBMC_MOUSEBUTTONUP; ++ devt.button.state = XBMC_RELEASED; ++ devt.button.type = devt.type; ++ devt.button.x = m_mouseX; ++ devt.button.y = m_mouseY; ++ devt.button.button = (levt.value<0) ? XBMC_BUTTON_WHEELDOWN:XBMC_BUTTON_WHEELUP; ++ ++ /* but WHEEL up enent to the queue */ ++ m_equeue.push_back(devt); ++ ++ /* prepare and return WHEEL down event */ ++ devt.button.state = XBMC_PRESSED; ++ devt.type = XBMC_MOUSEBUTTONDOWN; ++ } ++ else ++ { ++ return false; ++ } + + return true; + } +@@ -693,57 +720,65 @@ XBMC_Event CLinuxInputDevice::ReadEvent() + + XBMC_Event devt; + +- while (1) ++ if (m_equeue.empty()) + { +- bzero(&levt, sizeof(levt)); ++ while (1) ++ { ++ bzero(&levt, sizeof(levt)); + +- bzero(&devt, sizeof(devt)); +- devt.type = XBMC_NOEVENT; ++ bzero(&devt, sizeof(devt)); ++ devt.type = XBMC_NOEVENT; + +- if(m_devicePreferredId == LI_DEVICE_NONE) +- return devt; ++ if(m_devicePreferredId == LI_DEVICE_NONE) ++ return devt; + +- readlen = read(m_fd, &levt, sizeof(levt)); ++ readlen = read(m_fd, &levt, sizeof(levt)); + +- if (readlen <= 0) +- { +- if (errno == ENODEV) ++ if (readlen <= 0) + { +- CLog::Log(LOGINFO,"input device was unplugged %s",m_deviceName); +- m_bUnplugged = true; ++ if (errno == ENODEV) ++ { ++ CLog::Log(LOGINFO,"input device was unplugged %s",m_deviceName); ++ m_bUnplugged = true; ++ } ++ ++ break; + } + +- break; +- } ++ //printf("read event readlen = %d device name %s m_fileName %s\n", readlen, m_deviceName, m_fileName.c_str()); + +- //printf("read event readlen = %d device name %s m_fileName %s\n", readlen, m_deviceName, m_fileName.c_str()); ++ // sanity check if we realy read the event ++ if(readlen != sizeof(levt)) ++ { ++ printf("CLinuxInputDevice: read error : %s\n", strerror(errno)); ++ break; ++ } + +- // sanity check if we realy read the event +- if(readlen != sizeof(levt)) +- { +- printf("CLinuxInputDevice: read error : %s\n", strerror(errno)); +- break; +- } ++ if (!TranslateEvent(levt, devt)) ++ continue; + +- if (!TranslateEvent(levt, devt)) +- continue; ++ /* Flush previous event with DIEF_FOLLOW? */ ++ if (devt.type != XBMC_NOEVENT) ++ { ++ //printf("new event! type = %d\n", devt.type); ++ //printf("key: %d %d %d %c\n", devt.key.keysym.scancode, devt.key.keysym.sym, devt.key.keysym.mod, devt.key.keysym.unicode); + +- /* Flush previous event with DIEF_FOLLOW? */ +- if (devt.type != XBMC_NOEVENT) +- { +- //printf("new event! type = %d\n", devt.type); +- //printf("key: %d %d %d %c\n", devt.key.keysym.scancode, devt.key.keysym.sym, devt.key.keysym.mod, devt.key.keysym.unicode); ++ if (m_hasLeds && (m_keyMods != m_lastKeyMods)) ++ { ++ SetLed(LED_NUML, m_keyMods & XBMCKMOD_NUM); ++ SetLed(LED_CAPSL, m_keyMods & XBMCKMOD_CAPS); ++ m_lastKeyMods = m_keyMods; ++ } + +- if (m_hasLeds && (m_keyMods != m_lastKeyMods)) +- { +- SetLed(LED_NUML, m_keyMods & XBMCKMOD_NUM); +- SetLed(LED_CAPSL, m_keyMods & XBMCKMOD_CAPS); +- m_lastKeyMods = m_keyMods; ++ break; + } +- +- break; + } + } ++ else ++ { ++ devt = m_equeue.front(); ++ m_equeue.pop_front(); ++ } + + return devt; + } +diff --git a/xbmc/input/linux/LinuxInputDevices.h b/xbmc/input/linux/LinuxInputDevices.h +index cf1c5ce..954d823 100644 +--- a/xbmc/input/linux/LinuxInputDevices.h ++++ b/xbmc/input/linux/LinuxInputDevices.h +@@ -22,6 +22,7 @@ + + #include + #include ++#include + #include "windowing/XBMC_events.h" + #include "input/XBMC_keyboard.h" + #include "threads/SingleLock.h" +@@ -79,6 +80,7 @@ class CLinuxInputDevice + int m_deviceMaxAxis; + bool m_bSkipNonKeyEvents; + bool m_bUnplugged; ++ std::deque m_equeue; + }; + + class CLinuxInputDevices + +From f233a279790d3b1682972724c243c7ea48b56aa2 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 22 Jun 2015 22:06:53 +0100 +Subject: [PATCH 60/87] [rbp] Flip default of prefer pts timestamps + +--- + system/settings/rbp.xml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml +index 8c6e69d..f9528bc 100644 +--- a/system/settings/rbp.xml ++++ b/system/settings/rbp.xml +@@ -45,7 +45,7 @@ + + + 3 +- false ++ true + + + + +From 3265c0a4d65cd46fa7e6e40f2c06587325a8a53f Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 7 May 2015 14:28:37 +0100 +Subject: [PATCH 61/87] build: Add vcsm lib + +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 084c2cf..98a1b26 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1059,7 +1059,7 @@ if test "$use_gles" = "yes"; then + AC_DEFINE([HAVE_LIBEGL],[1],["Define to 1 if you have the `EGL' library (-lEGL)."]) + AC_DEFINE([HAVE_LIBGLESV2],[1],["Define to 1 if you have the `GLESv2' library (-lGLESv2)."]) + AC_MSG_RESULT(== WARNING: OpenGLES support is assumed.) +- LIBS="$LIBS -lEGL -lGLESv2 -lbcm_host -lvcos -lvchiq_arm -lmmal -lmmal_core -lmmal_util" ++ LIBS="$LIBS -lEGL -lGLESv2 -lbcm_host -lvcos -lvchiq_arm -lmmal -lmmal_core -lmmal_util -lvcsm" + else + AC_CHECK_LIB([EGL], [main],, AC_MSG_ERROR($missing_library)) + AC_CHECK_LIB([GLESv2],[main],, AC_MSG_ERROR($missing_library)) + +From 711768bf07ef5cea9c30e3543fa82b45017c508a Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 20 Jul 2015 16:11:37 +0100 +Subject: [PATCH 62/87] [mmalcodec] Populate the framerate of video decoder + +When timestamps are unknown, they may be interpolated based on the framerate. Without setting this, +a default of 30fps is used which may be incorrect and cause stutters +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 3e97f1d..5b064d2 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -629,6 +629,11 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) + m_dec_input->format->es->video.width = ALIGN_UP(m_hints.width, 32); + m_dec_input->format->es->video.height = ALIGN_UP(m_hints.height, 16); + } ++ if (hints.fpsrate > 0 && hints.fpsscale > 0) ++ { ++ m_dec_input->format->es->video.frame_rate.num = hints.fpsrate; ++ m_dec_input->format->es->video.frame_rate.den = hints.fpsscale; ++ } + m_dec_input->format->flags |= MMAL_ES_FORMAT_FLAG_FRAMED; + + error_concealment.hdr.id = MMAL_PARAMETER_VIDEO_DECODE_ERROR_CONCEALMENT; + +From 94b4c1a43ae53a123c5039ac94b47c5598db455b Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 22 Jul 2015 22:52:46 +0100 +Subject: [PATCH 63/87] [mmalcodec] Enable interpolate timestamps + +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 5b064d2..a202421 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -647,7 +647,7 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) + if (status != MMAL_SUCCESS) + CLog::Log(LOGERROR, "%s::%s Failed to enable extra buffers on %s (status=%x %s)", CLASSNAME, __func__, m_dec_input->name, status, mmal_status_to_string(status)); + +- status = mmal_port_parameter_set_uint32(m_dec_input, MMAL_PARAMETER_VIDEO_INTERPOLATE_TIMESTAMPS, 0); ++ status = mmal_port_parameter_set_uint32(m_dec_input, MMAL_PARAMETER_VIDEO_INTERPOLATE_TIMESTAMPS, 1); + if (status != MMAL_SUCCESS) + CLog::Log(LOGERROR, "%s::%s Failed to disable interpolate timestamps mode on %s (status=%x %s)", CLASSNAME, __func__, m_dec_input->name, status, mmal_status_to_string(status)); + + +From d65df791a54f90d38f6c905aef565c05cccb44d3 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 23 Jul 2015 00:55:47 +0100 +Subject: [PATCH 64/87] Revert "[rbp] Flip default of prefer pts timestamps" + +This reverts commit 34100dcdf830a0e957df585108066c48d6c5c38d. +--- + system/settings/rbp.xml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml +index f9528bc..8c6e69d 100644 +--- a/system/settings/rbp.xml ++++ b/system/settings/rbp.xml +@@ -45,7 +45,7 @@ + + + 3 +- true ++ false + + + + +From 2b3c2670323ee570e6f10164e2cc3fb78e2f31b9 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 23 Jul 2015 00:56:56 +0100 +Subject: [PATCH 65/87] Revert "[rbp] Allow settings option for timestamp + preference" + +This reverts commit c0eef926dd376cbf8a7857b2848e118ea3689b98. +--- + addons/resource.language.en_gb/resources/strings.po | 10 ---------- + system/settings/rbp.xml | 7 ------- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 2 +- + xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 2 +- + 4 files changed, 2 insertions(+), 19 deletions(-) + +diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po +index a631d80..eb31d58 100644 +--- a/addons/resource.language.en_gb/resources/strings.po ++++ b/addons/resource.language.en_gb/resources/strings.po +@@ -16737,13 +16737,3 @@ msgstr "" + msgctxt "#38121" + msgid "This option supports 8 channel DTS HD decoding, but may use more CPU. It is only available when DTS and DTS-HD audio passthrough is disabled" + msgstr "" +- +-#: system/settings/rbp.xml +-msgctxt "#38210" +-msgid "Prefer PTS timestamps" +-msgstr "" +- +-#: system/settings/rbp.xml +-msgctxt "#38211" +-msgid "Try enabling this if you have stutter with video files" +-msgstr "" +diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml +index 8c6e69d..b27d23f 100644 +--- a/system/settings/rbp.xml ++++ b/system/settings/rbp.xml +@@ -42,13 +42,6 @@ + + + +- +- +- 3 +- false +- +- +- +
+ + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index a202421..5d054bb 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -804,7 +804,7 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + pts = 0; + buffer->pts = pts == DVD_NOPTS_VALUE ? MMAL_TIME_UNKNOWN : pts; + buffer->dts = dts == DVD_NOPTS_VALUE ? MMAL_TIME_UNKNOWN : dts; +- if (m_hints.ptsinvalid || (buffer->dts != MMAL_TIME_UNKNOWN && !CSettings::Get().GetBool("videoplayer.preferptstimestamps"))) buffer->pts = MMAL_TIME_UNKNOWN; ++ if (m_hints.ptsinvalid) buffer->pts = MMAL_TIME_UNKNOWN; + buffer->length = demuxer_bytes > buffer->alloc_size ? buffer->alloc_size : demuxer_bytes; + // set a flag so we can identify primary frames from generated frames (deinterlace) + buffer->flags = MMAL_BUFFER_HEADER_FLAG_USER0; +diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +index e17fdb8..f06ee9c 100644 +--- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp ++++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +@@ -495,7 +495,7 @@ void OMXPlayerVideo::Process() + if (pts != DVD_NOPTS_VALUE) + pts += m_iVideoDelay; + +- m_omxVideo.Decode(pPacket->pData, pPacket->iSize, dts, m_hints.ptsinvalid || (dts != DVD_NOPTS_VALUE && !CSettings::Get().GetBool("videoplayer.preferptstimestamps")) ? DVD_NOPTS_VALUE : pts); ++ m_omxVideo.Decode(pPacket->pData, pPacket->iSize, dts, m_hints.ptsinvalid ? DVD_NOPTS_VALUE : pts); + + if (pts == DVD_NOPTS_VALUE) + pts = dts; + +From b8058086f55b522b82ba15ad4d9f30bd8c1cd458 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 23 Jul 2015 15:52:39 +0100 +Subject: [PATCH 66/87] [omxhelper] Ignore embedded coverart image when looking + for supported video streams + +--- + xbmc/cores/omxplayer/OMXHelper.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/xbmc/cores/omxplayer/OMXHelper.cpp b/xbmc/cores/omxplayer/OMXHelper.cpp +index b5ee4b6..59479fe 100644 +--- a/xbmc/cores/omxplayer/OMXHelper.cpp ++++ b/xbmc/cores/omxplayer/OMXHelper.cpp +@@ -72,7 +72,7 @@ bool OMXPlayerUnsuitable(bool m_HasVideo, bool m_HasAudio, CDVDDemux* m_pDemuxer + { + int iStream = it->id; + CDemuxStream *stream = m_pDemuxer->GetStream(iStream); +- if(!stream || stream->disabled) ++ if(!stream || stream->disabled || stream->flags & AV_DISPOSITION_ATTACHED_PIC) + continue; + CDVDStreamInfo hint(*stream, true); + + +From 142b98ac1813dc78695f763f51c1516f0cfe5d2e Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 24 Jul 2015 18:39:25 +0100 +Subject: [PATCH 68/87] [mmalcodec] Don't set initial unknown timestamps to + zero + +This used to be done to keep the firmware happy, but is no longer required and messes with timestamp statistics +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 8 -------- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 1 - + 2 files changed, 9 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 5d054bb..b2ac68f 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -106,7 +106,6 @@ CMMALVideo::CMMALVideo() + + m_interlace_mode = MMAL_InterlaceProgressive; + m_interlace_method = VS_INTERLACEMETHOD_NONE; +- m_startframe = false; + m_decoderPts = DVD_NOPTS_VALUE; + + m_dec = NULL; +@@ -713,7 +712,6 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) + return false; + + Prime(); +- m_startframe = false; + m_preroll = !m_hints.stills; + m_speed = DVD_PLAYSPEED_NORMAL; + +@@ -800,8 +798,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + + mmal_buffer_header_reset(buffer); + buffer->cmd = 0; +- if (!m_startframe && pts == DVD_NOPTS_VALUE) +- pts = 0; + buffer->pts = pts == DVD_NOPTS_VALUE ? MMAL_TIME_UNKNOWN : pts; + buffer->dts = dts == DVD_NOPTS_VALUE ? MMAL_TIME_UNKNOWN : dts; + if (m_hints.ptsinvalid) buffer->pts = MMAL_TIME_UNKNOWN; +@@ -829,9 +825,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + + if (demuxer_bytes == 0) + { +- pthread_mutex_lock(&m_output_mutex); +- m_startframe = true; +- pthread_mutex_unlock(&m_output_mutex); + EDEINTERLACEMODE deinterlace_request = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode; + EINTERLACEMETHOD interlace_method = g_renderManager.AutoInterlaceMethod(CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod); + +@@ -956,7 +949,6 @@ void CMMALVideo::Reset(void) + SendCodecConfigData(); + Prime(); + } +- m_startframe = false; + m_decoderPts = DVD_NOPTS_VALUE; + m_preroll = !m_hints.stills && (m_speed == DVD_PLAYSPEED_NORMAL || m_speed == DVD_PLAYSPEED_PAUSE); + m_codecControlFlags = 0; +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +index bde8c06..42d6a7b 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +@@ -127,7 +127,6 @@ class CMMALVideo : public CDVDVideoCodec + // Components + MMAL_INTERLACETYPE_T m_interlace_mode; + EINTERLACEMETHOD m_interlace_method; +- bool m_startframe; + double m_decoderPts; + int m_speed; + bool m_preroll; + +From 9e5e289b1384d78772920dbeffcee577d8aeb99e Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 24 Jul 2015 22:53:21 +0100 +Subject: [PATCH 69/87] [mmalcodec] Tidy up setting of timestamp flags + +--- + xbmc/cores/omxplayer/OMXVideo.cpp | 27 ++++++++++++++------------- + 1 file changed, 14 insertions(+), 13 deletions(-) + +diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp +index 832a9c9..1a08aa9 100644 +--- a/xbmc/cores/omxplayer/OMXVideo.cpp ++++ b/xbmc/cores/omxplayer/OMXVideo.cpp +@@ -754,6 +754,19 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double dts, double pts) + + if (demuxer_content && demuxer_bytes > 0) + { ++ OMX_U32 nFlags = 0; ++ ++ if(m_setStartTime) ++ { ++ nFlags |= OMX_BUFFERFLAG_STARTTIME; ++ CLog::Log(LOGDEBUG, "OMXVideo::Decode VDec : setStartTime %f\n", (pts == DVD_NOPTS_VALUE ? 0.0 : pts) / DVD_TIME_BASE); ++ m_setStartTime = false; ++ } ++ if (pts == DVD_NOPTS_VALUE && dts == DVD_NOPTS_VALUE) ++ nFlags |= OMX_BUFFERFLAG_TIME_UNKNOWN; ++ else if (pts == DVD_NOPTS_VALUE) ++ nFlags |= OMX_BUFFERFLAG_TIME_IS_DTS; ++ + while(demuxer_bytes) + { + // 500ms timeout +@@ -764,21 +777,9 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double dts, double pts) + return false; + } + +- omx_buffer->nFlags = 0; ++ omx_buffer->nFlags = nFlags; + omx_buffer->nOffset = 0; + omx_buffer->nTimeStamp = ToOMXTime((uint64_t)(pts != DVD_NOPTS_VALUE ? pts : dts != DVD_NOPTS_VALUE ? dts : 0)); +- +- if(m_setStartTime) +- { +- omx_buffer->nFlags |= OMX_BUFFERFLAG_STARTTIME; +- CLog::Log(LOGDEBUG, "OMXVideo::Decode VDec : setStartTime %f\n", (pts == DVD_NOPTS_VALUE ? 0.0 : pts) / DVD_TIME_BASE); +- m_setStartTime = false; +- } +- else if (pts == DVD_NOPTS_VALUE && dts == DVD_NOPTS_VALUE) +- omx_buffer->nFlags |= OMX_BUFFERFLAG_TIME_UNKNOWN; +- else if (pts == DVD_NOPTS_VALUE) +- omx_buffer->nFlags |= OMX_BUFFERFLAG_TIME_IS_DTS; +- + omx_buffer->nFilledLen = std::min((OMX_U32)demuxer_bytes, omx_buffer->nAllocLen); + memcpy(omx_buffer->pBuffer, demuxer_content, omx_buffer->nFilledLen); + + +From 4858d812237020f71205a6ab1e0af891099f3167 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Sat, 25 Jul 2015 15:32:35 +0100 +Subject: [PATCH 70/87] [rbp] Only send changes in hw cursor state + +--- + xbmc/linux/RBP.cpp | 9 ++++++++- + xbmc/linux/RBP.h | 5 ++++- + 2 files changed, 12 insertions(+), 2 deletions(-) + +diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp +index 2c8d09b..3953740 100644 +--- a/xbmc/linux/RBP.cpp ++++ b/xbmc/linux/RBP.cpp +@@ -61,6 +61,9 @@ CRBP::CRBP() + m_OMX = new COMXCore(); + m_display = DISPMANX_NO_HANDLE; + m_p = NULL; ++ m_x = 0; ++ m_y = 0; ++ m_enabled = 0; + m_mb = mbox_open(); + vcsm_init(); + } +@@ -482,7 +485,11 @@ void CRBP::update_cursor(int x, int y, bool enabled) + int y2 = y * display.Height() / gui.Height(); + + //printf("%s %d,%d (%d)\n", __func__, x, y, enabled); +- mailbox_set_cursor_position(m_mb, enabled, x2, y2); ++ if (m_x != x2 || m_y != y2 || m_enabled != enabled) ++ mailbox_set_cursor_position(m_mb, enabled, x2, y2); ++ m_x = x2; ++ m_y = y2; ++ m_enabled = enabled; + } + + void CRBP::uninit_cursor() +diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h +index f233a5e..be0cafc 100644 +--- a/xbmc/linux/RBP.h ++++ b/xbmc/linux/RBP.h +@@ -86,7 +86,10 @@ class CRBP + + struct gpu_mem_ptr_s *m_p; + int m_mb; +-public: ++ int m_x; ++ int m_y; ++ bool m_enabled; ++ public: + void init_cursor(); + void set_cursor(const void *pixels, int width, int height, int hotspot_x, int hotspot_y); + void update_cursor(int x, int y, bool enabled); + +From 68935db0771fe14373c061420ffbbca5596a3a74 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 28 Jul 2015 00:08:58 +0100 +Subject: [PATCH 71/87] [mmalcodec] Use both dts and pts for determining amount + of queued data + +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 10 ++++++++-- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 1 + + 2 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index b2ac68f..6cf4023 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -107,6 +107,7 @@ CMMALVideo::CMMALVideo() + m_interlace_mode = MMAL_InterlaceProgressive; + m_interlace_method = VS_INTERLACEMETHOD_NONE; + m_decoderPts = DVD_NOPTS_VALUE; ++ m_demuxerPts = DVD_NOPTS_VALUE; + + m_dec = NULL; + m_dec_input = NULL; +@@ -853,7 +854,11 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + break; + } + int ret = 0; +- double queued = m_decoderPts != DVD_NOPTS_VALUE && pts != DVD_NOPTS_VALUE ? pts - m_decoderPts : 0.0; ++ if (pts != DVD_NOPTS_VALUE) ++ m_demuxerPts = pts; ++ else if (dts != DVD_NOPTS_VALUE) ++ m_demuxerPts = dts; ++ double queued = m_decoderPts != DVD_NOPTS_VALUE && m_demuxerPts != DVD_NOPTS_VALUE ? m_demuxerPts - m_decoderPts : 0.0; + if (mmal_queue_length(m_dec_input_pool->queue) > 0 && !m_demux_queue_length && queued <= DVD_MSEC_TO_TIME(500)) + { + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +@@ -950,6 +955,7 @@ void CMMALVideo::Reset(void) + Prime(); + } + m_decoderPts = DVD_NOPTS_VALUE; ++ m_demuxerPts = DVD_NOPTS_VALUE; + m_preroll = !m_hints.stills && (m_speed == DVD_PLAYSPEED_NORMAL || m_speed == DVD_PLAYSPEED_PAUSE); + m_codecControlFlags = 0; + } +@@ -1043,7 +1049,7 @@ bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture) + if (pDvdVideoPicture->pts != DVD_NOPTS_VALUE) + m_decoderPts = pDvdVideoPicture->pts; + else +- m_decoderPts = pDvdVideoPicture->dts; // xxx is DVD_NOPTS_VALUE better? ++ m_decoderPts = pDvdVideoPicture->dts; + + return true; + } +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +index 42d6a7b..f8f5209 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +@@ -127,6 +127,7 @@ class CMMALVideo : public CDVDVideoCodec + // Components + MMAL_INTERLACETYPE_T m_interlace_mode; + EINTERLACEMETHOD m_interlace_method; ++ double m_demuxerPts; + double m_decoderPts; + int m_speed; + bool m_preroll; + +From ddd17d3dfb6c4b2043b024ff1ee33bc6b9a3bcf0 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 28 Jul 2015 17:47:33 +0100 +Subject: [PATCH 72/87] [rbp] Refactor the vsync handle to support multiple + callers + +--- + xbmc/linux/RBP.cpp | 68 ++++++++++++++++++++++++++++++------------------------ + xbmc/linux/RBP.h | 7 ++++-- + 2 files changed, 43 insertions(+), 32 deletions(-) + +diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp +index 3953740..901250e 100644 +--- a/xbmc/linux/RBP.cpp ++++ b/xbmc/linux/RBP.cpp +@@ -66,6 +66,7 @@ CRBP::CRBP() + m_enabled = 0; + m_mb = mbox_open(); + vcsm_init(); ++ m_vsync_count = 0; + } + + CRBP::~CRBP() +@@ -143,11 +144,45 @@ void CRBP::LogFirmwareVerison() + CLog::Log(LOGNOTICE, "Config:\n%s", response); + } + ++static void vsync_callback_static(DISPMANX_UPDATE_HANDLE_T u, void *arg) ++{ ++ CRBP *rbp = reinterpret_cast(arg); ++ rbp->VSyncCallback(); ++} ++ ++void CRBP::VSyncCallback() ++{ ++ CSingleLock lock(m_vsync_lock); ++ m_vsync_count++; ++ m_vsync_cond.notifyAll(); ++} ++ ++unsigned int CRBP::WaitVsync(unsigned int target) ++{ ++ CSingleLock lock(m_vsync_lock); ++ if (target == ~0U) ++ target = m_vsync_count+1; ++ ++ if (m_display == DISPMANX_NO_HANDLE) ++ { ++ CLog::Log(LOGDEBUG, "CRBP::%s skipping while display closed", __func__); ++ return m_vsync_count; ++ } ++ ++ while (m_vsync_count < target) ++ if (!m_vsync_cond.wait(lock, 100)) ++ break; ++ ++ return m_vsync_count; ++} ++ + DISPMANX_DISPLAY_HANDLE_T CRBP::OpenDisplay(uint32_t device) + { + if (m_display == DISPMANX_NO_HANDLE) + { + m_display = vc_dispmanx_display_open( 0 /*screen*/ ); ++ int s = vc_dispmanx_vsync_callback(m_display, vsync_callback_static, (void *)this); ++ assert(s == 0); + init_cursor(); + } + return m_display; +@@ -156,9 +191,11 @@ DISPMANX_DISPLAY_HANDLE_T CRBP::OpenDisplay(uint32_t device) + void CRBP::CloseDisplay(DISPMANX_DISPLAY_HANDLE_T display) + { + assert(display == m_display); ++ int s = vc_dispmanx_vsync_callback(m_display, NULL, NULL); ++ assert(s == 0); ++ uninit_cursor(); + vc_dispmanx_display_close(m_display); + m_display = DISPMANX_NO_HANDLE; +- uninit_cursor(); + } + + void CRBP::GetDisplaySize(int &width, int &height) +@@ -211,35 +248,6 @@ unsigned char *CRBP::CaptureDisplay(int width, int height, int *pstride, bool sw + return image; + } + +- +-static void vsync_callback(DISPMANX_UPDATE_HANDLE_T u, void *arg) +-{ +- CEvent *sync = (CEvent *)arg; +- sync->Set(); +-} +- +-void CRBP::WaitVsync() +-{ +- int s; +- DISPMANX_DISPLAY_HANDLE_T m_display = vc_dispmanx_display_open( 0 /*screen*/ ); +- if (m_display == DISPMANX_NO_HANDLE) +- { +- CLog::Log(LOGDEBUG, "CRBP::%s skipping while display closed", __func__); +- return; +- } +- m_vsync.Reset(); +- s = vc_dispmanx_vsync_callback(m_display, vsync_callback, (void *)&m_vsync); +- if (s == 0) +- { +- m_vsync.WaitMSec(1000); +- } +- else assert(0); +- s = vc_dispmanx_vsync_callback(m_display, NULL, NULL); +- assert(s == 0); +- vc_dispmanx_display_close( m_display ); +-} +- +- + void CRBP::Deinitialize() + { + if (m_omx_image_init) +diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h +index be0cafc..0572b47 100644 +--- a/xbmc/linux/RBP.h ++++ b/xbmc/linux/RBP.h +@@ -65,7 +65,8 @@ class CRBP + // stride can be null for packed output + unsigned char *CaptureDisplay(int width, int height, int *stride, bool swap_red_blue, bool video_only = true); + DllOMX *GetDllOMX() { return m_OMX ? m_OMX->GetDll() : NULL; } +- void WaitVsync(); ++ unsigned int WaitVsync(unsigned int target = ~0U); ++ void VSyncCallback(); + double AdjustHDMIClock(double adjust); + + private: +@@ -80,7 +81,9 @@ class CRBP + bool m_codec_wvc1_enabled; + COMXCore *m_OMX; + DISPMANX_DISPLAY_HANDLE_T m_display; +- CEvent m_vsync; ++ CCriticalSection m_vsync_lock; ++ XbmcThreads::ConditionVariable m_vsync_cond; ++ unsigned int m_vsync_count; + class DllLibOMXCore; + CCriticalSection m_critSection; + + +From 6496fa447a357d146816badb32a4510be40fcfd3 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 29 Jul 2015 14:06:17 +0100 +Subject: [PATCH 73/87] [mmalrenderer] Wait for vsync before submitting to mmal + when display sync is disabled + +This avoids an issue where video occasionally goes stuttery after a seek, until the next pause/play or seek. +The issue is when display sync is disabled, and framerate of video matches display, and render times are coincident with vsync +you find that depending on timestamp/scheduling jitter, you may or may not get an update each vsync resulting in stuttery video. + +Some scheme to force render times to be dependent on vsync is required. We do this by blocking in RenderUpdate unto next vsync. +--- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 23 +++++++++++++++++++++-- + xbmc/cores/VideoRenderers/MMALRenderer.h | 2 ++ + 2 files changed, 23 insertions(+), 2 deletions(-) + +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index fb92079..2e2bc83 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -208,6 +208,7 @@ CMMALRenderer::CMMALRenderer() + m_bMMALConfigured = false; + m_iYV12RenderBuffer = 0; + m_sharpness = -2.0f; ++ m_vsyncCount = ~0; + } + + CMMALRenderer::~CMMALRenderer() +@@ -357,6 +358,24 @@ void CMMALRenderer::Update() + ManageDisplay(); + } + ++void CMMALRenderer::SubmitFrame(MMAL_BUFFER_HEADER_T *buffer) ++{ ++ if (!CSettings::Get().GetBool("videoplayer.usedisplayasclock")) ++ { ++ if (fabs(m_fps - g_graphicsContext.GetFPS()) < 1e-2) ++ { ++ #if defined(MMAL_DEBUG_VERBOSE) ++ CLog::Log(LOGDEBUG, "%s::%s - buffer:%p vfps:%.3f dfps:%.3f vsync:%d dsync:%d", CLASSNAME, __func__, buffer, m_fps, g_graphicsContext.GetFPS(), m_vsyncCount, CSettings::Get().GetBool("videoplayer.usedisplayasclock")); ++ #endif ++ m_vsyncCount = g_RBP.WaitVsync(m_vsyncCount) + 1; ++ #if defined(MMAL_DEBUG_VERBOSE) ++ CLog::Log(LOGDEBUG, "%s::%s - done vsync:%d", CLASSNAME, __func__, m_vsyncCount); ++ #endif ++ } ++ } ++ mmal_port_send_buffer(m_vout_input, buffer); ++} ++ + void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + { + CSingleLock lock(m_sharedSection); +@@ -402,7 +421,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + return; + omvb->Acquire(); + omvb->mmal_buffer->flags |= MMAL_BUFFER_HEADER_FLAG_USER1 | MMAL_BUFFER_HEADER_FLAG_USER2; +- mmal_port_send_buffer(m_vout_input, omvb->mmal_buffer); ++ SubmitFrame(omvb->mmal_buffer); + } + else + CLog::Log(LOGDEBUG, "%s::%s - No buffer to update", CLASSNAME, __func__); +@@ -417,7 +436,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + return; + // sanity check it is not on display + buffer->mmal_buffer->flags |= MMAL_BUFFER_HEADER_FLAG_USER1 | MMAL_BUFFER_HEADER_FLAG_USER2; +- mmal_port_send_buffer(m_vout_input, buffer->mmal_buffer); ++ SubmitFrame(buffer->mmal_buffer); + } + else + CLog::Log(LOGDEBUG, "%s::%s - No buffer to update", CLASSNAME, __func__); +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.h b/xbmc/cores/VideoRenderers/MMALRenderer.h +index 9bced7e..ec279ed 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.h ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.h +@@ -99,6 +99,7 @@ class CMMALRenderer : public CBaseRenderer + unsigned int m_destWidth; + unsigned int m_destHeight; + int m_neededBuffers; ++ int m_vsyncCount; + + CRect m_src_rect; + CRect m_dst_rect; +@@ -115,4 +116,5 @@ class CMMALRenderer : public CBaseRenderer + bool init_vout(ERenderFormat format); + void ReleaseBuffers(); + void UnInitMMAL(); ++ void SubmitFrame(MMAL_BUFFER_HEADER_T *buffer); + }; + +From ad9373bf960c6c7c6e5cc00c59c9dfe856a7e07f Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 29 Jul 2015 15:07:22 +0100 +Subject: [PATCH 74/87] [omxplayer] Support per refresh rate display latency + settings + +--- + xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +index f06ee9c..4ad66a8 100644 +--- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp ++++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +@@ -490,10 +490,10 @@ void OMXPlayerVideo::Process() + double pts = pPacket->pts; + + if (dts != DVD_NOPTS_VALUE) +- dts += m_iVideoDelay; ++ dts += m_iVideoDelay - DVD_SEC_TO_TIME(g_renderManager.GetDisplayLatency()); + + if (pts != DVD_NOPTS_VALUE) +- pts += m_iVideoDelay; ++ pts += m_iVideoDelay - DVD_SEC_TO_TIME(g_renderManager.GetDisplayLatency()); + + m_omxVideo.Decode(pPacket->pData, pPacket->iSize, dts, m_hints.ptsinvalid ? DVD_NOPTS_VALUE : pts); + + +From 3da5401ecbe5206fcaafaf44fa6a2b6e6ee01700 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 29 Jul 2015 15:46:18 +0100 +Subject: [PATCH 75/87] squash: release gfx lock when blocking + +--- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index 2e2bc83..c80a8a6 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -367,6 +367,7 @@ void CMMALRenderer::SubmitFrame(MMAL_BUFFER_HEADER_T *buffer) + #if defined(MMAL_DEBUG_VERBOSE) + CLog::Log(LOGDEBUG, "%s::%s - buffer:%p vfps:%.3f dfps:%.3f vsync:%d dsync:%d", CLASSNAME, __func__, buffer, m_fps, g_graphicsContext.GetFPS(), m_vsyncCount, CSettings::Get().GetBool("videoplayer.usedisplayasclock")); + #endif ++ CSingleExit lock(g_graphicsContext); + m_vsyncCount = g_RBP.WaitVsync(m_vsyncCount) + 1; + #if defined(MMAL_DEBUG_VERBOSE) + CLog::Log(LOGDEBUG, "%s::%s - done vsync:%d", CLASSNAME, __func__, m_vsyncCount); + +From d0c1c12d6dfd9b3294fbaffcb22f2a63ea83c059 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 29 Jul 2015 17:34:11 +0100 +Subject: [PATCH 76/87] [rbp] Leave 3D framepacking output disabled by default + +--- + system/settings/rbp.xml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml +index b27d23f..bf3b05f 100644 +--- a/system/settings/rbp.xml ++++ b/system/settings/rbp.xml +@@ -38,7 +38,7 @@ + true + + 2 +- true ++ false + + + + +From 1bc742744c2910add974ae145b4d72a8133f45ea Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 29 Jul 2015 17:26:30 +0100 +Subject: [PATCH 77/87] [omxplayer] Allow automatic switching back to omxplayer + after it has been disabled + +Omxplayer gets disabled when it is unsuitable (e.g. software decoder required, or ALSA audio or AC3 transcode). +However if you play another file without quitting dvdplayer, it doesn't reconsider. + +E.g. play divx3 file and omxplayer is disabled. If you then launch a h.264 file while first file is still playing it doesn't switch +back to omxplayer as you might expect. + +This patch allows a switch back to omxplayer mode +--- + xbmc/cores/dvdplayer/DVDPlayer.cpp | 5 +++-- + xbmc/cores/omxplayer/OMXHelper.cpp | 3 +++ + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp +index 0ceae20..3fea73f 100644 +--- a/xbmc/cores/dvdplayer/DVDPlayer.cpp ++++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp +@@ -519,10 +519,11 @@ void CDVDPlayer::CreatePlayers() + { + CSingleLock lock(m_players_lock); + #ifdef HAS_OMXPLAYER +- if (m_omxplayer_mode && OMXPlayerUnsuitable(m_HasVideo, m_HasAudio, m_pDemuxer, m_pInputStream, m_SelectionStreams)) ++ bool omx_suitable = !OMXPlayerUnsuitable(m_HasVideo, m_HasAudio, m_pDemuxer, m_pInputStream, m_SelectionStreams); ++ if (m_omxplayer_mode != omx_suitable) + { + DestroyPlayers(); +- m_omxplayer_mode = false; ++ m_omxplayer_mode = omx_suitable; + } + #endif + if (m_players_created) +diff --git a/xbmc/cores/omxplayer/OMXHelper.cpp b/xbmc/cores/omxplayer/OMXHelper.cpp +index 59479fe..014eaf1 100644 +--- a/xbmc/cores/omxplayer/OMXHelper.cpp ++++ b/xbmc/cores/omxplayer/OMXHelper.cpp +@@ -44,6 +44,9 @@ static bool PredicateVideoPriority(const SelectionStream& lh, const SelectionStr + + bool OMXPlayerUnsuitable(bool m_HasVideo, bool m_HasAudio, CDVDDemux* m_pDemuxer, CDVDInputStream* m_pInputStream, CSelectionStreams &m_SelectionStreams) + { ++ // if no OMXPlayer acceleration then it is not suitable ++ if (!CSettings::Get().GetBool("videoplayer.useomxplayer")) ++ return true; + // if no MMAL acceleration stick with omxplayer regardless + if (!CSettings::Get().GetBool("videoplayer.usemmal")) + return false; + +From 32d171107d2184315f18e8eb7b23a78d218f2723 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 29 Jul 2015 21:05:41 +0100 +Subject: [PATCH 78/87] [omxplayer] Set audio properties for passthrough + +We weren't setting the stream_channels property for passthrough for omxplayer (we do with Pi Sink) +That means we were using 2 in number of channels of the AudioInfoFrame packet, rather then 0 +which is 'refer to stream header' which is correct for passthrough +--- + xbmc/cores/omxplayer/OMXAudio.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp +index 1911189..4072f7d 100644 +--- a/xbmc/cores/omxplayer/OMXAudio.cpp ++++ b/xbmc/cores/omxplayer/OMXAudio.cpp +@@ -731,6 +731,8 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo + + m_wave_header.dwChannelMask = m_src_chan_layout; + } ++ else ++ SetAudioProps(m_Passthrough, 0); + + m_SampleRate = m_format.m_sampleRate; + m_BitsPerSample = CAEUtil::DataFormatToBits(m_format.m_dataFormat); + +From d0279d2a4dade7122fa5a82b8a5c78faa95c35cb Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 31 Jul 2015 16:38:06 +0100 +Subject: [PATCH 79/87] squash: mmal: increase queue limit to 1 second to avoid + stalls + +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 6cf4023..7fea172 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -859,7 +859,7 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + else if (dts != DVD_NOPTS_VALUE) + m_demuxerPts = dts; + double queued = m_decoderPts != DVD_NOPTS_VALUE && m_demuxerPts != DVD_NOPTS_VALUE ? m_demuxerPts - m_decoderPts : 0.0; +- if (mmal_queue_length(m_dec_input_pool->queue) > 0 && !m_demux_queue_length && queued <= DVD_MSEC_TO_TIME(500)) ++ if (mmal_queue_length(m_dec_input_pool->queue) > 0 && !m_demux_queue_length && queued <= DVD_MSEC_TO_TIME(1000)) + { + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s - got space for output: demux_queue(%d) space(%d) queued(%.2f)", CLASSNAME, __func__, m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size, queued*1e-6); + +From c46855572563da98e026cb088a98ca70e7fd06fb Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 6 Aug 2015 11:25:08 +0100 +Subject: [PATCH 80/87] Revert "squash: release gfx lock when blocking" + +This reverts commit f10f0af15d0b57d148f5b3556fd9f94bb2f44509. +--- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index c80a8a6..2e2bc83 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -367,7 +367,6 @@ void CMMALRenderer::SubmitFrame(MMAL_BUFFER_HEADER_T *buffer) + #if defined(MMAL_DEBUG_VERBOSE) + CLog::Log(LOGDEBUG, "%s::%s - buffer:%p vfps:%.3f dfps:%.3f vsync:%d dsync:%d", CLASSNAME, __func__, buffer, m_fps, g_graphicsContext.GetFPS(), m_vsyncCount, CSettings::Get().GetBool("videoplayer.usedisplayasclock")); + #endif +- CSingleExit lock(g_graphicsContext); + m_vsyncCount = g_RBP.WaitVsync(m_vsyncCount) + 1; + #if defined(MMAL_DEBUG_VERBOSE) + CLog::Log(LOGDEBUG, "%s::%s - done vsync:%d", CLASSNAME, __func__, m_vsyncCount); + +From 6b04f338107be6c497f6b0632bfd77cf4b44eb93 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 6 Aug 2015 11:25:21 +0100 +Subject: [PATCH 81/87] Revert "[mmalrenderer] Wait for vsync before submitting + to mmal when display sync is disabled" + +This reverts commit f1a4416194f75f75e2145ec3fe64aee1177d3ccc. +--- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 23 ++--------------------- + xbmc/cores/VideoRenderers/MMALRenderer.h | 2 -- + 2 files changed, 2 insertions(+), 23 deletions(-) + +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index 2e2bc83..fb92079 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -208,7 +208,6 @@ CMMALRenderer::CMMALRenderer() + m_bMMALConfigured = false; + m_iYV12RenderBuffer = 0; + m_sharpness = -2.0f; +- m_vsyncCount = ~0; + } + + CMMALRenderer::~CMMALRenderer() +@@ -358,24 +357,6 @@ void CMMALRenderer::Update() + ManageDisplay(); + } + +-void CMMALRenderer::SubmitFrame(MMAL_BUFFER_HEADER_T *buffer) +-{ +- if (!CSettings::Get().GetBool("videoplayer.usedisplayasclock")) +- { +- if (fabs(m_fps - g_graphicsContext.GetFPS()) < 1e-2) +- { +- #if defined(MMAL_DEBUG_VERBOSE) +- CLog::Log(LOGDEBUG, "%s::%s - buffer:%p vfps:%.3f dfps:%.3f vsync:%d dsync:%d", CLASSNAME, __func__, buffer, m_fps, g_graphicsContext.GetFPS(), m_vsyncCount, CSettings::Get().GetBool("videoplayer.usedisplayasclock")); +- #endif +- m_vsyncCount = g_RBP.WaitVsync(m_vsyncCount) + 1; +- #if defined(MMAL_DEBUG_VERBOSE) +- CLog::Log(LOGDEBUG, "%s::%s - done vsync:%d", CLASSNAME, __func__, m_vsyncCount); +- #endif +- } +- } +- mmal_port_send_buffer(m_vout_input, buffer); +-} +- + void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + { + CSingleLock lock(m_sharedSection); +@@ -421,7 +402,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + return; + omvb->Acquire(); + omvb->mmal_buffer->flags |= MMAL_BUFFER_HEADER_FLAG_USER1 | MMAL_BUFFER_HEADER_FLAG_USER2; +- SubmitFrame(omvb->mmal_buffer); ++ mmal_port_send_buffer(m_vout_input, omvb->mmal_buffer); + } + else + CLog::Log(LOGDEBUG, "%s::%s - No buffer to update", CLASSNAME, __func__); +@@ -436,7 +417,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + return; + // sanity check it is not on display + buffer->mmal_buffer->flags |= MMAL_BUFFER_HEADER_FLAG_USER1 | MMAL_BUFFER_HEADER_FLAG_USER2; +- SubmitFrame(buffer->mmal_buffer); ++ mmal_port_send_buffer(m_vout_input, buffer->mmal_buffer); + } + else + CLog::Log(LOGDEBUG, "%s::%s - No buffer to update", CLASSNAME, __func__); +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.h b/xbmc/cores/VideoRenderers/MMALRenderer.h +index ec279ed..9bced7e 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.h ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.h +@@ -99,7 +99,6 @@ class CMMALRenderer : public CBaseRenderer + unsigned int m_destWidth; + unsigned int m_destHeight; + int m_neededBuffers; +- int m_vsyncCount; + + CRect m_src_rect; + CRect m_dst_rect; +@@ -116,5 +115,4 @@ class CMMALRenderer : public CBaseRenderer + bool init_vout(ERenderFormat format); + void ReleaseBuffers(); + void UnInitMMAL(); +- void SubmitFrame(MMAL_BUFFER_HEADER_T *buffer); + }; + +From 58caaea7ca2dd3fc49aa9a1eb0ddbb59b5a8d047 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 6 Aug 2015 11:25:30 +0100 +Subject: [PATCH 82/87] Revert "[rbp] Refactor the vsync handle to support + multiple callers" + +This reverts commit 68bd91282359a9da4645af4eeead7b2842f835eb. +--- + xbmc/linux/RBP.cpp | 68 ++++++++++++++++++++++++------------------------------ + xbmc/linux/RBP.h | 7 ++---- + 2 files changed, 32 insertions(+), 43 deletions(-) + +diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp +index 901250e..3953740 100644 +--- a/xbmc/linux/RBP.cpp ++++ b/xbmc/linux/RBP.cpp +@@ -66,7 +66,6 @@ CRBP::CRBP() + m_enabled = 0; + m_mb = mbox_open(); + vcsm_init(); +- m_vsync_count = 0; + } + + CRBP::~CRBP() +@@ -144,45 +143,11 @@ void CRBP::LogFirmwareVerison() + CLog::Log(LOGNOTICE, "Config:\n%s", response); + } + +-static void vsync_callback_static(DISPMANX_UPDATE_HANDLE_T u, void *arg) +-{ +- CRBP *rbp = reinterpret_cast(arg); +- rbp->VSyncCallback(); +-} +- +-void CRBP::VSyncCallback() +-{ +- CSingleLock lock(m_vsync_lock); +- m_vsync_count++; +- m_vsync_cond.notifyAll(); +-} +- +-unsigned int CRBP::WaitVsync(unsigned int target) +-{ +- CSingleLock lock(m_vsync_lock); +- if (target == ~0U) +- target = m_vsync_count+1; +- +- if (m_display == DISPMANX_NO_HANDLE) +- { +- CLog::Log(LOGDEBUG, "CRBP::%s skipping while display closed", __func__); +- return m_vsync_count; +- } +- +- while (m_vsync_count < target) +- if (!m_vsync_cond.wait(lock, 100)) +- break; +- +- return m_vsync_count; +-} +- + DISPMANX_DISPLAY_HANDLE_T CRBP::OpenDisplay(uint32_t device) + { + if (m_display == DISPMANX_NO_HANDLE) + { + m_display = vc_dispmanx_display_open( 0 /*screen*/ ); +- int s = vc_dispmanx_vsync_callback(m_display, vsync_callback_static, (void *)this); +- assert(s == 0); + init_cursor(); + } + return m_display; +@@ -191,11 +156,9 @@ DISPMANX_DISPLAY_HANDLE_T CRBP::OpenDisplay(uint32_t device) + void CRBP::CloseDisplay(DISPMANX_DISPLAY_HANDLE_T display) + { + assert(display == m_display); +- int s = vc_dispmanx_vsync_callback(m_display, NULL, NULL); +- assert(s == 0); +- uninit_cursor(); + vc_dispmanx_display_close(m_display); + m_display = DISPMANX_NO_HANDLE; ++ uninit_cursor(); + } + + void CRBP::GetDisplaySize(int &width, int &height) +@@ -248,6 +211,35 @@ unsigned char *CRBP::CaptureDisplay(int width, int height, int *pstride, bool sw + return image; + } + ++ ++static void vsync_callback(DISPMANX_UPDATE_HANDLE_T u, void *arg) ++{ ++ CEvent *sync = (CEvent *)arg; ++ sync->Set(); ++} ++ ++void CRBP::WaitVsync() ++{ ++ int s; ++ DISPMANX_DISPLAY_HANDLE_T m_display = vc_dispmanx_display_open( 0 /*screen*/ ); ++ if (m_display == DISPMANX_NO_HANDLE) ++ { ++ CLog::Log(LOGDEBUG, "CRBP::%s skipping while display closed", __func__); ++ return; ++ } ++ m_vsync.Reset(); ++ s = vc_dispmanx_vsync_callback(m_display, vsync_callback, (void *)&m_vsync); ++ if (s == 0) ++ { ++ m_vsync.WaitMSec(1000); ++ } ++ else assert(0); ++ s = vc_dispmanx_vsync_callback(m_display, NULL, NULL); ++ assert(s == 0); ++ vc_dispmanx_display_close( m_display ); ++} ++ ++ + void CRBP::Deinitialize() + { + if (m_omx_image_init) +diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h +index 0572b47..be0cafc 100644 +--- a/xbmc/linux/RBP.h ++++ b/xbmc/linux/RBP.h +@@ -65,8 +65,7 @@ class CRBP + // stride can be null for packed output + unsigned char *CaptureDisplay(int width, int height, int *stride, bool swap_red_blue, bool video_only = true); + DllOMX *GetDllOMX() { return m_OMX ? m_OMX->GetDll() : NULL; } +- unsigned int WaitVsync(unsigned int target = ~0U); +- void VSyncCallback(); ++ void WaitVsync(); + double AdjustHDMIClock(double adjust); + + private: +@@ -81,9 +80,7 @@ class CRBP + bool m_codec_wvc1_enabled; + COMXCore *m_OMX; + DISPMANX_DISPLAY_HANDLE_T m_display; +- CCriticalSection m_vsync_lock; +- XbmcThreads::ConditionVariable m_vsync_cond; +- unsigned int m_vsync_count; ++ CEvent m_vsync; + class DllLibOMXCore; + CCriticalSection m_critSection; + + +From af0aa61f6d78364f9b65c413b87d2e09953aa449 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 6 Aug 2015 11:23:05 +0100 +Subject: [PATCH 83/87] [rbp] Make sync playback to display the default option + +--- + system/settings/rbp.xml | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml +index bf3b05f..0743176 100644 +--- a/system/settings/rbp.xml ++++ b/system/settings/rbp.xml +@@ -1,6 +1,13 @@ + + +
++ ++ ++ ++ true ++ ++ ++ + + + false + +From 7470bc8ba9710bd15e180d96ee72ee58a545c766 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 31 Jul 2015 18:39:31 +0100 +Subject: [PATCH 84/87] [mmalcodec] Tidy up debug logging for decode + +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 16 ++++------------ + 1 file changed, 4 insertions(+), 12 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 7fea172..756b845 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -860,11 +860,7 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + m_demuxerPts = dts; + double queued = m_decoderPts != DVD_NOPTS_VALUE && m_demuxerPts != DVD_NOPTS_VALUE ? m_demuxerPts - m_decoderPts : 0.0; + if (mmal_queue_length(m_dec_input_pool->queue) > 0 && !m_demux_queue_length && queued <= DVD_MSEC_TO_TIME(1000)) +- { +- if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +- CLog::Log(LOGDEBUG, "%s::%s - got space for output: demux_queue(%d) space(%d) queued(%.2f)", CLASSNAME, __func__, m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size, queued*1e-6); + ret |= VC_BUFFER; +- } + else + m_preroll = false; + +@@ -873,21 +869,17 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + + if (!m_output_ready.empty() && !m_preroll) + { +- if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +- CLog::Log(LOGDEBUG, "%s::%s - got output picture:%d", CLASSNAME, __func__, m_output_ready.size()); + ret |= VC_PICTURE; + // renderer is low - give priority to returning pictures + if (0 && m_codecControlFlags & DVD_CODEC_CTRL_DRAIN) + ret &= ~VC_BUFFER; + } + if (!ret) +- { +- if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +- CLog::Log(LOGDEBUG, "%s::%s - Nothing to do: ready_queue(%d) demux_queue(%d) space(%d) preroll(%d)", +- CLASSNAME, __func__, m_output_ready.size(), m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size, m_preroll); +- lock.Leave(); + Sleep(10); // otherwise we busy spin +- } ++ ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s - ret(%x) pics(%d) demux_queue(%d) space(%d) queued(%.2f) preroll(%d) flags(%x)", CLASSNAME, __func__, ret, m_output_ready.size(), m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size, queued*1e-6, m_preroll, m_codecControlFlags); ++ + return ret; + } + + +From 4848cab3632652bfaa89f0e822a1b224015f2427 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 6 Aug 2015 13:25:32 +0100 +Subject: [PATCH 85/87] [rbp] Don't enable DTS-HD by default on Pi2 + +Reports of no audio with omxplayer and this enabled +that are not yet understood +--- + system/settings/rbp2.xml | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/system/settings/rbp2.xml b/system/settings/rbp2.xml +index 1c8b116..52778ecd 100644 +--- a/system/settings/rbp2.xml ++++ b/system/settings/rbp2.xml +@@ -19,11 +19,6 @@ + + + +- +- +- true +- +- + + + + +From 4a133a4a6c64f9c4811f10e8cecd4036080d15b8 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 7 Aug 2015 18:09:09 +0100 +Subject: [PATCH 86/87] Revert "[rbp] Don't enable DTS-HD by default on Pi2" + +This reverts commit 8166e8990b8cf599cc4eb1641c58fad1f1f0821f. +--- + system/settings/rbp2.xml | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/system/settings/rbp2.xml b/system/settings/rbp2.xml +index 52778ecd..1c8b116 100644 +--- a/system/settings/rbp2.xml ++++ b/system/settings/rbp2.xml +@@ -19,6 +19,11 @@ + + + ++ ++ ++ true ++ ++ + + + diff --git a/projects/RPi/patches/linux/linux-01-RPi_support.patch b/projects/RPi/patches/linux/linux-01-RPi_support.patch index 9da370c113..d6377736e5 100644 --- a/projects/RPi/patches/linux/linux-01-RPi_support.patch +++ b/projects/RPi/patches/linux/linux-01-RPi_support.patch @@ -1,7 +1,7 @@ -From f12410478cffff991f5e3c3d3fd68bab0bd33c2c Mon Sep 17 00:00:00 2001 +From 0e8bd84a8406e37307c00a246c5a0f62aac6b8d3 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 12 May 2013 12:24:19 +0100 -Subject: [PATCH 001/105] Main bcm2708/bcm2709 linux port +Subject: [PATCH 001/149] Main bcm2708/bcm2709 linux port MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -7002,370 +7002,10 @@ index b5bedae..b0258e8 100644 mmc_pm_flag_t pm_caps; /* supported pm features */ -From e3d3c97f9f253df42f218071e9f9bb7fd8f602f0 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 16 Jun 2015 23:48:09 +0100 -Subject: [PATCH 002/105] power: Add power driver -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: popcornmix - -BCM270x: power: Change initcall level to subsys - -Load ordering of modules are determined by the initcall used. -If it's the same initcall level, makefile ordering decides. -Now that the mailbox driver is being moved, it's no longer -placed before the power driver by the linker. -So use a later initcall level to let the mailbox driver -load first. - -Signed-off-by: Noralf Trønnes - -BCM270x: Move power module - -Make the power module available on ARCH_BCM2835 by moving it. -The module turns on USB power making it possible to boot -ARCH_BCM2835 directly with the VC bootloader. - -Signed-off-by: Noralf Trønnes ---- - drivers/soc/Kconfig | 1 + - drivers/soc/Makefile | 1 + - drivers/soc/bcm2835/Kconfig | 9 ++ - drivers/soc/bcm2835/Makefile | 1 + - drivers/soc/bcm2835/bcm2708-power.c | 200 ++++++++++++++++++++++++++++++++++++ - include/soc/bcm2835/power.h | 61 +++++++++++ - 6 files changed, 273 insertions(+) - create mode 100644 drivers/soc/bcm2835/Kconfig - create mode 100644 drivers/soc/bcm2835/Makefile - create mode 100644 drivers/soc/bcm2835/bcm2708-power.c - create mode 100644 include/soc/bcm2835/power.h - -diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig -index d8bde82..595c9cd 100644 ---- a/drivers/soc/Kconfig -+++ b/drivers/soc/Kconfig -@@ -1,5 +1,6 @@ - menu "SOC (System On Chip) specific Drivers" - -+source "drivers/soc/bcm2835/Kconfig" - source "drivers/soc/mediatek/Kconfig" - source "drivers/soc/qcom/Kconfig" - source "drivers/soc/ti/Kconfig" -diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile -index 70042b2..9ad449c 100644 ---- a/drivers/soc/Makefile -+++ b/drivers/soc/Makefile -@@ -2,6 +2,7 @@ - # Makefile for the Linux Kernel SOC specific device drivers. - # - -+obj-y += bcm2835/ - obj-$(CONFIG_ARCH_MEDIATEK) += mediatek/ - obj-$(CONFIG_ARCH_QCOM) += qcom/ - obj-$(CONFIG_ARCH_TEGRA) += tegra/ -diff --git a/drivers/soc/bcm2835/Kconfig b/drivers/soc/bcm2835/Kconfig -new file mode 100644 -index 0000000..c2980f3 ---- /dev/null -+++ b/drivers/soc/bcm2835/Kconfig -@@ -0,0 +1,9 @@ -+# -+# BCM2835 Soc drivers -+# -+config BCM2708_POWER -+ tristate "BCM2708 legacy power driver" -+ depends on (ARCH_BCM2708 || ARCH_BCM2709 || ARCH_BCM2835) && BCM2708_MBOX -+ default y -+ help -+ Turns on USB power and provides an API for controlling power. -diff --git a/drivers/soc/bcm2835/Makefile b/drivers/soc/bcm2835/Makefile -new file mode 100644 -index 0000000..3614ad9 ---- /dev/null -+++ b/drivers/soc/bcm2835/Makefile -@@ -0,0 +1 @@ -+obj-$(CONFIG_BCM2708_POWER) += bcm2708-power.o -diff --git a/drivers/soc/bcm2835/bcm2708-power.c b/drivers/soc/bcm2835/bcm2708-power.c -new file mode 100644 -index 0000000..e7931a9 ---- /dev/null -+++ b/drivers/soc/bcm2835/bcm2708-power.c -@@ -0,0 +1,200 @@ -+/* -+ * linux/arch/arm/mach-bcm2708/power.c -+ * -+ * Copyright (C) 2010 Broadcom -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ * This device provides a shared mechanism for controlling the power to -+ * VideoCore subsystems. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#define DRIVER_NAME "bcm2708_power" -+ -+#define BCM_POWER_MAXCLIENTS 4 -+#define BCM_POWER_NOCLIENT (1<<31) -+ -+/* Some drivers expect there devices to be permanently powered */ -+ -+#ifdef CONFIG_USB -+#define BCM_POWER_ALWAYS_ON (BCM_POWER_USB) -+#endif -+ -+#if 1 -+#define DPRINTK printk -+#else -+#define DPRINTK if (0) printk -+#endif -+ -+struct state_struct { -+ uint32_t global_request; -+ uint32_t client_request[BCM_POWER_MAXCLIENTS]; -+ struct semaphore client_mutex; -+ struct semaphore mutex; -+} g_state; -+ -+int bcm_power_open(BCM_POWER_HANDLE_T *handle) -+{ -+ BCM_POWER_HANDLE_T i; -+ int ret = -EBUSY; -+ -+ down(&g_state.client_mutex); -+ -+ for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) { -+ if (g_state.client_request[i] == BCM_POWER_NOCLIENT) { -+ g_state.client_request[i] = BCM_POWER_NONE; -+ *handle = i; -+ ret = 0; -+ break; -+ } -+ } -+ -+ up(&g_state.client_mutex); -+ -+ DPRINTK("bcm_power_open() -> %d\n", *handle); -+ -+ return ret; -+} -+EXPORT_SYMBOL_GPL(bcm_power_open); -+ -+int bcm_power_request(BCM_POWER_HANDLE_T handle, uint32_t request) -+{ -+ int rc = 0; -+ -+ DPRINTK("bcm_power_request(%d, %x)\n", handle, request); -+ -+ if ((handle < BCM_POWER_MAXCLIENTS) && -+ (g_state.client_request[handle] != BCM_POWER_NOCLIENT)) { -+ if (down_interruptible(&g_state.mutex) != 0) { -+ DPRINTK("bcm_power_request -> interrupted\n"); -+ return -EINTR; -+ } -+ -+ if (request != g_state.client_request[handle]) { -+ uint32_t others_request = 0; -+ uint32_t global_request; -+ BCM_POWER_HANDLE_T i; -+ -+ for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) { -+ if (i != handle) -+ others_request |= -+ g_state.client_request[i]; -+ } -+ others_request &= ~BCM_POWER_NOCLIENT; -+ -+ global_request = request | others_request; -+ if (global_request != g_state.global_request) { -+ uint32_t actual; -+ -+ /* Send a request to VideoCore */ -+ bcm_mailbox_write(MBOX_CHAN_POWER, -+ global_request << 4); -+ -+ /* Wait for a response during power-up */ -+ if (global_request & ~g_state.global_request) { -+ rc = bcm_mailbox_read(MBOX_CHAN_POWER, -+ &actual); -+ DPRINTK -+ ("bcm_mailbox_read -> %08x, %d\n", -+ actual, rc); -+ actual >>= 4; -+ } else { -+ rc = 0; -+ actual = global_request; -+ } -+ -+ if (rc == 0) { -+ if (actual != global_request) { -+ printk(KERN_ERR -+ "%s: prev global %x, new global %x, actual %x, request %x, others_request %x\n", -+ __func__, -+ g_state.global_request, -+ global_request, actual, request, others_request); -+ /* A failure */ -+ BUG_ON((others_request & actual) -+ != others_request); -+ request &= actual; -+ rc = -EIO; -+ } -+ -+ g_state.global_request = actual; -+ g_state.client_request[handle] = -+ request; -+ } -+ } -+ } -+ up(&g_state.mutex); -+ } else { -+ rc = -EINVAL; -+ } -+ DPRINTK("bcm_power_request -> %d\n", rc); -+ return rc; -+} -+EXPORT_SYMBOL_GPL(bcm_power_request); -+ -+int bcm_power_close(BCM_POWER_HANDLE_T handle) -+{ -+ int rc; -+ -+ DPRINTK("bcm_power_close(%d)\n", handle); -+ -+ rc = bcm_power_request(handle, BCM_POWER_NONE); -+ if (rc == 0) -+ g_state.client_request[handle] = BCM_POWER_NOCLIENT; -+ -+ return rc; -+} -+EXPORT_SYMBOL_GPL(bcm_power_close); -+ -+static int __init bcm_power_init(void) -+{ -+#if defined(BCM_POWER_ALWAYS_ON) -+ BCM_POWER_HANDLE_T always_on_handle; -+#endif -+ int rc = 0; -+ int i; -+ -+ printk(KERN_INFO "bcm_power: Broadcom power driver\n"); -+ bcm_mailbox_write(MBOX_CHAN_POWER, 0); -+ -+ for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) -+ g_state.client_request[i] = BCM_POWER_NOCLIENT; -+ -+ sema_init(&g_state.client_mutex, 1); -+ sema_init(&g_state.mutex, 1); -+ -+ g_state.global_request = 0; -+ -+#if defined(BCM_POWER_ALWAYS_ON) -+ if (BCM_POWER_ALWAYS_ON) { -+ bcm_power_open(&always_on_handle); -+ bcm_power_request(always_on_handle, BCM_POWER_ALWAYS_ON); -+ } -+#endif -+ -+ return rc; -+} -+ -+static void __exit bcm_power_exit(void) -+{ -+ bcm_mailbox_write(MBOX_CHAN_POWER, 0); -+} -+ -+/* -+ * Load after the mailbox driver is initialized (arch_initcall), -+ * but before depending drivers (module_init). -+ */ -+subsys_initcall(bcm_power_init); -+module_exit(bcm_power_exit); -+ -+MODULE_AUTHOR("Phil Elwell"); -+MODULE_DESCRIPTION("Interface to BCM2708 power management"); -+MODULE_LICENSE("GPL"); -diff --git a/include/soc/bcm2835/power.h b/include/soc/bcm2835/power.h -new file mode 100644 -index 0000000..bf22b26 ---- /dev/null -+++ b/include/soc/bcm2835/power.h -@@ -0,0 +1,61 @@ -+/* -+ * Copyright (C) 2010 Broadcom -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ * This device provides a shared mechanism for controlling the power to -+ * VideoCore subsystems. -+ */ -+ -+#ifndef _BCM2708_POWER_H -+#define _BCM2708_POWER_H -+ -+#include -+ -+/* Use meaningful names on each side */ -+#ifdef __VIDEOCORE__ -+#define PREFIX(x) ARM_##x -+#else -+#define PREFIX(x) BCM_##x -+#endif -+ -+enum { -+ PREFIX(POWER_SDCARD_BIT), -+ PREFIX(POWER_UART_BIT), -+ PREFIX(POWER_MINIUART_BIT), -+ PREFIX(POWER_USB_BIT), -+ PREFIX(POWER_I2C0_BIT), -+ PREFIX(POWER_I2C1_BIT), -+ PREFIX(POWER_I2C2_BIT), -+ PREFIX(POWER_SPI_BIT), -+ PREFIX(POWER_CCP2TX_BIT), -+ PREFIX(POWER_DSI_BIT), -+ -+ PREFIX(POWER_MAX) -+}; -+ -+enum { -+ PREFIX(POWER_SDCARD) = (1 << PREFIX(POWER_SDCARD_BIT)), -+ PREFIX(POWER_UART) = (1 << PREFIX(POWER_UART_BIT)), -+ PREFIX(POWER_MINIUART) = (1 << PREFIX(POWER_MINIUART_BIT)), -+ PREFIX(POWER_USB) = (1 << PREFIX(POWER_USB_BIT)), -+ PREFIX(POWER_I2C0) = (1 << PREFIX(POWER_I2C0_BIT)), -+ PREFIX(POWER_I2C1_MASK) = (1 << PREFIX(POWER_I2C1_BIT)), -+ PREFIX(POWER_I2C2_MASK) = (1 << PREFIX(POWER_I2C2_BIT)), -+ PREFIX(POWER_SPI_MASK) = (1 << PREFIX(POWER_SPI_BIT)), -+ PREFIX(POWER_CCP2TX_MASK) = (1 << PREFIX(POWER_CCP2TX_BIT)), -+ PREFIX(POWER_DSI) = (1 << PREFIX(POWER_DSI_BIT)), -+ -+ PREFIX(POWER_MASK) = (1 << PREFIX(POWER_MAX)) - 1, -+ PREFIX(POWER_NONE) = 0 -+}; -+ -+typedef unsigned int BCM_POWER_HANDLE_T; -+ -+extern int bcm_power_open(BCM_POWER_HANDLE_T *handle); -+extern int bcm_power_request(BCM_POWER_HANDLE_T handle, uint32_t request); -+extern int bcm_power_close(BCM_POWER_HANDLE_T handle); -+ -+#endif - -From 6f7a17a848b57ac66f13d9ee9f09f4be89e74824 Mon Sep 17 00:00:00 2001 +From 347ffd7de4bb0ccd64731fb76814dd9e626bf1c5 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 8 Oct 2014 18:50:05 +0100 -Subject: [PATCH 003/105] Add bcm2708_gpio driver +Subject: [PATCH 002/149] Add bcm2708_gpio driver Signed-off-by: popcornmix @@ -7995,10 +7635,10 @@ index 0000000..fb69624 + +#endif -From e1fa284edd01b1a623096845dbe54c8d936aaaaf Mon Sep 17 00:00:00 2001 +From eb3917f2c39b485511607da826cd9dbba16751b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 1 May 2015 19:11:03 +0200 -Subject: [PATCH 004/105] mailbox: bcm2708: Add bcm2708-vcio +Subject: [PATCH 003/149] mailbox: bcm2708: Add bcm2708-vcio MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -8629,10 +8269,10 @@ index 0000000..cc284ed + +#endif -From 495cfff15f23f9b3ee26b0b92673ad77fc3e8d22 Mon Sep 17 00:00:00 2001 +From dac4f2f5791de43cb28c829c03b74b03187b7535 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 19:46:17 +0100 -Subject: [PATCH 005/105] Add dwc_otg driver +Subject: [PATCH 004/149] Add dwc_otg driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -9540,10 +9180,10 @@ index 358ca8d..abaac7c 100644 return i; } diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index 3b71516..8324c14 100644 +index 1e9a8c9..7e9f79f 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c -@@ -4922,7 +4922,7 @@ static void port_event(struct usb_hub *hub, int port1) +@@ -4906,7 +4906,7 @@ static void port_event(struct usb_hub *hub, int port1) if (portchange & USB_PORT_STAT_C_OVERCURRENT) { u16 status = 0, unused; @@ -69906,10 +69546,10 @@ index 0000000..cdc9963 +test_main(); +0; -From 2fee602715f8de08540132094fe160dd21978680 Mon Sep 17 00:00:00 2001 +From cb7293f71c4de308f8d2f1dda81889fa1ccc5f70 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 19:54:32 +0100 -Subject: [PATCH 006/105] bcm2708 watchdog driver +Subject: [PATCH 005/149] bcm2708 watchdog driver Signed-off-by: popcornmix --- @@ -70346,10 +69986,10 @@ index 0000000..8a27d68 +MODULE_ALIAS_MISCDEV(TEMP_MINOR); +MODULE_LICENSE("GPL"); -From 164b737c320aca85798130a904c964f748423937 Mon Sep 17 00:00:00 2001 +From 3f93f22131290ce805bd9fe0a2c23fc23e9d0d02 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 17:06:34 +0100 -Subject: [PATCH 007/105] bcm2708 framebuffer driver +Subject: [PATCH 006/149] bcm2708 framebuffer driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -73788,10 +73428,10 @@ index 3c14e43..7626beb6a 100644 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 -From b1c418d504c5c7b800fee387abf9a03af0e1b4a4 Mon Sep 17 00:00:00 2001 +From d7b8efef115448b4899c4d3327cbdfed06144d29 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:22:53 +0100 -Subject: [PATCH 008/105] dmaengine: Add support for BCM2708 +Subject: [PATCH 007/149] dmaengine: Add support for BCM2708 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -75559,10 +75199,10 @@ index 0000000..2310e34 + +#endif /* _PLAT_BCM2708_DMA_H */ -From 8500a8de635dc4ce251330dfe0950453689d7a65 Mon Sep 17 00:00:00 2001 +From c5a2f57f382bb863ec39be702d5c7dd1abf43a1e Mon Sep 17 00:00:00 2001 From: gellert Date: Fri, 15 Aug 2014 16:35:06 +0100 -Subject: [PATCH 009/105] MMC: added alternative MMC driver +Subject: [PATCH 008/149] MMC: added alternative MMC driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -77378,10 +77018,10 @@ index 0000000..b7c4883 +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Gellert Weisz"); -From 6a1f159f160fec9d7b8f10cc0b37c79c58be80c8 Mon Sep 17 00:00:00 2001 +From 42f6bf501dfd96a293a001811c66f81a599a7c0a Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 25 Mar 2015 17:49:47 +0000 -Subject: [PATCH 010/105] Adding bcm2835-sdhost driver, and an overlay to +Subject: [PATCH 009/149] Adding bcm2835-sdhost driver, and an overlay to enable it BCM2835 has two SD card interfaces. This driver uses the other one. @@ -79151,10 +78791,10 @@ index 0000000..eef8a24 +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Phil Elwell"); -From 8f5a0afb8bc65e48695b38a33dba8a17bb0c4218 Mon Sep 17 00:00:00 2001 +From 4e1d2a7a36c3a6a50b8e3e180840f5de3c59dab9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:31:47 +0100 -Subject: [PATCH 011/105] cma: Add vc_cma driver to enable use of CMA +Subject: [PATCH 010/149] cma: Add vc_cma driver to enable use of CMA Signed-off-by: popcornmix @@ -80479,10 +80119,10 @@ index 0000000..5325832 + +#endif /* VC_CMA_H */ -From 8af8b7d264e546ee29b28acca735bd4ce8dbdb71 Mon Sep 17 00:00:00 2001 +From 0e75dc8f6ada5d524b64787a3f6a1f7774c19ad1 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 26 Mar 2012 22:15:50 +0100 -Subject: [PATCH 012/105] bcm2708: alsa sound driver +Subject: [PATCH 011/149] bcm2708: alsa sound driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -83324,10 +82964,10 @@ index 0000000..af3e6eb + +#endif // _VC_AUDIO_DEFS_H_ -From d01fbc5cd5784094ffe247f269eaa1b31bb023d5 Mon Sep 17 00:00:00 2001 +From f99733b7c93f18f7bb2519462760a71817e2282c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 2 Jul 2013 23:42:01 +0100 -Subject: [PATCH 013/105] bcm2708 vchiq driver +Subject: [PATCH 012/149] bcm2708 vchiq driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -96581,10 +96221,10 @@ index 0000000..b6bfa21 + return vchiq_build_time; +} -From efc783d883c14618d52d0d804a856ee31a152fcb Mon Sep 17 00:00:00 2001 +From bb99de1085903aae1acd33f9333636668a2d0940 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 16:07:06 +0100 -Subject: [PATCH 014/105] vc_mem: Add vc_mem driver +Subject: [PATCH 013/149] vc_mem: Add vc_mem driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -97590,10 +97230,10 @@ index 0000000..20a4753 + +#endif /* _VC_MEM_H */ -From 72c49d81f0dd002228b6cb26db9e5428eef39d41 Mon Sep 17 00:00:00 2001 +From 2835e674ab3568be62a2cd50e060f4172c6d7760 Mon Sep 17 00:00:00 2001 From: Tim Gover Date: Tue, 22 Jul 2014 15:41:04 +0100 -Subject: [PATCH 015/105] vcsm: VideoCore shared memory service for BCM2835 +Subject: [PATCH 014/149] vcsm: VideoCore shared memory service for BCM2835 Add experimental support for the VideoCore shared memory service. This allows user processes to allocate memory from VideoCore's @@ -102003,10 +101643,10 @@ index 0000000..0bfb42e +MODULE_DESCRIPTION("VideoCore SharedMemory Driver"); +MODULE_LICENSE("GPL v2"); -From 6b13df3a424914c3db0687d471236611c0cd6d60 Mon Sep 17 00:00:00 2001 +From d956b1bd6c339852f27e912d2e79ed1ae1f770d3 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:51:55 +0100 -Subject: [PATCH 016/105] Add hwrng (hardware random number generator) driver +Subject: [PATCH 015/149] Add hwrng (hardware random number generator) driver --- drivers/char/hw_random/Kconfig | 13 +++- @@ -102183,10 +101823,10 @@ index 0000000..340f004 +MODULE_DESCRIPTION("BCM2708 H/W Random Number Generator (RNG) driver"); +MODULE_LICENSE("GPL and additional rights"); -From 71858ccb0a96e022238c9644177fcbf891807ffd Mon Sep 17 00:00:00 2001 +From 0a234b968ca8409fdf24ee38b84144ea6df901c1 Mon Sep 17 00:00:00 2001 From: Aron Szabo Date: Sat, 16 Jun 2012 12:15:55 +0200 -Subject: [PATCH 017/105] lirc: added support for RaspberryPi GPIO +Subject: [PATCH 016/149] lirc: added support for RaspberryPi GPIO lirc_rpi: Use read_current_timer to determine transmitter delay. Thanks to jjmz and others See: https://github.com/raspberrypi/linux/issues/525 @@ -103039,10 +102679,10 @@ index 0000000..24563ec +module_param(debug, bool, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(debug, "Enable debugging messages"); -From 36fe69547259b45803b0cb11085d60374c92446a Mon Sep 17 00:00:00 2001 +From 8aa5df1654dc0d99e6edaee56960a62a759642f6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:49:20 +0100 -Subject: [PATCH 018/105] Add cpufreq driver +Subject: [PATCH 017/149] Add cpufreq driver Signed-off-by: popcornmix --- @@ -103315,10 +102955,10 @@ index 0000000..6735da9 +module_init(bcm2835_cpufreq_module_init); +module_exit(bcm2835_cpufreq_module_exit); -From 50d7170ec5cf300e239ab575de3e0917ec44b8a6 Mon Sep 17 00:00:00 2001 +From a78e95402f25318bb6049c253a586bdabf0e3934 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 19:24:24 +0000 -Subject: [PATCH 019/105] Added hwmon/thermal driver for reporting core +Subject: [PATCH 018/149] Added hwmon/thermal driver for reporting core temperature. Thanks Dorian MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -103615,10 +103255,10 @@ index 0000000..3bc80f1 + +module_platform_driver(bcm2835_thermal_driver); -From 4011c7c5c3c5a03af182dbed2e824a491d12e96c Mon Sep 17 00:00:00 2001 +From fe524efc70536aa67e3568f97bc373031e4de4ea Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 15:41:33 +0100 -Subject: [PATCH 020/105] Add Chris Boot's spi driver. +Subject: [PATCH 019/149] Add Chris Boot's spi driver. spi: bcm2708: add device tree support @@ -104530,10 +104170,10 @@ index 0000000..041b5e2 +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRV_NAME); -From 04e6956b7d15554967ca2620563efc31a63cd69e Mon Sep 17 00:00:00 2001 +From b42f499d093bb6ed2991c6f304338bff3a85b429 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 15:44:08 +0100 -Subject: [PATCH 021/105] Add Chris Boot's i2c driver +Subject: [PATCH 020/149] Add Chris Boot's i2c driver i2c-bcm2708: fixed baudrate @@ -105334,10 +104974,10 @@ index 0000000..8773203 +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRV_NAME); -From 9ed8236717339aab28673519a2300e6f0165d2da Mon Sep 17 00:00:00 2001 +From 8e40d3346d2607cee13a9eee8c2357b1c0cdb48a Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 30 Jan 2013 12:45:18 +0000 -Subject: [PATCH 022/105] bcm2835: add v4l2 camera device +Subject: [PATCH 021/149] bcm2835: add v4l2 camera device - Supports raw YUV capture, preview, JPEG and H264. - Uses videobuf2 for data transfer, using dma_buf. @@ -112664,10 +112304,10 @@ index 0000000..9d1d11e + +#endif /* MMAL_VCHIQ_H */ -From 8daf7f4a4f40fd1d6008fa8438d72ae3c9f2cd4f Mon Sep 17 00:00:00 2001 +From 7a4688d4481948917c7d09d4745c21c7f802da18 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 23 Jan 2015 14:48:55 +0000 -Subject: [PATCH 023/105] scripts/dtc: Update to upstream version with overlay +Subject: [PATCH 022/149] scripts/dtc: Update to upstream version with overlay patches --- @@ -117515,7 +117155,7 @@ index 665dad7..f439b40 100644 } diff --git a/scripts/dtc/fstree.c b/scripts/dtc/fstree.c -index e464727..6e5878a 100644 +index e464727c..6e5878a 100644 --- a/scripts/dtc/fstree.c +++ b/scripts/dtc/fstree.c @@ -37,26 +37,26 @@ static struct node *read_fstree(const char *dirname) @@ -117880,10 +117520,10 @@ index 54d4e904..d644002 100644 -#define DTC_VERSION "DTC 1.4.0-dirty" +#define DTC_VERSION "DTC 1.4.1-g36c70742" -From 0d794d8e6cccfbefeb6320acf871913dcd94d2ff Mon Sep 17 00:00:00 2001 +From e9e0f3cef41db19f29ab37a403feabe9f55f83fc Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 11 May 2015 09:00:42 +0100 -Subject: [PATCH 024/105] scripts: Add mkknlimg and knlinfo scripts from tools +Subject: [PATCH 023/149] scripts: Add mkknlimg and knlinfo scripts from tools repo The Raspberry Pi firmware looks for a trailer on the kernel image to @@ -118368,10 +118008,10 @@ index 0000000..3dff948 + return (($val eq 'y') || ($val eq '1')); +} -From 79ae5c40586808d01368549b13b3c7a4709c9564 Mon Sep 17 00:00:00 2001 +From 996a96ca5045f3ea6e39192d242062441c3c797b Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 5 Dec 2014 17:26:26 +0000 -Subject: [PATCH 025/105] fdt: Add support for the CONFIG_CMDLINE_EXTEND option +Subject: [PATCH 024/149] fdt: Add support for the CONFIG_CMDLINE_EXTEND option --- drivers/of/fdt.c | 29 ++++++++++++++++++++++++----- @@ -118426,10 +118066,10 @@ index cde35c5d01..dd7fbfe 100644 pr_debug("Command line is: %s\n", (char*)data); -From 01a18bea60e6b60a6fcb0a58faaf34f1b5cc0281 Mon Sep 17 00:00:00 2001 +From 25f3e064afc8b7be40bc92af946b59bce9ed6c58 Mon Sep 17 00:00:00 2001 From: notro Date: Wed, 9 Jul 2014 14:46:08 +0200 -Subject: [PATCH 026/105] BCM2708: Add core Device Tree support +Subject: [PATCH 025/149] BCM2708: Add core Device Tree support Add the bare minimum needed to boot BCM2708 from a Device Tree. @@ -122306,10 +121946,10 @@ index 0000000..66a98f6 + }; +}; -From 7c5cfbcdfa96680f63b0e82202ab509ef78bc023 Mon Sep 17 00:00:00 2001 +From d4f6c4010632825e49b58d95db228b4ab394f3f0 Mon Sep 17 00:00:00 2001 From: Siarhei Siamashka Date: Mon, 17 Jun 2013 13:32:11 +0300 -Subject: [PATCH 027/105] fbdev: add FBIOCOPYAREA ioctl +Subject: [PATCH 026/149] fbdev: add FBIOCOPYAREA ioctl Based on the patch authored by Ali Gholami Rudi at https://lkml.org/lkml/2009/7/13/153 @@ -122402,10 +122042,10 @@ index fb795c3..fa72af0 100644 #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ #define FB_TYPE_PLANES 1 /* Non interleaved planes */ -From b16b65cdb4064e32b321e4d3801bc1990ee258f7 Mon Sep 17 00:00:00 2001 +From 5539b4d21d0d0485e548a1bd0bc259abc7403767 Mon Sep 17 00:00:00 2001 From: Harm Hanemaaijer Date: Thu, 20 Jun 2013 20:21:39 +0200 -Subject: [PATCH 030/105] Speed up console framebuffer imageblit function +Subject: [PATCH 029/149] Speed up console framebuffer imageblit function Especially on platforms with a slower CPU but a relatively high framebuffer fill bandwidth, like current ARM devices, the existing @@ -122614,10 +122254,10 @@ index a2bb276..436494f 100644 start_index, pitch_index); } else -From bda0a510175903069a6e36ee03df8bb58da535fc Mon Sep 17 00:00:00 2001 +From 683a06a250e735c94ec3640d9288528ee50ddf16 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 17:26:38 +0000 -Subject: [PATCH 031/105] Allow mac address to be set in smsc95xx +Subject: [PATCH 030/149] Allow mac address to be set in smsc95xx Signed-off-by: popcornmix --- @@ -122708,10 +122348,10 @@ index 26423ad..e29a323 100644 if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN, dev->net->dev_addr) == 0) { -From cc2b2db4dd1eea70daf6a7b2122bc2cc4fff16b5 Mon Sep 17 00:00:00 2001 +From 4f3ab22c324a811dda12f53cd9e77d3a32c3a113 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 8 May 2013 11:46:50 +0100 -Subject: [PATCH 032/105] enabling the realtime clock 1-wire chip DS1307 and +Subject: [PATCH 031/149] enabling the realtime clock 1-wire chip DS1307 and 1-wire on GPIO4 (as a module) 1-wire: Add support for configuring pin for w1-gpio kernel module @@ -123109,10 +122749,10 @@ index d58594a..feae942 100644 unsigned int ext_pullup_enable_pin; unsigned int pullup_duration; -From f0f58bbd87e81fe4ff162b11faedbacc6b0c8f38 Mon Sep 17 00:00:00 2001 +From 853fe067aeff8a0be4027b63f50dd0478103f723 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 18 Dec 2013 22:16:19 +0000 -Subject: [PATCH 034/105] config: Enable CONFIG_MEMCG, but leave it disabled +Subject: [PATCH 033/149] config: Enable CONFIG_MEMCG, but leave it disabled (due to memory cost). Enable with cgroup_enable=memory. --- @@ -123121,10 +122761,10 @@ Subject: [PATCH 034/105] config: Enable CONFIG_MEMCG, but leave it disabled 2 files changed, 24 insertions(+) diff --git a/kernel/cgroup.c b/kernel/cgroup.c -index 469dd54..c9684da 100644 +index e8a5491..2428355 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c -@@ -5395,6 +5395,29 @@ static int __init cgroup_disable(char *str) +@@ -5393,6 +5393,29 @@ static int __init cgroup_disable(char *str) } __setup("cgroup_disable=", cgroup_disable); @@ -123167,10 +122807,10 @@ index a04225d..a2ef8af 100644 /** -From c475efe6fd77dc1288117ba41451f11c7e46c74c Mon Sep 17 00:00:00 2001 +From 02f4298dead0071add7bb58678d7451bf06d4b7f Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:33:38 +0100 -Subject: [PATCH 035/105] ASoC: Add support for BCM2708 +Subject: [PATCH 034/149] ASoC: Add support for BCM2708 This driver adds support for digital audio (I2S) for the BCM2708 SoC that is used by the @@ -124313,10 +123953,10 @@ index 0000000..6fdcbc1 + +#endif -From ea9da38e0ab7aae107b1b2cb86f9e6728c54f72d Mon Sep 17 00:00:00 2001 +From 9dca125b0468d40894de4138982400ba5b833e4d Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:59:51 +0100 -Subject: [PATCH 036/105] ASoC: Add support for PCM5102A codec +Subject: [PATCH 035/149] ASoC: Add support for PCM5102A codec Some definitions to support the PCM5102A codec by Texas Instruments. @@ -124441,10 +124081,10 @@ index 0000000..126f1e9 +MODULE_AUTHOR("Florian Meier "); +MODULE_LICENSE("GPL v2"); -From 3843c763a49f690052a369c75a4b91e63e65ccd3 Mon Sep 17 00:00:00 2001 +From 45a02391f0fa3d34235ff795c299638fbf3f5773 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:04:54 +0100 -Subject: [PATCH 037/105] BCM2708: Add I2S support to board file +Subject: [PATCH 036/149] BCM2708: Add I2S support to board file Adds the required initializations for I2S to the board file of mach-bcm2708. @@ -124533,10 +124173,10 @@ index a3b65dc..a515992 100644 for (i = 0; i <= 1; i++) { void __iomem *base; -From 9305f38947159f8027408f9caf57ff11d3a14e5d Mon Sep 17 00:00:00 2001 +From 19cea6e827bb706afe8bb57e43ee5f3fa7cd1731 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:19:08 +0100 -Subject: [PATCH 038/105] ASoC: Add support for HifiBerry DAC +Subject: [PATCH 037/149] ASoC: Add support for HifiBerry DAC This adds a machine driver for the HifiBerry DAC. It is a sound card that can @@ -124685,10 +124325,10 @@ index 0000000..4b70b45 +MODULE_DESCRIPTION("ASoC Driver for HifiBerry DAC"); +MODULE_LICENSE("GPL v2"); -From d48fc2d392448b821b9ff95e26cf859f2efe4794 Mon Sep 17 00:00:00 2001 +From 7528f3f5f51e0f304d5726a82dd9178f87b1ca41 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:21:34 +0100 -Subject: [PATCH 039/105] BCM2708: Add HifiBerry DAC to board file +Subject: [PATCH 038/149] BCM2708: Add HifiBerry DAC to board file This adds the initalization of the HifiBerry DAC to the mach-bcm2708 board file. @@ -124736,10 +124376,10 @@ index 01f2de7..1d9b788 100644 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { struct amba_device *d = amba_devs[i]; -From 1d90a3734460be00e20106847f347ff0bd4c322b Mon Sep 17 00:00:00 2001 +From 48355b1b1b0ae407d17524fb836fa61f2341d579 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 6 Dec 2013 20:50:28 +0100 -Subject: [PATCH 040/105] ASoC: BCM2708: Add support for RPi-DAC +Subject: [PATCH 039/149] ASoC: BCM2708: Add support for RPi-DAC This adds a machine driver for the RPi-DAC. @@ -125034,10 +124674,10 @@ index 0000000..b4eaa44 +MODULE_AUTHOR("Florian Meier "); +MODULE_LICENSE("GPL v2"); -From 54b60a8b83358d2fedc3e401908d96e9053033fb Mon Sep 17 00:00:00 2001 +From ee415b9db413a155e99d81537a776b7becf60227 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 15 Jan 2014 21:41:23 +0100 -Subject: [PATCH 041/105] ASoC: wm8804: Implement MCLK configuration options, +Subject: [PATCH 040/149] ASoC: wm8804: Implement MCLK configuration options, add 32bit support WM8804 can run with PLL frequencies of 256xfs and 128xfs for most sample rates. At 192kHz only 128xfs is supported. The existing driver selects 128xfs automatically for some lower samples rates. By using an @@ -125077,10 +124717,10 @@ index 1e403f6..d4efa85 100644 #define WM8804_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \ -From bda0438e5d2450329f79c9c203eb7700ea94bcdc Mon Sep 17 00:00:00 2001 +From 4e0d1e894adb9184eb45a7c343907df881e3a523 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 15 Jan 2014 21:42:08 +0100 -Subject: [PATCH 042/105] ASoC: BCM:Add support for HiFiBerry Digi. Driver is +Subject: [PATCH 041/149] ASoC: BCM:Add support for HiFiBerry Digi. Driver is based on the patched WM8804 driver. Signed-off-by: Daniel Matuschek @@ -125345,10 +124985,10 @@ index 0000000..92e9e46 +MODULE_DESCRIPTION("ASoC Driver for HifiBerry Digi"); +MODULE_LICENSE("GPL v2"); -From f0b7e3863c1025b7318dfe2672828fc1186f5f0c Mon Sep 17 00:00:00 2001 +From 5c4656d103da802e6d0412eb55c8dc9164935867 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Thu, 16 Jan 2014 07:26:08 +0100 -Subject: [PATCH 043/105] BCM2708: Added support for HiFiBerry Digi board Board +Subject: [PATCH 042/149] BCM2708: Added support for HiFiBerry Digi board Board initalization by I2C Signed-off-by: Daniel Matuschek @@ -125395,10 +125035,10 @@ index 6d53beb..a062d7f 100644 bcm_register_device_dt(&snd_rpi_dac_device); bcm_register_device_dt(&snd_pcm1794a_codec_device); -From f1d5146257a0181f53a76aa7c1eab75d8cde3722 Mon Sep 17 00:00:00 2001 +From 87f8afdc7be60f059356680542fa556055434a0b Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Thu, 16 Jan 2014 07:36:35 +0100 -Subject: [PATCH 044/105] ASoC: wm8804: Set idle_bias_off to false Idle bias +Subject: [PATCH 043/149] ASoC: wm8804: Set idle_bias_off to false Idle bias has been change to remove warning on driver startup Signed-off-by: Daniel Matuschek @@ -125420,10 +125060,10 @@ index d4efa85..f3f26a2 100644 .dapm_widgets = wm8804_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(wm8804_dapm_widgets), -From e2bd270cae6b71e799cd32309da2efb131bfc0f7 Mon Sep 17 00:00:00 2001 +From 02e362cf47d55e3e6e075d14a6f5eda064e832a9 Mon Sep 17 00:00:00 2001 From: Gordon Garrity Date: Sat, 8 Mar 2014 16:56:57 +0000 -Subject: [PATCH 045/105] Add IQaudIO Sound Card support for Raspberry Pi +Subject: [PATCH 044/149] Add IQaudIO Sound Card support for Raspberry Pi Set a limit of 0dB on Digital Volume Control @@ -125631,10 +125271,10 @@ index 0000000..aff7377 +MODULE_DESCRIPTION("ASoC Driver for IQAudio DAC"); +MODULE_LICENSE("GPL v2"); -From 3722358310334b175672d037724974a827219c91 Mon Sep 17 00:00:00 2001 +From 6ccb62cc7e401082561c12ed6258dc3382264875 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 18 Jun 2014 13:42:01 +0100 -Subject: [PATCH 046/105] vmstat: Workaround for issue where dirty page count +Subject: [PATCH 045/149] vmstat: Workaround for issue where dirty page count goes negative See: @@ -125661,10 +125301,10 @@ index 82e7db7..f87d16d 100644 static inline void __inc_zone_page_state(struct page *page, -From d0561fb6028c8eb1c26f3ad2f59d21d70eb778f4 Mon Sep 17 00:00:00 2001 +From 7db38451aa2a58b2f7e9e9cd60842e5167732ba0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 14 Jul 2014 22:02:09 +0100 -Subject: [PATCH 047/105] hid: Reduce default mouse polling interval to 60Hz +Subject: [PATCH 046/149] hid: Reduce default mouse polling interval to 60Hz Reduces overhead when using X --- @@ -125700,10 +125340,10 @@ index bfbe1be..a738b25 100644 ret = -ENOMEM; if (usb_endpoint_dir_in(endpoint)) { -From efa286e84267224fb05bfe8615489d50932ed5b8 Mon Sep 17 00:00:00 2001 +From ede6ae920d5614aeaca3793cab45e68d7a5667f4 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Mon, 4 Aug 2014 10:06:56 +0200 -Subject: [PATCH 048/105] Added support for HiFiBerry DAC+ +Subject: [PATCH 047/149] Added support for HiFiBerry DAC+ The driver is based on the HiFiBerry DAC driver. However HiFiBerry DAC+ uses a different codec chip (PCM5122), therefore a new driver is necessary. @@ -125914,10 +125554,10 @@ index 0000000..c63387b +MODULE_DESCRIPTION("ASoC Driver for HiFiBerry DAC+"); +MODULE_LICENSE("GPL v2"); -From f0b1de75a01f88b6250c208157a3a2f4a5c6b52d Mon Sep 17 00:00:00 2001 +From 7f32b28e3ecbddf73a8a2b849fe1950d1d3d6441 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Mon, 4 Aug 2014 11:09:58 +0200 -Subject: [PATCH 049/105] Added driver for HiFiBerry Amp amplifier add-on board +Subject: [PATCH 048/149] Added driver for HiFiBerry Amp amplifier add-on board The driver contains a low-level hardware driver for the TAS5713 and the drivers for the Raspberry Pi I2S subsystem. @@ -126786,10 +126426,10 @@ index 0000000..8f019e0 + +#endif /* _TAS5713_H */ -From 354cb37f33bee3d72e5a514999323689b00ca275 Mon Sep 17 00:00:00 2001 +From 5342cc918f42da5b299e861b708d0986f42f4c81 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 13 Apr 2015 19:14:18 +0100 -Subject: [PATCH 050/105] bcm2708: Allow option card devices to be configured +Subject: [PATCH 049/149] bcm2708: Allow option card devices to be configured via DT If the kernel is built with Device Tree support, and if a DT blob @@ -126814,10 +126454,10 @@ index 03fa1cb..c816526 100644 static struct platform_driver bcm2835_i2s_driver = { .probe = bcm2835_i2s_probe, -From f5a17a7715495cd47e7c4eef2655346833b71139 Mon Sep 17 00:00:00 2001 +From c2db87de57679d93a7b54ded9f2ad2c29b449c58 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 13 Apr 2015 18:45:39 +0100 -Subject: [PATCH 051/105] Adding Device Tree support for some RPi audio cards +Subject: [PATCH 050/149] Adding Device Tree support for some RPi audio cards --- arch/arm/mach-bcm2709/bcm2709.c | 143 ++++++++++++++++++++++++++++++++++++++ @@ -127180,10 +126820,10 @@ index 126f1e9..7c6598e 100644 }; -From 83c934f5afe83dab78859dbdcb6bc2fbcd24904a Mon Sep 17 00:00:00 2001 +From decbd54190fce2736e5f8614c974f6d236eebd15 Mon Sep 17 00:00:00 2001 From: Timo Kokkonen Date: Wed, 29 Oct 2014 23:30:30 -0700 -Subject: [PATCH 052/105] Added support to reserve/enable a GPIO pin to be used +Subject: [PATCH 051/149] Added support to reserve/enable a GPIO pin to be used from pps-gpio module (LinuxPPS). Enable PPS modules in default config for RPi. @@ -127319,10 +126959,10 @@ index 57e1f3d..721559b 100644 +module_param(pps_gpio_pin, int, 0644); +MODULE_PARM_DESC(pps_gpio_pin, "Set GPIO pin to reserve for PPS"); -From 98235f2a450b2f029e0bba2b566b5c86df9a6fef Mon Sep 17 00:00:00 2001 +From 128bbd307de47c1a0748dcf84e5d948c2df3db38 Mon Sep 17 00:00:00 2001 From: Ryan Coe Date: Sat, 31 Jan 2015 18:25:49 -0700 -Subject: [PATCH 053/105] Update ds1307 driver for device-tree support +Subject: [PATCH 052/149] Update ds1307 driver for device-tree support Signed-off-by: Ryan Coe --- @@ -127349,10 +126989,10 @@ index 4ffabb3..c6789a7 100644 .driver = { .name = "rtc-ds1307", -From d25a65991d2262ee56bf481b47a9980edf5e1ff0 Mon Sep 17 00:00:00 2001 +From 0fcc1245d4ba1391e0bcc754e2c521cecbb10179 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 6 Feb 2015 13:50:57 +0000 -Subject: [PATCH 054/105] BCM270x_DT: Add pwr_led, and the required "input" +Subject: [PATCH 053/149] BCM270x_DT: Add pwr_led, and the required "input" trigger The "input" trigger makes the associated GPIO an input. This is to support @@ -127463,10 +127103,10 @@ index 0000000..2ca2b98 +MODULE_DESCRIPTION("Set LED GPIO to Input \"trigger\""); +MODULE_LICENSE("GPL"); -From b478a1224ddadc079a085b1a9fd2f921f3492543 Mon Sep 17 00:00:00 2001 +From 2b9a2491e2554f5dc92a62be523ef8932a5eb85e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 20 Jun 2014 17:19:27 +0100 -Subject: [PATCH 055/105] bcm2709: Simplify and strip down IRQ handler +Subject: [PATCH 054/149] bcm2709: Simplify and strip down IRQ handler --- arch/arm/include/asm/entry-macro-multi.S | 2 + @@ -127685,10 +127325,10 @@ index d08591b..08d184c 100644 +1: get_irqnr_and_base r0, r2, r6, lr + .endm -From a149f4195cb6283d974f29f6853bc73666252e28 Mon Sep 17 00:00:00 2001 +From 145d538784f1fb1a938a6f037df9d85898ea1ba4 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 12 Feb 2015 11:17:53 +0000 -Subject: [PATCH 056/105] Fix LED "input" trigger implementation for 3.19 +Subject: [PATCH 055/149] Fix LED "input" trigger implementation for 3.19 --- drivers/leds/leds-gpio.c | 10 +++++++++- @@ -127775,10 +127415,10 @@ index 9a2b000..60accc5 100644 /* Set LED brightness level */ /* Must not sleep, use a workqueue if needed */ -From 63f720f1e358012fdb2631c18c794c32beb1c53f Mon Sep 17 00:00:00 2001 +From 20a42859d52cff889adbec5697ba61870b22c423 Mon Sep 17 00:00:00 2001 From: notro Date: Thu, 10 Jul 2014 13:59:47 +0200 -Subject: [PATCH 057/105] pinctrl-bcm2835: Set base to 0 give expected gpio +Subject: [PATCH 056/149] pinctrl-bcm2835: Set base to 0 give expected gpio numbering Signed-off-by: Noralf Tronnes @@ -127800,10 +127440,10 @@ index 8d908e3..7a1900d 100644 .can_sleep = false, }; -From 344a03d0bd987220640f4dd4ba4d083d2fdbb449 Mon Sep 17 00:00:00 2001 +From 812a64aaa5d3dec21864e49c612b38ee65273b17 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 4 Feb 2015 10:02:24 +0000 -Subject: [PATCH 058/105] pinctrl-bcm2835: bcm2835_gpio_direction_output must +Subject: [PATCH 057/149] pinctrl-bcm2835: bcm2835_gpio_direction_output must set the value --- @@ -127831,10 +127471,10 @@ index 7a1900d..62f85aa 100644 static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value) -From 1c683d296c9424f0cf7dac30d8992258c28cbeb1 Mon Sep 17 00:00:00 2001 +From 09041f7ccbd1cde792edae91c41266886d5d1382 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 24 Feb 2015 13:40:50 +0000 -Subject: [PATCH 059/105] pinctrl-bcm2835: Fix interrupt handling for GPIOs +Subject: [PATCH 058/149] pinctrl-bcm2835: Fix interrupt handling for GPIOs 28-31 and 46-53 Contrary to the documentation, the BCM2835 GPIO controller actually has @@ -127980,10 +127620,10 @@ index 62f85aa..c7cf266 100644 }, }; -From e1a45c7cf40f11598c7faed4a1d1b594bcc05796 Mon Sep 17 00:00:00 2001 +From 523ce9c5aa97607b0847833b93a8d34965808132 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 26 Feb 2015 09:58:22 +0000 -Subject: [PATCH 060/105] pinctrl-bcm2835: Only request the interrupts listed +Subject: [PATCH 059/149] pinctrl-bcm2835: Only request the interrupts listed in the DTB Although the GPIO controller can generate three interrupts (four counting @@ -128010,10 +127650,10 @@ index c7cf266..986779a 100644 pc->irq_data[i].irqgroup = i; -From 0fff72fcb15c962d0723f9cea13eb2c3fc31d465 Mon Sep 17 00:00:00 2001 +From ee9c77a3cc5d83e87e52f3424f7a29d605d562ba Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 27 Feb 2015 15:10:24 +0000 -Subject: [PATCH 061/105] enc28j60: Add device tree compatible string and an +Subject: [PATCH 060/149] enc28j60: Add device tree compatible string and an overlay --- @@ -128047,10 +127687,10 @@ index b1b5f66..c6b6e1a 100644 .probe = enc28j60_probe, .remove = enc28j60_remove, -From 74c1893348470c0ec98d83ea63ab8e22e3da8c13 Mon Sep 17 00:00:00 2001 +From 0c87fa341259d332ce8402d1a3703f2b69af5219 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Wed, 25 Mar 2015 09:26:17 +0100 -Subject: [PATCH 062/105] Add driver for rpi-proto +Subject: [PATCH 061/149] Add driver for rpi-proto Forward port of 3.10.x driver from https://github.com/koalo We are using a custom board and would like to use rpi 3.18.x @@ -128265,10 +127905,10 @@ index 0000000..c6e45a0 +MODULE_DESCRIPTION("ASoC Driver for Raspberry Pi connected to PROTO board (WM8731)"); +MODULE_LICENSE("GPL"); -From 607ebcbdf67cb576a652c505a367e614014547dd Mon Sep 17 00:00:00 2001 +From 458dc19741c5295b62ff78882b94a4d6dc8aaac2 Mon Sep 17 00:00:00 2001 From: Clive Messer Date: Thu, 2 Apr 2015 12:22:55 +0100 -Subject: [PATCH 063/105] Add Device Tree support for RPi-DAC. +Subject: [PATCH 062/149] Add Device Tree support for RPi-DAC. --- sound/soc/bcm/rpi-dac.c | 21 +++++++++++++++++++++ @@ -128343,10 +127983,10 @@ index b4eaa44..afe1b41 100644 }; -From 1fa756b7cbc29e7ce003ed6f6b269faf8f114467 Mon Sep 17 00:00:00 2001 +From 4c33cf46121a5662ebfb84ad34a5a632c2c679f6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 13 Apr 2015 17:16:29 +0100 -Subject: [PATCH 064/105] config: Add default configs +Subject: [PATCH 063/149] config: Add default configs --- arch/arm/configs/bcm2709_defconfig | 1204 ++++++++++++++++++++++++++++++++++++ @@ -130771,10 +130411,10 @@ index 0000000..6a41231 +CONFIG_CRC_ITU_T=y +CONFIG_LIBCRC32C=y -From 7d987bad7109b37ffac673a9975718ee4e9ea9ae Mon Sep 17 00:00:00 2001 +From f8b20b1317fd46d23a2a9944a53df547904a238f Mon Sep 17 00:00:00 2001 From: Steve Glendinning Date: Thu, 19 Feb 2015 18:47:12 +0000 -Subject: [PATCH 065/105] smsx95xx: fix crimes against truesize +Subject: [PATCH 064/149] smsx95xx: fix crimes against truesize smsc95xx is adjusting truesize when it shouldn't, and following a recent patch from Eric this is now triggering warnings. @@ -130809,10 +130449,10 @@ index e29a323..aff63dc usbnet_skb_return(dev, ax_skb); } -From 888ea57ee7c57e7f43b3be9d7f9c70ea92e3ef2e Mon Sep 17 00:00:00 2001 +From 7b168915af2a8d731046afeed5cdf939cd9c4323 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 17 Apr 2015 16:58:45 +0100 -Subject: [PATCH 066/105] smsc95xx: Disable turbo mode by default +Subject: [PATCH 065/149] smsc95xx: Disable turbo mode by default --- drivers/net/usb/smsc95xx.c | 2 +- @@ -130832,10 +130472,10 @@ index aff63dc..08a8a8c 100755 MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); -From 43e2441e42ce3e68910e50a862e82cefff1491a8 Mon Sep 17 00:00:00 2001 +From aab95f9b10e8c3d32de2bf163b86f220c88214fe Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 17 Apr 2015 19:30:22 +0100 -Subject: [PATCH 067/105] Add blk_pos parameter to mmc multi_io_quirk callback +Subject: [PATCH 066/149] Add blk_pos parameter to mmc multi_io_quirk callback --- drivers/mmc/card/block.c | 1 + @@ -130846,10 +130486,10 @@ Subject: [PATCH 067/105] Add blk_pos parameter to mmc multi_io_quirk callback 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c -index 60f7141..1f15cb5 100644 +index 31d2627..8484ec9 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c -@@ -1413,6 +1413,7 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, +@@ -1415,6 +1415,7 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, brq->data.blocks = card->host->ops->multi_io_quirk(card, (rq_data_dir(req) == READ) ? MMC_DATA_READ : MMC_DATA_WRITE, @@ -130918,10 +130558,10 @@ index b0258e8..d3cdad9 100644 struct mmc_card; -From 3c38adf40dd65f96d317f60295ee47ddd5412d11 Mon Sep 17 00:00:00 2001 +From 9a092ad62309aecb8c27cde5fb5f863a7447b90e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Wed, 29 Apr 2015 17:24:02 +0200 -Subject: [PATCH 068/105] bcm2835: bcm2835_defconfig +Subject: [PATCH 067/149] bcm2835: bcm2835_defconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -132251,10 +131891,10 @@ index 31cb073..2e8a95a 100644 # CONFIG_XZ_DEC_ARM is not set # CONFIG_XZ_DEC_ARMTHUMB is not set -From 219d0cd5afbcfc1d8d1bffc63c535c323ae8bf2e Mon Sep 17 00:00:00 2001 +From 4ab42e0f9eab22619622ea5f13195280aebc0d64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 1 May 2015 23:00:15 +0200 -Subject: [PATCH 069/105] BCM270x_DT: Add mailbox bcm2708-vcio +Subject: [PATCH 068/149] BCM270x_DT: Add mailbox bcm2708-vcio MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -132295,10 +131935,10 @@ index 721559b..4a00561 100644 #ifdef CONFIG_BCM2708_GPIO bcm_register_device_dt(&bcm2708_gpio_device); -From 3c10332d5214199b7df6d5d220eeef023706cbaf Mon Sep 17 00:00:00 2001 +From fa2b33b614fead97a2eb8b950fb1c77e73f0eb28 Mon Sep 17 00:00:00 2001 From: Gordon Hollingworth Date: Tue, 12 May 2015 14:47:56 +0100 -Subject: [PATCH 070/105] rpi-ft5406: Add touchscreen driver for pi LCD display +Subject: [PATCH 069/149] rpi-ft5406: Add touchscreen driver for pi LCD display --- drivers/input/touchscreen/Kconfig | 7 + @@ -132615,10 +132255,10 @@ index cc284ed..d3ea839 100644 VCMSG_SET_CURSOR_STATE = 0x00008011, }; -From 10fe6a8ff8d397d392f84f71bccef590007c1035 Mon Sep 17 00:00:00 2001 +From 5cbcb76ee23807632fcd5db19ebcc2d913011f17 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 13 Oct 2014 11:47:53 +0100 -Subject: [PATCH 071/105] Improve __copy_to_user and __copy_from_user +Subject: [PATCH 070/149] Improve __copy_to_user and __copy_from_user performance Provide a __copy_from_user that uses memcpy. On BCM2708, use @@ -134143,10 +133783,10 @@ index 3e58d71..0622891 100644 static unsigned long noinline __clear_user_memset(void __user *addr, unsigned long n) -From 55e619a1d22f898210f4d5df7056de9ca22262ef Mon Sep 17 00:00:00 2001 +From b196781e4110a44416cf5926cf1ff350a1533c94 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 27 May 2015 17:22:15 +0100 -Subject: [PATCH 072/105] bcm2835-audio: Create the platform device if the DT +Subject: [PATCH 071/149] bcm2835-audio: Create the platform device if the DT node is disabled For backwards compatibility, allow the built-in ALSA driver to be enabled @@ -134200,10 +133840,10 @@ index 4a00561..dec8043 100644 bcm_register_device_dt(&bcm2708_spi_device); -From 3a23003af149876e9459bf65f14eff38ddb57778 Mon Sep 17 00:00:00 2001 +From 35fb850719835a0029eb91480b214fbaf2a99dc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Wed, 3 Jun 2015 12:26:13 +0200 -Subject: [PATCH 073/105] ARM: bcm2835: Set Serial number and Revision +Subject: [PATCH 072/149] ARM: bcm2835: Set Serial number and Revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -134262,10 +133902,10 @@ index 70f2f39..f7fdacd 100644 static const char * const bcm2835_compat[] = { -From a16205df7ca3759a05bf56e126d17fb496c12775 Mon Sep 17 00:00:00 2001 +From fb9bb42b9875d61716503c9eb330e73d720f5a64 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 16 Jun 2015 17:47:27 +0100 -Subject: [PATCH 074/105] platform: Add force_core command line setting to boot +Subject: [PATCH 073/149] platform: Add force_core command line setting to boot from a different core number --- @@ -134336,10 +133976,10 @@ index dec8043..fe71c50 100644 module_param(serial, uint, 0644); module_param(uart_clock, uint, 0644); -From d4fe01b4f1f6d84fb12a04e228edc19aea23865a Mon Sep 17 00:00:00 2001 +From 63a651b12cbd98ba14d2ac6f038f230a4b3ce336 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 18 Jun 2015 17:46:17 +0100 -Subject: [PATCH 075/105] mach-bcm270x: Enable the building of pinctrl-bcm2835 +Subject: [PATCH 074/149] mach-bcm270x: Enable the building of pinctrl-bcm2835 --- drivers/pinctrl/Makefile | 1 + @@ -134358,10 +133998,10 @@ index 6eadf04..9119513 100644 obj-$(CONFIG_ARCH_BERLIN) += berlin/ obj-y += freescale/ -From cd146348cbf2ff432f0cb3b05b0e0cf117dbba74 Mon Sep 17 00:00:00 2001 +From 30e79675077f83c35b77f74ae833212cbff42b6f Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 19 Jun 2015 16:41:39 +0100 -Subject: [PATCH 076/105] BCM270X_DT: Document the i2s-mmap overlay +Subject: [PATCH 075/149] BCM270X_DT: Document the i2s-mmap overlay --- arch/arm/boot/dts/overlays/README | 6 ++++++ @@ -134385,10 +134025,10 @@ index 3e08f98..7fa6d33 100644 Info: Configures the IQaudio DAC audio card Load: dtoverlay=iqaudio-dac -From 88ffec3ff5b4505e53ee2fdcbc564fe734145ae6 Mon Sep 17 00:00:00 2001 +From 1dd7bc29051074b4aedba9ed05bbc920ed67a654 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 17 Jun 2015 11:36:53 +0100 -Subject: [PATCH 077/105] bcm2835-sdhost: Improve error handling and recovery +Subject: [PATCH 076/149] bcm2835-sdhost: Improve error handling and recovery 1) Expose the hw_reset method to the MMC framework, removing many internal calls by the driver. @@ -135480,10 +135120,10 @@ index eef8a24..6277e43 100644 if (host->allow_dma) { -From afd5ae68ceec9ee73fb979c32ed1fd19ab6a1038 Mon Sep 17 00:00:00 2001 +From e6a1ebfa363797e35902c3d466af7c92ef05a62f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 4 Jun 2015 13:11:46 -0700 -Subject: [PATCH 078/105] ARM: bcm2835: Add the Raspberry Pi firmware driver +Subject: [PATCH 077/149] ARM: bcm2835: Add the Raspberry Pi firmware driver This gives us a function for making mailbox property channel requests of the firmware, which is most notable in that it will let us get and @@ -135917,10 +135557,10 @@ index 0000000..9d9efb7 + void *data, size_t tag_size); +struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node); -From c3629eb3fda93e5727602a1484daab7d08da61cb Mon Sep 17 00:00:00 2001 +From dce877ba363b979281f5781ec75a197875fd21a9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 22 Mar 2015 13:33:23 +0000 -Subject: [PATCH 079/105] config: Enable ZSMALLOC, ZRAM and PGTABLE_MAPPING +Subject: [PATCH 078/149] config: Enable ZSMALLOC, ZRAM and PGTABLE_MAPPING --- arch/arm/configs/bcm2709_defconfig | 4 ++++ @@ -135972,10 +135612,10 @@ index 6a41231..cacde14 100644 CONFIG_BLK_DEV_CRYPTOLOOP=m CONFIG_BLK_DEV_DRBD=m -From 667729cc2a536b1cc6241973276fad1e72909f3a Mon Sep 17 00:00:00 2001 +From 2f04df7aef19d4e087c80fa7371e3f5139233570 Mon Sep 17 00:00:00 2001 From: Gordon Hollingworth Date: Mon, 22 Jun 2015 16:27:07 +0100 -Subject: [PATCH 080/105] Add rpi-ft5406 overlay Add rpi-ft5406 driver as +Subject: [PATCH 079/149] Add rpi-ft5406 overlay Add rpi-ft5406 driver as module --- @@ -136062,10 +135702,10 @@ index cacde14..f952ff2 100644 CONFIG_TOUCHSCREEN_STMPE=m CONFIG_INPUT_MISC=y -From b2d8f6a978e70e941859cc4cfacaee8121f71b7c Mon Sep 17 00:00:00 2001 +From bf09fbb31f813db47e4b64fddbc1ea1d089133c2 Mon Sep 17 00:00:00 2001 From: Gordon Hollingworth Date: Tue, 23 Jun 2015 09:53:40 +0100 -Subject: [PATCH 081/105] Fix driver detection failure Check that the buffer +Subject: [PATCH 080/149] Fix driver detection failure Check that the buffer response is non-zero meaning the touchscreen was detected --- @@ -136086,10 +135726,10 @@ index f55151b..d41851d 100644 dev_dbg(&pdev->dev, "Got TS buffer 0x%x\n", request.tag.val); } -From 47e896b8d1e0614ae8dc7a01b037d3d30bd87bf1 Mon Sep 17 00:00:00 2001 +From e8fe55cc59f200121b845a93110d6c41e7daeb01 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 23 Jun 2015 13:24:01 +0100 -Subject: [PATCH 082/105] config: Enable 8250 serial port +Subject: [PATCH 081/149] config: Enable 8250 serial port --- arch/arm/configs/bcm2709_defconfig | 7 +++++++ @@ -136137,10 +135777,10 @@ index f952ff2..0c25d8b 100644 CONFIG_HW_RANDOM=y CONFIG_HW_RANDOM_BCM2835=m -From e6e9f242d287b3fa1008ef3bfdac211906587585 Mon Sep 17 00:00:00 2001 +From 02dfc389b34d52a0c97428a666d0314216c2cb34 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 23 Jun 2015 14:10:58 +0100 -Subject: [PATCH 083/105] config: Enable POWER_RESET_GPIO +Subject: [PATCH 082/149] config: Enable POWER_RESET_GPIO --- arch/arm/configs/bcm2709_defconfig | 2 ++ @@ -136174,10 +135814,10 @@ index 0c25d8b..e757db6 100644 CONFIG_THERMAL=y CONFIG_THERMAL_BCM2835=y -From acfa836e00324826a1aa3dc816d7dc5f4b5d5790 Mon Sep 17 00:00:00 2001 +From 83d5bd935a9a83db9e7bf89bb3cd123fc7a6999f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 26 Jun 2015 17:37:38 +0100 -Subject: [PATCH 084/105] bcm2708-vcio: Remove restriction of only a single +Subject: [PATCH 083/149] bcm2708-vcio: Remove restriction of only a single instance being open We need more than one process to be able to use mailbox interface (e.g. HW cursor in fbturbo and hello_fft). @@ -136222,10 +135862,10 @@ index d91672b..06fb2c2f 100644 return 0; -From 7f23eccb28dd764cf1af231fdc69bc9f93db4972 Mon Sep 17 00:00:00 2001 +From 08ab3b10ef3b9fee5c05f7c1463fefa3206e36eb Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 26 Jun 2015 08:39:19 +0100 -Subject: [PATCH 085/105] BCM270X_DT: Create a "core" clock, use it for SPI and +Subject: [PATCH 084/149] BCM270X_DT: Create a "core" clock, use it for SPI and sdhost --- @@ -136376,10 +136016,10 @@ index b408ab4..897204a 100644 }; }; -From f64348123913a79fd145c5208039c8f66c0c4252 Mon Sep 17 00:00:00 2001 +From a3c04e353a23787157f52097715422aed626198d Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 24 Jun 2015 09:24:31 +0100 -Subject: [PATCH 086/105] BCM270X_DT: Add MCP7941X to i2c-rtc overlay +Subject: [PATCH 085/149] BCM270X_DT: Add MCP7941X to i2c-rtc overlay --- arch/arm/boot/dts/overlays/README | 3 +++ @@ -136432,10 +136072,10 @@ index 6bccfdc..7052c71 100644 pcf8523 = <&pcf8523>,"status"; pcf8563 = <&pcf8563>,"status"; -From 57fd1fbaa2d9281f2b9d70c8d15dbaa201af2b71 Mon Sep 17 00:00:00 2001 +From 89ce29fd10942fcb3a8a72a88ed399d5bbac6f56 Mon Sep 17 00:00:00 2001 From: P33M Date: Wed, 24 Jun 2015 11:23:06 +0100 -Subject: [PATCH 087/105] dts/overlays: document DHT11 overlay +Subject: [PATCH 086/149] dts/overlays: document DHT11 overlay --- arch/arm/boot/dts/overlays/README | 8 ++++++++ @@ -136461,10 +136101,10 @@ index 425eb19..9406cf3 100644 -From e072d9e5801bb111be321dff6feadd5c12e8d2ad Mon Sep 17 00:00:00 2001 +From e5230cc9bbb441510c38faf9f0c82a839afbba71 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 25 Jun 2015 12:16:11 +0100 -Subject: [PATCH 088/105] gpio-poweroff: Allow it to work on Raspberry Pi +Subject: [PATCH 087/149] gpio-poweroff: Allow it to work on Raspberry Pi The Raspberry Pi firmware manages the power-down and reboot process. To do this it installs a pm_power_off handler, causing @@ -136579,10 +136219,10 @@ index e5332f1..6e3fec2 100644 "%s: pm_power_off function already registered", __func__); -From 45567cec8e8dc1be2d45fead5332258d3a49a088 Mon Sep 17 00:00:00 2001 +From c7c9f2995da703a41e6c70bce53d9eef408b1b46 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 17 Jun 2015 17:10:40 +0100 -Subject: [PATCH 089/105] BCM270x_DT: Default Compute Module i2c, i2s and spi +Subject: [PATCH 088/149] BCM270x_DT: Default Compute Module i2c, i2s and spi support --- @@ -136672,10 +136312,10 @@ index e82fcb2..af252bd 100755 }; }; -From 2c610cb4fa176ac54d4e32a4744761aa9c600f3c Mon Sep 17 00:00:00 2001 +From 44c63dcdaca924590d42106b99b5f4e30dcbfbe3 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 22 Jun 2015 14:21:55 +0100 -Subject: [PATCH 090/105] BCM270X_DT: Sort nodes by bus address, and +Subject: [PATCH 089/149] BCM270X_DT: Sort nodes by bus address, and consolidate aliases --- @@ -136917,10 +136557,10 @@ index 24fa849..ccb9c31 100644 &gpio { -From dab507d5936f3847a320b11be5a21b4c25c4601b Mon Sep 17 00:00:00 2001 +From 870b67c8c48467c19fbbccb90aeb8137ce5e9bea Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 22 Jun 2015 14:23:03 +0100 -Subject: [PATCH 091/105] i2c-bcm2708/BCM270X_DT: Add support for I2C2 +Subject: [PATCH 090/149] i2c-bcm2708/BCM270X_DT: Add support for I2C2 The third I2C bus (I2C2) is normally reserved for HDMI use. Careless use of this bus can break an attached display - use with caution. @@ -137093,10 +136733,10 @@ index 8773203..7a24fbe 100644 goto out_free_bi; } -From c887101553aed347b4e0e29422cd5a7315cce18a Mon Sep 17 00:00:00 2001 +From 207f6d593f3d6b5e5bbe5b12f8e915d7f6b85dd7 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 29 Jun 2015 12:14:02 +0100 -Subject: [PATCH 092/105] BCM270X_DT: Correct the lirc-rpi overlay +Subject: [PATCH 091/149] BCM270X_DT: Correct the lirc-rpi overlay documentation The polarity of the "sense" parameter was inverted with respect to reality. @@ -137122,10 +136762,10 @@ index 0ed7094..ec762d2 100644 (default "-1") -From b55c8ef4eab8f62f3087bcdf4eb9a603105d16fb Mon Sep 17 00:00:00 2001 +From 919c9342b5a5c83686dc932935276d621b5cccae Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 25 Jun 2015 08:47:09 +0100 -Subject: [PATCH 093/105] bcm2835-sdhost: Further improve overclock back-off +Subject: [PATCH 092/149] bcm2835-sdhost: Further improve overclock back-off --- drivers/mmc/host/bcm2835-sdhost.c | 144 +++++++++++++++++++++----------------- @@ -137417,10 +137057,10 @@ index 6277e43..a03db06 100644 iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); -From 3d5ba5c480137b87aaee59c14f8e486e747cd450 Mon Sep 17 00:00:00 2001 +From 23382239529f6cb7af467a9247e8e24e70a4aa06 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 30 Jun 2015 10:28:59 +0100 -Subject: [PATCH 094/105] i2c-bcm2708: Increase timeouts to allow larger +Subject: [PATCH 093/149] i2c-bcm2708: Increase timeouts to allow larger transfers Use the timeout value provided by the I2C_TIMEOUT ioctl when waiting @@ -137458,10 +137098,10 @@ index 7a24fbe..8b8762d 100644 dev_err(&adap->dev, "transfer timed out\n"); goto error_timeout; -From 31a5408b0734bc64969ab91be9cb3c1d898d655a Mon Sep 17 00:00:00 2001 +From f3d59521e6139a0e1cf79eaacffea5a576360185 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 30 Jun 2015 10:33:52 +0100 -Subject: [PATCH 095/105] spi-bcm2708: Increase timeout from 150ms to 1s +Subject: [PATCH 094/149] spi-bcm2708: Increase timeout from 150ms to 1s See: https://github.com/raspberrypi/linux/issues/260 --- @@ -137485,10 +137125,10 @@ index 041b5e2..5c0214e 100644 struct bcm2708_spi { spinlock_t lock; -From c66c0c2993daff0c44d7daae71421b1404f92233 Mon Sep 17 00:00:00 2001 +From ea8bb97ffa4e1f4bd832e7a9bed797551685625b Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 15 Jun 2015 09:59:38 +0100 -Subject: [PATCH 096/105] bcm2708-spi: Don't use static pin configuration with +Subject: [PATCH 095/149] bcm2708-spi: Don't use static pin configuration with DT Also remove superfluous error checking - the SPI framework ensures the @@ -137527,10 +137167,10 @@ index 5c0214e..781c747 100644 master = spi_alloc_master(&pdev->dev, sizeof(*bs)); if (!master) { -From fb8c469783f4521176bebb9de94b6b456b4c35bb Mon Sep 17 00:00:00 2001 +From a141cf018b63c08c9907aa0d7b1b2791ee9250d0 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 15 Jun 2015 10:10:59 +0100 -Subject: [PATCH 097/105] bcm2708-i2s: Don't use static pin configuration with +Subject: [PATCH 096/149] bcm2708-i2s: Don't use static pin configuration with DT --- @@ -137553,10 +137193,10 @@ index a515992..5e93cd6 100644 /* * Adjust the data length according to the format. -From 68df7b46c42bd73c44ae405adbd12be35e308a2b Mon Sep 17 00:00:00 2001 +From 9ac08a7ad7b65014eada794cf252828d10b6cb91 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 30 Jun 2015 14:12:42 +0100 -Subject: [PATCH 098/105] serial: 8250: Don't crash when nr_uarts is 0 +Subject: [PATCH 097/149] serial: 8250: Don't crash when nr_uarts is 0 --- drivers/tty/serial/8250/8250_core.c | 2 ++ @@ -137576,10 +137216,10 @@ index 4506e40..f03a19a 100644 for (i = 0; i < nr_uarts; i++) { struct uart_8250_port *up = &serial8250_ports[i]; -From 3ceec0b963f3001adaa523d65508cc54a6f93cd0 Mon Sep 17 00:00:00 2001 +From e3ee14936302400a2b6389b4062e4ce45046cb2e Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 26 Jun 2015 08:50:11 +0100 -Subject: [PATCH 099/105] BCM270X_DT: Add overlay to enable uart1 +Subject: [PATCH 098/149] BCM270X_DT: Add overlay to enable uart1 N.B. The UART1 clock is derived from the core clock. The firmware will update clock-frequency if core_freq is set, but be aware @@ -137748,10 +137388,10 @@ index e757db6..363c894 100644 CONFIG_SERIAL_AMBA_PL011_CONSOLE=y CONFIG_SERIAL_OF_PLATFORM=y -From 0365608651a901ee0b84351ed8ec9b7f0cdfd986 Mon Sep 17 00:00:00 2001 +From 6ee396162a3700157252585fd19ed67e22b8aa34 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 24 Jun 2015 14:10:44 +0100 -Subject: [PATCH 100/105] spi-bcm2835: Support pin groups other than 7-11 +Subject: [PATCH 099/149] spi-bcm2835: Support pin groups other than 7-11 The spi-bcm2835 driver automatically uses GPIO chip-selects due to some unreliability of the native ones. In doing so it chooses the @@ -137832,10 +137472,10 @@ index 37875cf..55e81c2 100644 /* and set up the "mode" and level */ dev_info(&spi->dev, "setting up native-CS%i as GPIO %i\n", -From 1674fcd926873998471f71ad88306d47bc99862b Mon Sep 17 00:00:00 2001 +From 2f890ad4ea68997c62f8d58af8c2800b7eeab056 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 30 Jun 2015 17:37:38 +0100 -Subject: [PATCH 101/105] BCM270X_DT: Change pio_limit of sdhost driver to 1 +Subject: [PATCH 100/149] BCM270X_DT: Change pio_limit of sdhost driver to 1 --- arch/arm/boot/dts/overlays/sdhost-overlay.dts | 2 +- @@ -137855,10 +137495,10 @@ index 897204a..2da14a4 100644 }; }; -From f72606ab1e40707a3dc9243e0d0b87b98654e02b Mon Sep 17 00:00:00 2001 +From a9ac939580e8cf0c43c4242bb458db7d27a6deea Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 1 Jul 2015 12:51:52 +0100 -Subject: [PATCH 102/105] bcm2835-sdhost: Clear HBLC for PIO mode +Subject: [PATCH 101/149] bcm2835-sdhost: Clear HBLC for PIO mode Also update pio_limit default in overlay README. --- @@ -137894,10 +137534,10 @@ index a03db06..d65870a 100644 BUG_ON(!host->data); } -From 93e9bd0c71d224db35cc8019a1ebc16bf77f0fa2 Mon Sep 17 00:00:00 2001 +From 7b05003d4f07188e83919e476ac48dc5c219f8ed Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 3 Jul 2015 12:21:01 +0100 -Subject: [PATCH 103/105] BCM270X_DT: I2S needs function Alt2 +Subject: [PATCH 102/149] BCM270X_DT: I2S needs function Alt2 --- arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 2 +- @@ -137959,10 +137599,10 @@ index f25f0a2..62d1c62 100644 }; -From 5edaac580d81f7edd48afd1e8c296cdedd94cc7a Mon Sep 17 00:00:00 2001 +From 7a39e0bdf178dd83ffca4766bfc0a2acc1b6c3a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 26 Jun 2015 14:16:15 +0200 -Subject: [PATCH 104/105] configs: Incorporate v4.1 dependency changes +Subject: [PATCH 103/149] configs: Incorporate v4.1 dependency changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -138125,10 +137765,10 @@ index 363c894..80f84d7 100644 CONFIG_CRC_ITU_T=y CONFIG_LIBCRC32C=y -From 18f4efa3ad700a4caf72f45ff95d7acfb40f3255 Mon Sep 17 00:00:00 2001 +From 01a50411ad1528451d53f69d5ad1c7370db0dbee Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 3 Jul 2015 15:47:33 +0100 -Subject: [PATCH 105/105] bcmrpi_defconfigs: Add SND_SOC_WM8804_I2C (for +Subject: [PATCH 104/149] bcmrpi_defconfigs: Add SND_SOC_WM8804_I2C (for HifiBerry Digi) 4.1 has split out support for the I2C and SPI variants, so it now @@ -138162,3 +137802,5984 @@ index 80f84d7..14b91fdf 100644 CONFIG_SND_SIMPLE_CARD=m CONFIG_SOUND_PRIME=m CONFIG_HIDRAW=y + +From c3934ab548244c7fd691ca2e78f9a950d8eff269 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Sat, 4 Jul 2015 19:55:23 +0100 +Subject: [PATCH 105/149] squash: BCM270X_DT: I2S only needs Alt2 on 28-31 + +See: https://github.com/raspberrypi/linux/issues/1046 +--- + arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 2 +- + arch/arm/boot/dts/bcm2708-rpi-cm.dts | 2 +- + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +index 562eb08..3ad2e0d 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -25,7 +25,7 @@ + + i2s_pins: i2s { + brcm,pins = <18 19 20 21>; +- brcm,function = <6>; /* alt2 */ ++ brcm,function = <4>; /* alt0 */ + }; + }; + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dts b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +index 5e3db01..96d8b97 100755 +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +@@ -28,7 +28,7 @@ + + i2s_pins: i2s { + brcm,pins = <18 19 20 21>; +- brcm,function = <6>; /* alt2 */ ++ brcm,function = <4>; /* alt0 */ + }; + }; + +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index 62d1c62..f25f0a2 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -25,7 +25,7 @@ + + i2s_pins: i2s { + brcm,pins = <18 19 20 21>; +- brcm,function = <6>; /* alt2 */ ++ brcm,function = <4>; /* alt0 */ + }; + }; + + +From acd32a30be3e6952f7486c9569429fce70fb8d9e Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 8 Jul 2015 14:48:57 +0100 +Subject: [PATCH 106/149] vchiq_arm: Two cacheing fixes + +1) Make fragment size vary with cache line size +Without this patch, non-cache-line-aligned transfers may corrupt +(or be corrupted by) adjacent data structures. + +Both ARM and VC need to be updated to enable this feature. This is +ensured by having the loader apply a new DT parameter - +cache-line-size. The existence of this parameter guarantees that the +kernel is capable, and the parameter will only be modified from the +safe default if the loader is capable. + +2) Flush/invalidate vmalloc'd memory, and invalidate after reads +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 5 + + .../interface/vchiq_arm/vchiq_2835_arm.c | 112 +++++++++++++-------- + 2 files changed, 77 insertions(+), 40 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index 8181a4e..abf3e5d 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -218,6 +218,7 @@ + compatible = "brcm,bcm2835-vchiq"; + reg = <0x7e00b840 0xf>; + interrupts = <0 2>; ++ cache-line-size = <32>; + }; + + thermal: thermal { +@@ -270,4 +271,8 @@ + clock-frequency = <126000000>; + }; + }; ++ ++ __overrides__ { ++ cache_line_size = <&vchiq>, "cache-line-size:0"; ++ }; + }; +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +index c739083..5edba23 100644 +--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +@@ -42,6 +42,7 @@ + #include + #include + #include ++#include + #include + + #define TOTAL_SLOTS (VCHIQ_SLOT_ZERO_SLOTS + 2 * 32) +@@ -64,8 +65,10 @@ typedef struct vchiq_2835_state_struct { + } VCHIQ_2835_ARM_STATE_T; + + static void __iomem *g_regs; +-static FRAGMENTS_T *g_fragments_base; +-static FRAGMENTS_T *g_free_fragments; ++static unsigned int g_cache_line_size = sizeof(CACHE_LINE_SIZE); ++static unsigned int g_fragments_size; ++static char *g_fragments_base; ++static char *g_free_fragments; + static struct semaphore g_free_fragments_sema; + static unsigned long g_virt_to_bus_offset; + +@@ -95,9 +98,13 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) + + g_virt_to_bus_offset = virt_to_dma(dev, (void *)0); + ++ (void)of_property_read_u32(dev->of_node, "cache-line-size", ++ &g_cache_line_size); ++ g_fragments_size = 2 * g_cache_line_size; ++ + /* Allocate space for the channels in coherent memory */ + slot_mem_size = PAGE_ALIGN(TOTAL_SLOTS * VCHIQ_SLOT_SIZE); +- frag_mem_size = PAGE_ALIGN(sizeof(FRAGMENTS_T) * MAX_FRAGMENTS); ++ frag_mem_size = PAGE_ALIGN(g_fragments_size * MAX_FRAGMENTS); + + slot_mem = dmam_alloc_coherent(dev, slot_mem_size + frag_mem_size, + &slot_phys, GFP_KERNEL); +@@ -117,15 +124,15 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) + vchiq_slot_zero->platform_data[VCHIQ_PLATFORM_FRAGMENTS_COUNT_IDX] = + MAX_FRAGMENTS; + +- g_fragments_base = (FRAGMENTS_T *)(slot_mem + slot_mem_size); ++ g_fragments_base = (char *)slot_mem + slot_mem_size; + slot_mem_size += frag_mem_size; + + g_free_fragments = g_fragments_base; + for (i = 0; i < (MAX_FRAGMENTS - 1); i++) { +- *(FRAGMENTS_T **)&g_fragments_base[i] = +- &g_fragments_base[i + 1]; ++ *(char **)&g_fragments_base[i*g_fragments_size] = ++ &g_fragments_base[(i + 1)*g_fragments_size]; + } +- *(FRAGMENTS_T **)&g_fragments_base[i] = NULL; ++ *(char **)&g_fragments_base[i * g_fragments_size] = NULL; + sema_init(&g_free_fragments_sema, MAX_FRAGMENTS); + + if (vchiq_init_state(state, vchiq_slot_zero, 0) != VCHIQ_SUCCESS) +@@ -344,7 +351,7 @@ vchiq_doorbell_irq(int irq, void *dev_id) + ** cached area. + + ** N.B. This implementation plays slightly fast and loose with the Linux +-** driver programming rules, e.g. its use of __virt_to_bus instead of ++** driver programming rules, e.g. its use of dmac_map_area instead of + ** dma_map_single, but it isn't a multi-platform driver and it benefits + ** from increased speed as a result. + */ +@@ -355,7 +362,6 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, + { + PAGELIST_T *pagelist; + struct page **pages; +- struct page *page; + unsigned long *addrs; + unsigned int num_pages, offset, i; + char *addr, *base_addr, *next_addr; +@@ -386,10 +392,25 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, + pages = (struct page **)(addrs + num_pages + 1); + + if (is_vmalloc_addr(buf)) { +- for (actual_pages = 0; actual_pages < num_pages; actual_pages++) { +- pages[actual_pages] = vmalloc_to_page(buf + (actual_pages * PAGE_SIZE)); ++ int dir = (type == PAGELIST_WRITE) ? ++ DMA_TO_DEVICE : DMA_FROM_DEVICE; ++ unsigned long length = pagelist->length; ++ unsigned int offset = pagelist->offset; ++ ++ for (actual_pages = 0; actual_pages < num_pages; ++ actual_pages++) { ++ struct page *pg = vmalloc_to_page(buf + (actual_pages * ++ PAGE_SIZE)); ++ size_t bytes = PAGE_SIZE - offset; ++ ++ if (bytes > length) ++ bytes = length; ++ pages[actual_pages] = pg; ++ dmac_map_area(page_address(pg) + offset, bytes, dir); ++ length -= bytes; ++ offset = 0; + } +- *need_release = 0; /* do not try and release vmalloc pages */ ++ *need_release = 0; /* do not try and release vmalloc pages */ + } else { + down_read(&task->mm->mmap_sem); + actual_pages = get_user_pages(task, task->mm, +@@ -418,7 +439,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, + actual_pages = -ENOMEM; + return actual_pages; + } +- *need_release = 1; /* release user pages */ ++ *need_release = 1; /* release user pages */ + } + + pagelist->length = count; +@@ -451,10 +472,10 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, + + /* Partial cache lines (fragments) require special measures */ + if ((type == PAGELIST_READ) && +- ((pagelist->offset & (CACHE_LINE_SIZE - 1)) || ++ ((pagelist->offset & (g_cache_line_size - 1)) || + ((pagelist->offset + pagelist->length) & +- (CACHE_LINE_SIZE - 1)))) { +- FRAGMENTS_T *fragments; ++ (g_cache_line_size - 1)))) { ++ char *fragments; + + if (down_interruptible(&g_free_fragments_sema) != 0) { + kfree(pagelist); +@@ -464,19 +485,15 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, + WARN_ON(g_free_fragments == NULL); + + down(&g_free_fragments_mutex); +- fragments = (FRAGMENTS_T *) g_free_fragments; ++ fragments = g_free_fragments; + WARN_ON(fragments == NULL); +- g_free_fragments = *(FRAGMENTS_T **) g_free_fragments; ++ g_free_fragments = *(char **) g_free_fragments; + up(&g_free_fragments_mutex); +- pagelist->type = +- PAGELIST_READ_WITH_FRAGMENTS + (fragments - +- g_fragments_base); ++ pagelist->type = PAGELIST_READ_WITH_FRAGMENTS + ++ (fragments - g_fragments_base) / g_fragments_size; + } + +- for (page = virt_to_page(pagelist); +- page <= virt_to_page(addrs + num_pages - 1); page++) { +- flush_dcache_page(page); +- } ++ dmac_flush_range(pagelist, addrs + num_pages); + + *ppagelist = pagelist; + +@@ -502,13 +519,14 @@ free_pagelist(PAGELIST_T *pagelist, int actual) + + /* Deal with any partial cache lines (fragments) */ + if (pagelist->type >= PAGELIST_READ_WITH_FRAGMENTS) { +- FRAGMENTS_T *fragments = g_fragments_base + +- (pagelist->type - PAGELIST_READ_WITH_FRAGMENTS); ++ char *fragments = g_fragments_base + ++ (pagelist->type - PAGELIST_READ_WITH_FRAGMENTS) * ++ g_fragments_size; + int head_bytes, tail_bytes; +- head_bytes = (CACHE_LINE_SIZE - pagelist->offset) & +- (CACHE_LINE_SIZE - 1); ++ head_bytes = (g_cache_line_size - pagelist->offset) & ++ (g_cache_line_size - 1); + tail_bytes = (pagelist->offset + actual) & +- (CACHE_LINE_SIZE - 1); ++ (g_cache_line_size - 1); + + if ((actual >= 0) && (head_bytes != 0)) { + if (head_bytes > actual) +@@ -516,32 +534,46 @@ free_pagelist(PAGELIST_T *pagelist, int actual) + + memcpy((char *)page_address(pages[0]) + + pagelist->offset, +- fragments->headbuf, ++ fragments, + head_bytes); + } + if ((actual >= 0) && (head_bytes < actual) && + (tail_bytes != 0)) { + memcpy((char *)page_address(pages[num_pages - 1]) + + ((pagelist->offset + actual) & +- (PAGE_SIZE - 1) & ~(CACHE_LINE_SIZE - 1)), +- fragments->tailbuf, tail_bytes); ++ (PAGE_SIZE - 1) & ~(g_cache_line_size - 1)), ++ fragments + g_cache_line_size, ++ tail_bytes); + } + + down(&g_free_fragments_mutex); +- *(FRAGMENTS_T **) fragments = g_free_fragments; ++ *(char **)fragments = g_free_fragments; + g_free_fragments = fragments; + up(&g_free_fragments_mutex); + up(&g_free_fragments_sema); + } + +- if (*need_release) { +- for (i = 0; i < num_pages; i++) { +- if (pagelist->type != PAGELIST_WRITE) +- set_page_dirty(pages[i]); ++ if (*need_release) { ++ unsigned int length = pagelist->length; ++ unsigned int offset = pagelist->offset; + +- page_cache_release(pages[i]); ++ for (i = 0; i < num_pages; i++) { ++ struct page *pg = pages[i]; ++ ++ if (pagelist->type != PAGELIST_WRITE) { ++ unsigned int bytes = PAGE_SIZE - offset; ++ ++ if (bytes > length) ++ bytes = length; ++ dmac_unmap_area(page_address(pg) + offset, ++ bytes, DMA_FROM_DEVICE); ++ length -= bytes; ++ offset = 0; ++ set_page_dirty(pg); ++ } ++ page_cache_release(pg); + } +- } ++ } + + kfree(pagelist); + } + +From d3f1bad2c2095c829d0111a41763ec4cf3fbdeb3 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 30 Jun 2015 09:10:36 +0100 +Subject: [PATCH 107/149] BCM270X_DT: Overlay for the Fen Logic VGA666 board + +The VGA666 board requires GPIOs 2-21 (so no I2C or UART). Using the +overlay (instead of a custom dt-blob.bin) has the advantage that it will +reserve those pins and stop other devices using them (except for GPIO), +but it does delay the point at which the output becomes valid until 2-3 +seconds after the kernel has started. +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 8 +++++++ + arch/arm/boot/dts/overlays/vga666-overlay.dts | 30 +++++++++++++++++++++++++++ + 3 files changed, 39 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/vga666-overlay.dts + +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +index e91548c..74ec825 100644 +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -43,6 +43,7 @@ dtb-$(RPI_DT_OVERLAYS) += spi-bcm2708-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += spi-bcm2835-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += tinylcd35-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += uart1-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += vga666-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += w1-gpio-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += w1-gpio-pullup-overlay.dtb + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 980d358..5e1f530 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -497,6 +497,14 @@ Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14) + rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15) + + ++Name: vga666 ++Info: Overlay for the Fen Logic VGA666 board ++ This uses GPIOs 2-21 (so no I2C), and activates the output 2-3 seconds ++ after the kernel has started. ++Load: dtoverlay=vga666 ++Params: ++ ++ + Name: w1-gpio + Info: Configures the w1-gpio Onewire interface module. + Use this overlay if you *don't* need a GPIO to drive an external pullup. +diff --git a/arch/arm/boot/dts/overlays/vga666-overlay.dts b/arch/arm/boot/dts/overlays/vga666-overlay.dts +new file mode 100644 +index 0000000..7fcab96 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/vga666-overlay.dts +@@ -0,0 +1,30 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ // There is no VGA driver module, but we need a platform device ++ // node (that doesn't already use pinctrl) to hang the pinctrl ++ // reference on - leds will do ++ ++ fragment@0 { ++ target = <&leds>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vga666_pins>; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ vga666_pins: vga666_pins { ++ brcm,pins = <2 3 4 5 6 7 8 9 10 11 12 ++ 13 14 15 16 17 18 19 20 21>; ++ brcm,function = <6>; /* alt2 */ ++ brcm,pull = <0>; /* no pull */ ++ }; ++ }; ++ }; ++}; + +From f92a566b5dcec58d56cc8e7e629601f449325b0c Mon Sep 17 00:00:00 2001 +From: petit-miner +Date: Fri, 10 Jul 2015 13:59:18 +0200 +Subject: [PATCH 108/149] Added support for 2 mcp2515 CAN Bus IC + +See: https://github.com/raspberrypi/linux/issues/1018 + https://github.com/raspberrypi/linux/pull/1049 + https://github.com/raspberrypi/linux/pull/1052 +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 12 +++- + .../arm/boot/dts/overlays/mcp2515-can1-overlay.dts | 69 ++++++++++++++++++++++ + 3 files changed, 81 insertions(+), 1 deletion(-) + create mode 100644 arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts + +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +index 74ec825..4ff9836 100644 +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -29,6 +29,7 @@ dtb-$(RPI_DT_OVERLAYS) += iqaudio-dac-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += lirc-rpi-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += mcp2515-can0-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += mcp2515-can1-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += mmc-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += mz61581-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += piscreen-overlay.dtb +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 5e1f530..88ed678 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -328,7 +328,7 @@ Params: gpio_out_pin GPIO for output (default "17") + + + Name: mcp2515-can0 +-Info: Configures the MCP2515 CAN controller ++Info: Configures the MCP2515 CAN controller on spi0.0 + Load: dtoverlay=mcp2515-can0,= + Params: oscillator Clock frequency for the CAN controller (Hz) + +@@ -337,6 +337,16 @@ Params: oscillator Clock frequency for the CAN controller (Hz) + interrupt GPIO for interrupt signal + + ++Name: mcp2515-can1 ++Info: Configures the MCP2515 CAN controller on spi0.1 ++Load: dtoverlay=mcp2515-can1,= ++Params: oscillator Clock frequency for the CAN controller (Hz) ++ ++ spimaxfrequency Maximum SPI frequence (Hz) ++ ++ interrupt GPIO for interrupt signal ++ ++ + Name: mmc + Info: Selects the bcm2835-mmc SD/MMC driver, optionally with overclock + Load: dtoverlay=mmc,= +diff --git a/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts b/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts +new file mode 100644 +index 0000000..6bef9ae +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts +@@ -0,0 +1,69 @@ ++/* ++ * Device tree overlay for mcp251x/can1 on spi0.1 edited by petit_miner ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ /* disable spi-dev for spi0.1 */ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ /* the interrupt pin of the can-controller */ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ can1_pins: can1_pins { ++ brcm,pins = <25>; ++ brcm,function = <0>; /* input */ ++ }; ++ }; ++ }; ++ ++ /* the clock/oscillator of the can-controller */ ++ fragment@2 { ++ target-path = "/clocks"; ++ __overlay__ { ++ /* external oscillator of mcp2515 on spi0.1 */ ++ can1_osc: can1_osc { ++ compatible = "fixed-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <16000000>; ++ }; ++ }; ++ }; ++ ++ /* the spi config of the can-controller itself binding everything together */ ++ fragment@3 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ can1: mcp2515@1 { ++ reg = <1>; ++ compatible = "microchip,mcp2515"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&can1_pins>; ++ spi-max-frequency = <10000000>; ++ interrupt-parent = <&gpio>; ++ interrupts = <25 0x2>; ++ clocks = <&can1_osc>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ oscillator = <&can1_osc>,"clock-frequency:0"; ++ spimaxfrequency = <&can1>,"spi-max-frequency:0"; ++ interrupt = <&can1_pins>,"brcm,pins:0",<&can1>,"interrupts:0"; ++ }; ++}; + +From 5d7fd1e72db3384293037ca586ed2936b45748d3 Mon Sep 17 00:00:00 2001 +From: Lubomir Rintel +Date: Tue, 5 May 2015 13:27:45 -0700 +Subject: [PATCH 109/149] mailbox: Enable BCM2835 mailbox support + +This mailbox driver provides a single mailbox channel to write 32-bit +values to the VPU and get a 32-bit response. The Raspberry Pi +firmware uses this mailbox channel to implement firmware calls, while +Roku 2 (despite being derived from the same firmware tree) doesn't. + +The driver was originally submitted by Lubomir, based on the +out-of-tree 2708 mailbox driver. Eric Anholt fixed it up for +upstreaming, with the major functional change being that it now has no +notion of multiple channels (since that is a firmware-dependent +concept) and instead the raspberrypi-firmware driver will do that +bit-twiddling in its own messages. +[Jassi: made the 'mbox_chan_ops' struct as const and removed a redundant +variable] + +Signed-off-by: Lubomir Rintel +Signed-off-by: Craig McGeachie +Signed-off-by: Eric Anholt +Acked-by: Stephen Warren +Signed-off-by: Jassi Brar +--- + drivers/mailbox/Kconfig | 9 ++ + drivers/mailbox/Makefile | 2 + + drivers/mailbox/bcm2835-mailbox.c | 216 ++++++++++++++++++++++++++++++++++++++ + 3 files changed, 227 insertions(+) + create mode 100644 drivers/mailbox/bcm2835-mailbox.c + +diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig +index 7f19cb4..dc64c93 100644 +--- a/drivers/mailbox/Kconfig ++++ b/drivers/mailbox/Kconfig +@@ -66,4 +66,13 @@ config ALTERA_MBOX + An implementation of the Altera Mailbox soft core. It is used + to send message between processors. Say Y here if you want to use the + Altera mailbox support. ++ ++config BCM2835_MBOX ++ tristate "BCM2835 Mailbox" ++ depends on ARCH_BCM2835 ++ help ++ An implementation of the BCM2385 Mailbox. It is used to invoke ++ the services of the Videocore. Say Y here if you want to use the ++ BCM2835 Mailbox. ++ + endif +diff --git a/drivers/mailbox/Makefile b/drivers/mailbox/Makefile +index cecfad3..c86bc91 100644 +--- a/drivers/mailbox/Makefile ++++ b/drivers/mailbox/Makefile +@@ -13,3 +13,5 @@ obj-$(CONFIG_OMAP2PLUS_MBOX) += omap-mailbox.o + obj-$(CONFIG_PCC) += pcc.o + + obj-$(CONFIG_ALTERA_MBOX) += mailbox-altera.o ++ ++obj-$(CONFIG_BCM2835_MBOX) += bcm2835-mailbox.o +diff --git a/drivers/mailbox/bcm2835-mailbox.c b/drivers/mailbox/bcm2835-mailbox.c +new file mode 100644 +index 0000000..4b13268 +--- /dev/null ++++ b/drivers/mailbox/bcm2835-mailbox.c +@@ -0,0 +1,216 @@ ++/* ++ * Copyright (C) 2010,2015 Broadcom ++ * Copyright (C) 2013-2014 Lubomir Rintel ++ * Copyright (C) 2013 Craig McGeachie ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ * This device provides a mechanism for writing to the mailboxes, ++ * that are shared between the ARM and the VideoCore processor ++ * ++ * Parts of the driver are based on: ++ * - arch/arm/mach-bcm2708/vcio.c file written by Gray Girling that was ++ * obtained from branch "rpi-3.6.y" of git://github.com/raspberrypi/ ++ * linux.git ++ * - drivers/mailbox/bcm2835-ipc.c by Lubomir Rintel at ++ * https://github.com/hackerspace/rpi-linux/blob/lr-raspberry-pi/drivers/ ++ * mailbox/bcm2835-ipc.c ++ * - documentation available on the following web site: ++ * https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* Mailboxes */ ++#define ARM_0_MAIL0 0x00 ++#define ARM_0_MAIL1 0x20 ++ ++/* ++ * Mailbox registers. We basically only support mailbox 0 & 1. We ++ * deliver to the VC in mailbox 1, it delivers to us in mailbox 0. See ++ * BCM2835-ARM-Peripherals.pdf section 1.3 for an explanation about ++ * the placement of memory barriers. ++ */ ++#define MAIL0_RD (ARM_0_MAIL0 + 0x00) ++#define MAIL0_POL (ARM_0_MAIL0 + 0x10) ++#define MAIL0_STA (ARM_0_MAIL0 + 0x18) ++#define MAIL0_CNF (ARM_0_MAIL0 + 0x1C) ++#define MAIL1_WRT (ARM_0_MAIL1 + 0x00) ++ ++/* Status register: FIFO state. */ ++#define ARM_MS_FULL BIT(31) ++#define ARM_MS_EMPTY BIT(30) ++ ++/* Configuration register: Enable interrupts. */ ++#define ARM_MC_IHAVEDATAIRQEN BIT(0) ++ ++struct bcm2835_mbox { ++ void __iomem *regs; ++ spinlock_t lock; ++ struct mbox_controller controller; ++}; ++ ++static struct bcm2835_mbox *bcm2835_link_mbox(struct mbox_chan *link) ++{ ++ return container_of(link->mbox, struct bcm2835_mbox, controller); ++} ++ ++static irqreturn_t bcm2835_mbox_irq(int irq, void *dev_id) ++{ ++ struct bcm2835_mbox *mbox = dev_id; ++ struct device *dev = mbox->controller.dev; ++ struct mbox_chan *link = &mbox->controller.chans[0]; ++ ++ while (!(readl(mbox->regs + MAIL0_STA) & ARM_MS_EMPTY)) { ++ u32 msg = readl(mbox->regs + MAIL0_RD); ++ dev_dbg(dev, "Reply 0x%08X\n", msg); ++ mbox_chan_received_data(link, &msg); ++ } ++ return IRQ_HANDLED; ++} ++ ++static int bcm2835_send_data(struct mbox_chan *link, void *data) ++{ ++ struct bcm2835_mbox *mbox = bcm2835_link_mbox(link); ++ u32 msg = *(u32 *)data; ++ ++ spin_lock(&mbox->lock); ++ writel(msg, mbox->regs + MAIL1_WRT); ++ dev_dbg(mbox->controller.dev, "Request 0x%08X\n", msg); ++ spin_unlock(&mbox->lock); ++ return 0; ++} ++ ++static int bcm2835_startup(struct mbox_chan *link) ++{ ++ struct bcm2835_mbox *mbox = bcm2835_link_mbox(link); ++ ++ /* Enable the interrupt on data reception */ ++ writel(ARM_MC_IHAVEDATAIRQEN, mbox->regs + MAIL0_CNF); ++ ++ return 0; ++} ++ ++static void bcm2835_shutdown(struct mbox_chan *link) ++{ ++ struct bcm2835_mbox *mbox = bcm2835_link_mbox(link); ++ ++ writel(0, mbox->regs + MAIL0_CNF); ++} ++ ++static bool bcm2835_last_tx_done(struct mbox_chan *link) ++{ ++ struct bcm2835_mbox *mbox = bcm2835_link_mbox(link); ++ bool ret; ++ ++ spin_lock(&mbox->lock); ++ ret = !(readl(mbox->regs + MAIL0_STA) & ARM_MS_FULL); ++ spin_unlock(&mbox->lock); ++ return ret; ++} ++ ++static const struct mbox_chan_ops bcm2835_mbox_chan_ops = { ++ .send_data = bcm2835_send_data, ++ .startup = bcm2835_startup, ++ .shutdown = bcm2835_shutdown, ++ .last_tx_done = bcm2835_last_tx_done ++}; ++ ++static struct mbox_chan *bcm2835_mbox_index_xlate(struct mbox_controller *mbox, ++ const struct of_phandle_args *sp) ++{ ++ if (sp->args_count != 0) ++ return NULL; ++ ++ return &mbox->chans[0]; ++} ++ ++static int bcm2835_mbox_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ int ret = 0; ++ struct resource *iomem; ++ struct bcm2835_mbox *mbox; ++ ++ mbox = devm_kzalloc(dev, sizeof(*mbox), GFP_KERNEL); ++ if (mbox == NULL) ++ return -ENOMEM; ++ spin_lock_init(&mbox->lock); ++ ++ ret = devm_request_irq(dev, irq_of_parse_and_map(dev->of_node, 0), ++ bcm2835_mbox_irq, 0, dev_name(dev), mbox); ++ if (ret) { ++ dev_err(dev, "Failed to register a mailbox IRQ handler: %d\n", ++ ret); ++ return -ENODEV; ++ } ++ ++ iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ mbox->regs = devm_ioremap_resource(&pdev->dev, iomem); ++ if (IS_ERR(mbox->regs)) { ++ ret = PTR_ERR(mbox->regs); ++ dev_err(&pdev->dev, "Failed to remap mailbox regs: %d\n", ret); ++ return ret; ++ } ++ ++ mbox->controller.txdone_poll = true; ++ mbox->controller.txpoll_period = 5; ++ mbox->controller.ops = &bcm2835_mbox_chan_ops; ++ mbox->controller.of_xlate = &bcm2835_mbox_index_xlate; ++ mbox->controller.dev = dev; ++ mbox->controller.num_chans = 1; ++ mbox->controller.chans = devm_kzalloc(dev, ++ sizeof(*mbox->controller.chans), GFP_KERNEL); ++ if (!mbox->controller.chans) ++ return -ENOMEM; ++ ++ ret = mbox_controller_register(&mbox->controller); ++ if (ret) ++ return ret; ++ ++ platform_set_drvdata(pdev, mbox); ++ dev_info(dev, "mailbox enabled\n"); ++ ++ return ret; ++} ++ ++static int bcm2835_mbox_remove(struct platform_device *pdev) ++{ ++ struct bcm2835_mbox *mbox = platform_get_drvdata(pdev); ++ mbox_controller_unregister(&mbox->controller); ++ return 0; ++} ++ ++static const struct of_device_id bcm2835_mbox_of_match[] = { ++ { .compatible = "brcm,bcm2835-mbox", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, bcm2835_mbox_of_match); ++ ++static struct platform_driver bcm2835_mbox_driver = { ++ .driver = { ++ .name = "bcm2835-mbox", ++ .owner = THIS_MODULE, ++ .of_match_table = bcm2835_mbox_of_match, ++ }, ++ .probe = bcm2835_mbox_probe, ++ .remove = bcm2835_mbox_remove, ++}; ++module_platform_driver(bcm2835_mbox_driver); ++ ++MODULE_AUTHOR("Lubomir Rintel "); ++MODULE_DESCRIPTION("BCM2835 mailbox IPC driver"); ++MODULE_LICENSE("GPL v2"); + +From 44369d3764961e5cb7a7dfce2fdb31a86ff16b14 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Wed, 13 May 2015 13:10:32 -0700 +Subject: [PATCH 110/149] mailbox/bcm2835: Fix mailbox full detection. + +With the VC reader blocked and the ARM writing, MAIL0_STA reads empty +permanently while MAIL1_STA goes from empty (0x40000000) to non-empty +(0x00000001-0x00000007) to full (0x80000008). + +This bug ended up having no effect on us, because all of our +transactions in the client driver were synchronous and under a mutex. + +Suggested-by: Phil Elwell +Signed-off-by: Eric Anholt +Acked-by: Stephen Warren +Signed-off-by: Jassi Brar +--- + drivers/mailbox/bcm2835-mailbox.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/mailbox/bcm2835-mailbox.c b/drivers/mailbox/bcm2835-mailbox.c +index 4b13268..0b47dd4 100644 +--- a/drivers/mailbox/bcm2835-mailbox.c ++++ b/drivers/mailbox/bcm2835-mailbox.c +@@ -49,6 +49,7 @@ + #define MAIL0_STA (ARM_0_MAIL0 + 0x18) + #define MAIL0_CNF (ARM_0_MAIL0 + 0x1C) + #define MAIL1_WRT (ARM_0_MAIL1 + 0x00) ++#define MAIL1_STA (ARM_0_MAIL1 + 0x18) + + /* Status register: FIFO state. */ + #define ARM_MS_FULL BIT(31) +@@ -117,7 +118,7 @@ static bool bcm2835_last_tx_done(struct mbox_chan *link) + bool ret; + + spin_lock(&mbox->lock); +- ret = !(readl(mbox->regs + MAIL0_STA) & ARM_MS_FULL); ++ ret = !(readl(mbox->regs + MAIL1_STA) & ARM_MS_FULL); + spin_unlock(&mbox->lock); + return ret; + } + +From 4e08351a07fbe7f6e8625e3e538e94a2bc4c08bb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 26 Jun 2015 14:19:30 +0200 +Subject: [PATCH 111/149] mailbox: bcm2835: Support ARCH_BCM270x +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Make it possible to use bcm2835-mailbox without Device Tree. +Load driver early because of lacking support for deferred probing +in many drivers. + +Signed-off-by: Noralf Trønnes +--- + drivers/mailbox/Kconfig | 2 +- + drivers/mailbox/bcm2835-mailbox.c | 18 ++++++++++++++++-- + drivers/mailbox/mailbox.c | 13 ++++++++++++- + 3 files changed, 29 insertions(+), 4 deletions(-) + +diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig +index dc64c93..962b80c 100644 +--- a/drivers/mailbox/Kconfig ++++ b/drivers/mailbox/Kconfig +@@ -69,7 +69,7 @@ config ALTERA_MBOX + + config BCM2835_MBOX + tristate "BCM2835 Mailbox" +- depends on ARCH_BCM2835 ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 + help + An implementation of the BCM2385 Mailbox. It is used to invoke + the services of the Videocore. Say Y here if you want to use the +diff --git a/drivers/mailbox/bcm2835-mailbox.c b/drivers/mailbox/bcm2835-mailbox.c +index 0b47dd4..d16e286 100644 +--- a/drivers/mailbox/bcm2835-mailbox.c ++++ b/drivers/mailbox/bcm2835-mailbox.c +@@ -51,12 +51,15 @@ + #define MAIL1_WRT (ARM_0_MAIL1 + 0x00) + #define MAIL1_STA (ARM_0_MAIL1 + 0x18) + ++/* On ARCH_BCM270x these come through (arm_control.h ) */ ++#ifndef ARM_MS_FULL + /* Status register: FIFO state. */ + #define ARM_MS_FULL BIT(31) + #define ARM_MS_EMPTY BIT(30) + + /* Configuration register: Enable interrupts. */ + #define ARM_MC_IHAVEDATAIRQEN BIT(0) ++#endif + + struct bcm2835_mbox { + void __iomem *regs; +@@ -151,7 +154,7 @@ static int bcm2835_mbox_probe(struct platform_device *pdev) + return -ENOMEM; + spin_lock_init(&mbox->lock); + +- ret = devm_request_irq(dev, irq_of_parse_and_map(dev->of_node, 0), ++ ret = devm_request_irq(dev, platform_get_irq(pdev, 0), + bcm2835_mbox_irq, 0, dev_name(dev), mbox); + if (ret) { + dev_err(dev, "Failed to register a mailbox IRQ handler: %d\n", +@@ -210,7 +213,18 @@ static struct platform_driver bcm2835_mbox_driver = { + .probe = bcm2835_mbox_probe, + .remove = bcm2835_mbox_remove, + }; +-module_platform_driver(bcm2835_mbox_driver); ++ ++static int __init bcm2835_mbox_init(void) ++{ ++ return platform_driver_register(&bcm2835_mbox_driver); ++} ++arch_initcall(bcm2835_mbox_init); ++ ++static void __init bcm2835_mbox_exit(void) ++{ ++ platform_driver_unregister(&bcm2835_mbox_driver); ++} ++module_exit(bcm2835_mbox_exit); + + MODULE_AUTHOR("Lubomir Rintel "); + MODULE_DESCRIPTION("BCM2835 mailbox IPC driver"); +diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c +index 19b491d..cc07d71 100644 +--- a/drivers/mailbox/mailbox.c ++++ b/drivers/mailbox/mailbox.c +@@ -304,13 +304,23 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index) + unsigned long flags; + int ret; + +- if (!dev || !dev->of_node) { ++ if (!dev) { + pr_debug("%s: No owner device node\n", __func__); + return ERR_PTR(-ENODEV); + } + + mutex_lock(&con_mutex); + ++ if (!dev->of_node) { ++ chan = NULL; ++ /* pick the first controller in the list */ ++ list_for_each_entry(mbox, &mbox_cons, node) { ++ chan = &mbox->chans[0]; ++ break; ++ } ++ goto skip_dt; ++ } ++ + if (of_parse_phandle_with_args(dev->of_node, "mboxes", + "#mbox-cells", index, &spec)) { + dev_dbg(dev, "%s: can't parse \"mboxes\" property\n", __func__); +@@ -327,6 +337,7 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index) + + of_node_put(spec.np); + ++skip_dt: + if (!chan || chan->cl || !try_module_get(mbox->dev->driver->owner)) { + dev_dbg(dev, "%s: mailbox not free\n", __func__); + mutex_unlock(&con_mutex); + +From 3389224055b1ee2a518308c13583361f88ff5f82 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Thu, 4 Jun 2015 13:11:47 -0700 +Subject: [PATCH 112/149] ARM: bcm2835: Add the firmware driver information to + the RPi DT +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Eric Anholt +Acked-by: Lee Jones (previous version with pm-domains) +Acked-by: Stephen Warren +[Rebased on rpi-4.1.y] +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2835-rpi.dtsi | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/arch/arm/boot/dts/bcm2835-rpi.dtsi b/arch/arm/boot/dts/bcm2835-rpi.dtsi +index 466f02b..5cdfd5a 100644 +--- a/arch/arm/boot/dts/bcm2835-rpi.dtsi ++++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi +@@ -27,6 +27,13 @@ + }; + }; + ++ soc { ++ firmware: firmware { ++ compatible = "raspberrypi,bcm2835-firmware"; ++ mboxes = <&mailbox>; ++ }; ++ }; ++ + /* Onboard audio */ + audio: audio { + compatible = "brcm,bcm2835-audio"; + +From cc901351e0dd5e50ee5e11b8697a6f5b1f35ee0d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 26 Jun 2015 14:21:20 +0200 +Subject: [PATCH 113/149] firmware: bcm2835: Add missing property tags +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Noralf Trønnes +--- + include/soc/bcm2835/raspberrypi-firmware.h | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h +index 9d9efb7..d3933af 100644 +--- a/include/soc/bcm2835/raspberrypi-firmware.h ++++ b/include/soc/bcm2835/raspberrypi-firmware.h +@@ -60,6 +60,7 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_GET_MIN_VOLTAGE = 0x00030008, + RPI_FIRMWARE_GET_TURBO = 0x00030009, + RPI_FIRMWARE_GET_MAX_TEMPERATURE = 0x0003000a, ++ RPI_FIRMWARE_GET_STC = 0x0003000b, + RPI_FIRMWARE_ALLOCATE_MEMORY = 0x0003000c, + RPI_FIRMWARE_LOCK_MEMORY = 0x0003000d, + RPI_FIRMWARE_UNLOCK_MEMORY = 0x0003000e, +@@ -69,10 +70,12 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_SET_ENABLE_QPU = 0x00030012, + RPI_FIRMWARE_GET_DISPMANX_RESOURCE_MEM_HANDLE = 0x00030014, + RPI_FIRMWARE_GET_EDID_BLOCK = 0x00030020, ++ RPI_FIRMWARE_GET_CUSTOMER_OTP = 0x00030021, + RPI_FIRMWARE_SET_CLOCK_STATE = 0x00038001, + RPI_FIRMWARE_SET_CLOCK_RATE = 0x00038002, + RPI_FIRMWARE_SET_VOLTAGE = 0x00038003, + RPI_FIRMWARE_SET_TURBO = 0x00038009, ++ RPI_FIRMWARE_SET_CUSTOMER_OTP = 0x00038021, + + /* Dispmanx TAGS */ + RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE = 0x00040001, +@@ -86,6 +89,7 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_FRAMEBUFFER_GET_VIRTUAL_OFFSET = 0x00040009, + RPI_FIRMWARE_FRAMEBUFFER_GET_OVERSCAN = 0x0004000a, + RPI_FIRMWARE_FRAMEBUFFER_GET_PALETTE = 0x0004000b, ++ RPI_FIRMWARE_FRAMEBUFFER_GET_TOUCHBUF = 0x0004000f, + RPI_FIRMWARE_FRAMEBUFFER_RELEASE = 0x00048001, + RPI_FIRMWARE_FRAMEBUFFER_TEST_PHYSICAL_WIDTH_HEIGHT = 0x00044003, + RPI_FIRMWARE_FRAMEBUFFER_TEST_VIRTUAL_WIDTH_HEIGHT = 0x00044004, +@@ -95,6 +99,7 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_FRAMEBUFFER_TEST_VIRTUAL_OFFSET = 0x00044009, + RPI_FIRMWARE_FRAMEBUFFER_TEST_OVERSCAN = 0x0004400a, + RPI_FIRMWARE_FRAMEBUFFER_TEST_PALETTE = 0x0004400b, ++ RPI_FIRMWARE_FRAMEBUFFER_TEST_VSYNC = 0x0004400e, + RPI_FIRMWARE_FRAMEBUFFER_SET_PHYSICAL_WIDTH_HEIGHT = 0x00048003, + RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT = 0x00048004, + RPI_FIRMWARE_FRAMEBUFFER_SET_DEPTH = 0x00048005, +@@ -103,6 +108,9 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_OFFSET = 0x00048009, + RPI_FIRMWARE_FRAMEBUFFER_SET_OVERSCAN = 0x0004800a, + RPI_FIRMWARE_FRAMEBUFFER_SET_PALETTE = 0x0004800b, ++ RPI_FIRMWARE_FRAMEBUFFER_SET_VSYNC = 0x0004800e, ++ ++ RPI_FIRMWARE_VCHIQ_INIT = 0x00048010, + + RPI_FIRMWARE_GET_COMMAND_LINE = 0x00050001, + RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001, + +From 31139cf5452a835f8e160b7093b05dca12c6dd29 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 26 Jun 2015 14:25:01 +0200 +Subject: [PATCH 114/149] firmware: bcm2835: Support ARCH_BCM270x +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Support booting without Device Tree. +Turn on USB power. +Load driver early because of lacking support for deferred probing +in many drivers. + +Signed-off-by: Noralf Trønnes +--- + drivers/firmware/raspberrypi.c | 41 +++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 39 insertions(+), 2 deletions(-) + +diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c +index dd506cd3..b980d53 100644 +--- a/drivers/firmware/raspberrypi.c ++++ b/drivers/firmware/raspberrypi.c +@@ -28,6 +28,8 @@ struct rpi_firmware { + u32 enabled; + }; + ++static struct platform_device *g_pdev; ++ + static DEFINE_MUTEX(transaction_lock); + + static void response_callback(struct mbox_client *cl, void *msg) +@@ -183,6 +185,25 @@ rpi_firmware_print_firmware_revision(struct rpi_firmware *fw) + } + } + ++static int raspberrypi_firmware_set_power(struct rpi_firmware *fw, ++ u32 domain, bool on) ++{ ++ struct { ++ u32 domain; ++ u32 on; ++ } packet; ++ int ret; ++ ++ packet.domain = domain; ++ packet.on = on; ++ ret = rpi_firmware_property(fw, RPI_FIRMWARE_SET_POWER_STATE, ++ &packet, sizeof(packet)); ++ if (!ret && packet.on != on) ++ ret = -EINVAL; ++ ++ return ret; ++} ++ + static int rpi_firmware_probe(struct platform_device *pdev) + { + struct device *dev = &pdev->dev; +@@ -207,9 +228,13 @@ static int rpi_firmware_probe(struct platform_device *pdev) + init_completion(&fw->c); + + platform_set_drvdata(pdev, fw); ++ g_pdev = pdev; + + rpi_firmware_print_firmware_revision(fw); + ++ if (raspberrypi_firmware_set_power(fw, 3, true)) ++ dev_err(dev, "failed to turn on USB power\n"); ++ + return 0; + } + +@@ -218,6 +243,7 @@ static int rpi_firmware_remove(struct platform_device *pdev) + struct rpi_firmware *fw = platform_get_drvdata(pdev); + + mbox_free_channel(fw->chan); ++ g_pdev = NULL; + + return 0; + } +@@ -230,7 +256,7 @@ static int rpi_firmware_remove(struct platform_device *pdev) + */ + struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node) + { +- struct platform_device *pdev = of_find_device_by_node(firmware_node); ++ struct platform_device *pdev = g_pdev; + + if (!pdev) + return NULL; +@@ -253,7 +279,18 @@ static struct platform_driver rpi_firmware_driver = { + .probe = rpi_firmware_probe, + .remove = rpi_firmware_remove, + }; +-module_platform_driver(rpi_firmware_driver); ++ ++static int __init rpi_firmware_init(void) ++{ ++ return platform_driver_register(&rpi_firmware_driver); ++} ++subsys_initcall(rpi_firmware_init); ++ ++static void __init rpi_firmware_exit(void) ++{ ++ platform_driver_unregister(&rpi_firmware_driver); ++} ++module_exit(rpi_firmware_exit); + + MODULE_AUTHOR("Eric Anholt "); + MODULE_DESCRIPTION("Raspberry Pi firmware driver"); + +From fd247161acad069df68411af0500b183fbc78063 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 26 Jun 2015 14:26:10 +0200 +Subject: [PATCH 115/149] firmware: bcm2835: Support legacy mailbox API +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add support for the bcm_mailbox_*() functions. +This is temporary until all drivers have been converted to the +firmware API (rpi_firmware_property*()). + +Signed-off-by: Noralf Trønnes +--- + drivers/firmware/raspberrypi.c | 15 +++++++++++++-- + include/soc/bcm2835/raspberrypi-firmware.h | 2 ++ + 2 files changed, 15 insertions(+), 2 deletions(-) + +diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c +index b980d53..89421a9 100644 +--- a/drivers/firmware/raspberrypi.c ++++ b/drivers/firmware/raspberrypi.c +@@ -19,6 +19,7 @@ + #define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf)) + #define MBOX_CHAN(msg) ((msg) & 0xf) + #define MBOX_DATA28(msg) ((msg) & ~0xf) ++#define MBOX_CHAN_VCHIQ 3 + #define MBOX_CHAN_PROPERTY 8 + + struct rpi_firmware { +@@ -26,6 +27,7 @@ struct rpi_firmware { + struct mbox_chan *chan; /* The property channel. */ + struct completion c; + u32 enabled; ++ u32 received; + }; + + static struct platform_device *g_pdev; +@@ -35,6 +37,7 @@ static DEFINE_MUTEX(transaction_lock); + static void response_callback(struct mbox_client *cl, void *msg) + { + struct rpi_firmware *fw = container_of(cl, struct rpi_firmware, cl); ++ fw->received = *(u32 *)msg; + complete(&fw->c); + } + +@@ -42,7 +45,7 @@ static void response_callback(struct mbox_client *cl, void *msg) + * Sends a request to the firmware through the BCM2835 mailbox driver, + * and synchronously waits for the reply. + */ +-static int ++int + rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data) + { + u32 message = MBOX_MSG(chan, data); +@@ -54,7 +57,8 @@ rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data) + reinit_completion(&fw->c); + ret = mbox_send_message(fw->chan, &message); + if (ret >= 0) { +- wait_for_completion(&fw->c); ++ if (chan != MBOX_CHAN_VCHIQ) ++ wait_for_completion(&fw->c); + ret = 0; + } else { + dev_err(fw->cl.dev, "mbox_send_message returned %d\n", ret); +@@ -63,6 +67,13 @@ rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data) + + return ret; + } ++EXPORT_SYMBOL(rpi_firmware_transaction); ++ ++u32 rpi_firmware_transaction_received(struct rpi_firmware *fw) ++{ ++ return MBOX_DATA28(fw->received); ++} ++EXPORT_SYMBOL(rpi_firmware_transaction_received); + + /** + * rpi_firmware_property_list - Submit firmware property list +diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h +index d3933af..9a08cf1 100644 +--- a/include/soc/bcm2835/raspberrypi-firmware.h ++++ b/include/soc/bcm2835/raspberrypi-firmware.h +@@ -116,6 +116,8 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001, + }; + ++int rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data); ++u32 rpi_firmware_transaction_received(struct rpi_firmware *fw); + int rpi_firmware_property(struct rpi_firmware *fw, + u32 tag, void *data, size_t len); + int rpi_firmware_property_list(struct rpi_firmware *fw, + +From 491b53a48fc956dd91151f5998d54544ffeab094 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 26 Jun 2015 14:27:06 +0200 +Subject: [PATCH 116/149] char: broadcom: Add vcio module +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add module for accessing the mailbox property channel through +/dev/vcio. Was previously in bcm2708-vcio. + +Signed-off-by: Noralf Trønnes +--- + drivers/char/broadcom/Kconfig | 6 ++ + drivers/char/broadcom/Makefile | 1 + + drivers/char/broadcom/vcio.c | 175 +++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 182 insertions(+) + create mode 100644 drivers/char/broadcom/vcio.c + +diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig +index 75fa1cb..fc40846 100644 +--- a/drivers/char/broadcom/Kconfig ++++ b/drivers/char/broadcom/Kconfig +@@ -22,6 +22,12 @@ config BCM2708_VCMEM + help + Helper for videocore memory access and total size allocation. + ++config BCM_VCIO ++ tristate "Mailbox userspace access" ++ depends on BCM2835_MBOX ++ help ++ Gives access to the mailbox property channel from userspace. ++ + endif + + config BCM_VC_SM +diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile +index de8feb9..18171e2 100644 +--- a/drivers/char/broadcom/Makefile ++++ b/drivers/char/broadcom/Makefile +@@ -1,3 +1,4 @@ + obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ + obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o ++obj-$(CONFIG_BCM_VCIO) += vcio.o + obj-$(CONFIG_BCM_VC_SM) += vc_sm/ +diff --git a/drivers/char/broadcom/vcio.c b/drivers/char/broadcom/vcio.c +new file mode 100644 +index 0000000..c19bc20 +--- /dev/null ++++ b/drivers/char/broadcom/vcio.c +@@ -0,0 +1,175 @@ ++/* ++ * Copyright (C) 2010 Broadcom ++ * Copyright (C) 2015 Noralf Trønnes ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define MBOX_CHAN_PROPERTY 8 ++ ++#define VCIO_IOC_MAGIC 100 ++#define IOCTL_MBOX_PROPERTY _IOWR(VCIO_IOC_MAGIC, 0, char *) ++ ++static struct { ++ dev_t devt; ++ struct cdev cdev; ++ struct class *class; ++ struct rpi_firmware *fw; ++} vcio; ++ ++static int vcio_user_property_list(void *user) ++{ ++ u32 *buf, size; ++ int ret; ++ ++ /* The first 32-bit is the size of the buffer */ ++ if (copy_from_user(&size, user, sizeof(size))) ++ return -EFAULT; ++ ++ buf = kmalloc(size, GFP_KERNEL); ++ if (!buf) ++ return -ENOMEM; ++ ++ if (copy_from_user(buf, user, size)) { ++ kfree(buf); ++ return -EFAULT; ++ } ++ ++ /* Strip off protocol encapsulation */ ++ ret = rpi_firmware_property_list(vcio.fw, &buf[2], size - 12); ++ if (ret) { ++ kfree(buf); ++ return ret; ++ } ++ ++ buf[1] = RPI_FIRMWARE_STATUS_SUCCESS; ++ if (copy_to_user(user, buf, size)) ++ ret = -EFAULT; ++ ++ kfree(buf); ++ ++ return ret; ++} ++ ++static int vcio_device_open(struct inode *inode, struct file *file) ++{ ++ try_module_get(THIS_MODULE); ++ ++ return 0; ++} ++ ++static int vcio_device_release(struct inode *inode, struct file *file) ++{ ++ module_put(THIS_MODULE); ++ ++ return 0; ++} ++ ++static long vcio_device_ioctl(struct file *file, unsigned int ioctl_num, ++ unsigned long ioctl_param) ++{ ++ switch (ioctl_num) { ++ case IOCTL_MBOX_PROPERTY: ++ return vcio_user_property_list((void *)ioctl_param); ++ default: ++ pr_err("unknown ioctl: %d\n", ioctl_num); ++ return -EINVAL; ++ } ++} ++ ++const struct file_operations vcio_fops = { ++ .unlocked_ioctl = vcio_device_ioctl, ++ .open = vcio_device_open, ++ .release = vcio_device_release, ++}; ++ ++static int __init vcio_init(void) ++{ ++ struct device_node *np; ++ static struct device *dev; ++ int ret; ++ ++ np = of_find_compatible_node(NULL, NULL, ++ "raspberrypi,bcm2835-firmware"); ++/* Uncomment this when we only boot with Device Tree ++ if (!of_device_is_available(np)) ++ return -ENODEV; ++*/ ++ vcio.fw = rpi_firmware_get(np); ++ if (!vcio.fw) ++ return -ENODEV; ++ ++ ret = alloc_chrdev_region(&vcio.devt, 0, 1, "vcio"); ++ if (ret) { ++ pr_err("failed to allocate device number\n"); ++ return ret; ++ } ++ ++ cdev_init(&vcio.cdev, &vcio_fops); ++ vcio.cdev.owner = THIS_MODULE; ++ ret = cdev_add(&vcio.cdev, vcio.devt, 1); ++ if (ret) { ++ pr_err("failed to register device\n"); ++ goto err_unregister_chardev; ++ } ++ ++ /* ++ * Create sysfs entries ++ * 'bcm2708_vcio' is used for backwards compatibility so we don't break ++ * userspace. Raspian has a udev rule that changes the permissions. ++ */ ++ vcio.class = class_create(THIS_MODULE, "bcm2708_vcio"); ++ if (IS_ERR(vcio.class)) { ++ ret = PTR_ERR(vcio.class); ++ pr_err("failed to create class\n"); ++ goto err_cdev_del; ++ } ++ ++ dev = device_create(vcio.class, NULL, vcio.devt, NULL, "vcio"); ++ if (IS_ERR(dev)) { ++ ret = PTR_ERR(dev); ++ pr_err("failed to create device\n"); ++ goto err_class_destroy; ++ } ++ ++ return 0; ++ ++err_class_destroy: ++ class_destroy(vcio.class); ++err_cdev_del: ++ cdev_del(&vcio.cdev); ++err_unregister_chardev: ++ unregister_chrdev_region(vcio.devt, 1); ++ ++ return ret; ++} ++module_init(vcio_init); ++ ++static void __exit vcio_exit(void) ++{ ++ device_destroy(vcio.class, vcio.devt); ++ class_destroy(vcio.class); ++ cdev_del(&vcio.cdev); ++ unregister_chrdev_region(vcio.devt, 1); ++} ++module_exit(vcio_exit); ++ ++MODULE_AUTHOR("Gray Girling"); ++MODULE_AUTHOR("Noralf Trønnes"); ++MODULE_DESCRIPTION("Mailbox userspace access"); ++MODULE_LICENSE("GPL"); + +From 0c90bfa500f9c896f42a8cb59f7037b2c78fc8e5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 26 Jun 2015 14:37:19 +0200 +Subject: [PATCH 117/149] BCM270x: Switch to firmware driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +defconfig: enable BCM2835_MBOX, RASPBERRYPI_FIRMWARE and BCM_VCIO. +Add firmware node and change mailbox node in Device Tree. +Add/update platform file for firmware and mailbox. +Strip bcm2708-vcio of everything except the legacy API and hook it +up with the firmware driver. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 8 +- + arch/arm/configs/bcm2709_defconfig | 3 + + arch/arm/configs/bcmrpi_defconfig | 3 + + arch/arm/mach-bcm2708/bcm2708.c | 13 +- + arch/arm/mach-bcm2709/bcm2709.c | 13 +- + drivers/mailbox/Kconfig | 2 +- + drivers/mailbox/bcm2708-vcio.c | 353 ++-------------------------------- + 7 files changed, 51 insertions(+), 344 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index abf3e5d..2dd25f7 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -74,9 +74,10 @@ + }; + + mailbox: mailbox@7e00b800 { +- compatible = "brcm,bcm2708-vcio"; ++ compatible = "brcm,bcm2835-mbox"; + reg = <0x7e00b880 0x40>; + interrupts = <0 1>; ++ #mbox-cells = <0>; + }; + + watchdog: watchdog@7e100000 { +@@ -205,6 +206,11 @@ + <1 9>; + }; + ++ firmware: firmware { ++ compatible = "raspberrypi,bcm2835-firmware"; ++ mboxes = <&mailbox>; ++ }; ++ + leds: leds { + compatible = "gpio-leds"; + }; +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 5ecd84f..d75b104 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -574,6 +574,7 @@ CONFIG_HW_RANDOM_BCM2708=m + CONFIG_RAW_DRIVER=y + CONFIG_BRCM_CHAR_DRIVERS=y + CONFIG_BCM_VC_CMA=y ++CONFIG_BCM_VCIO=y + CONFIG_BCM_VC_SM=y + CONFIG_I2C=y + CONFIG_I2C_CHARDEV=m +@@ -1074,6 +1075,7 @@ CONFIG_FB_FLEX=m + CONFIG_FB_TFT_FBTFT_DEVICE=m + CONFIG_MAILBOX=y + CONFIG_BCM2708_MBOX=y ++CONFIG_BCM2835_MBOX=y + # CONFIG_IOMMU_SUPPORT is not set + CONFIG_EXTCON=m + CONFIG_EXTCON_ARIZONA=m +@@ -1082,6 +1084,7 @@ CONFIG_IIO_BUFFER=y + CONFIG_IIO_BUFFER_CB=y + CONFIG_IIO_KFIFO_BUF=m + CONFIG_DHT11=m ++CONFIG_RASPBERRYPI_FIRMWARE=y + CONFIG_EXT4_FS=y + CONFIG_EXT4_FS_POSIX_ACL=y + CONFIG_EXT4_FS_SECURITY=y +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 14b91fdf..9159892 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -567,6 +567,7 @@ CONFIG_HW_RANDOM_BCM2708=m + CONFIG_RAW_DRIVER=y + CONFIG_BRCM_CHAR_DRIVERS=y + CONFIG_BCM_VC_CMA=y ++CONFIG_BCM_VCIO=y + CONFIG_BCM_VC_SM=y + CONFIG_I2C=y + CONFIG_I2C_CHARDEV=m +@@ -1067,6 +1068,7 @@ CONFIG_FB_FLEX=m + CONFIG_FB_TFT_FBTFT_DEVICE=m + CONFIG_MAILBOX=y + CONFIG_BCM2708_MBOX=y ++CONFIG_BCM2835_MBOX=y + # CONFIG_IOMMU_SUPPORT is not set + CONFIG_EXTCON=m + CONFIG_EXTCON_ARIZONA=m +@@ -1075,6 +1077,7 @@ CONFIG_IIO_BUFFER=y + CONFIG_IIO_BUFFER_CB=y + CONFIG_IIO_KFIFO_BUF=m + CONFIG_DHT11=m ++CONFIG_RASPBERRYPI_FIRMWARE=y + CONFIG_EXT4_FS=y + CONFIG_EXT4_FS_POSIX_ACL=y + CONFIG_EXT4_FS_SECURITY=y +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index 937c2d3..1b9c3be 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -405,7 +405,7 @@ static struct resource bcm2708_vcio_resources[] = { + static u64 vcio_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); + + static struct platform_device bcm2708_vcio_device = { +- .name = "bcm2708_vcio", ++ .name = "bcm2835-mbox", + .id = -1, /* only one VideoCore I/O area */ + .resource = bcm2708_vcio_resources, + .num_resources = ARRAY_SIZE(bcm2708_vcio_resources), +@@ -415,6 +415,16 @@ static struct platform_device bcm2708_vcio_device = { + }, + }; + ++static u64 rpifw_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); ++ ++static struct platform_device bcm2708_rpifw_device = { ++ .name = "raspberrypi-firmware", ++ .dev = { ++ .dma_mask = &rpifw_dmamask, ++ .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON), ++ }, ++}; ++ + static struct resource bcm2708_vchiq_resources[] = { + { + .start = ARMCTRL_0_BELL_BASE, +@@ -871,6 +881,7 @@ void __init bcm2708_init(void) + + bcm_register_device_dt(&bcm2708_dmaengine_device); + bcm_register_device_dt(&bcm2708_vcio_device); ++ bcm_register_device_dt(&bcm2708_rpifw_device); + bcm_register_device_dt(&bcm2708_vchiq_device); + #ifdef CONFIG_BCM2708_GPIO + bcm_register_device_dt(&bcm2708_gpio_device); +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index fe71c50..e1934dc 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -426,7 +426,7 @@ static struct resource bcm2708_vcio_resources[] = { + static u64 vcio_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); + + static struct platform_device bcm2708_vcio_device = { +- .name = "bcm2708_vcio", ++ .name = "bcm2835-mbox", + .id = -1, /* only one VideoCore I/O area */ + .resource = bcm2708_vcio_resources, + .num_resources = ARRAY_SIZE(bcm2708_vcio_resources), +@@ -436,6 +436,16 @@ static struct platform_device bcm2708_vcio_device = { + }, + }; + ++static u64 rpifw_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); ++ ++static struct platform_device bcm2708_rpifw_device = { ++ .name = "raspberrypi-firmware", ++ .dev = { ++ .dma_mask = &rpifw_dmamask, ++ .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON), ++ }, ++}; ++ + static struct resource bcm2708_vchiq_resources[] = { + { + .start = ARMCTRL_0_BELL_BASE, +@@ -892,6 +902,7 @@ void __init bcm2709_init(void) + + bcm_register_device_dt(&bcm2708_dmaengine_device); + bcm_register_device_dt(&bcm2708_vcio_device); ++ bcm_register_device_dt(&bcm2708_rpifw_device); + bcm_register_device_dt(&bcm2708_vchiq_device); + #ifdef CONFIG_BCM2708_GPIO + bcm_register_device_dt(&bcm2708_gpio_device); +diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig +index 962b80c..d1a6671 100644 +--- a/drivers/mailbox/Kconfig ++++ b/drivers/mailbox/Kconfig +@@ -9,7 +9,7 @@ if MAILBOX + + config BCM2708_MBOX + bool "Broadcom BCM2708 Mailbox (vcio)" +- depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835 ++ depends on BCM2835_MBOX + help + Broadcom BCM2708 Mailbox (vcio) + +diff --git a/drivers/mailbox/bcm2708-vcio.c b/drivers/mailbox/bcm2708-vcio.c +index 06fb2c2f..2e4031b 100644 +--- a/drivers/mailbox/bcm2708-vcio.c ++++ b/drivers/mailbox/bcm2708-vcio.c +@@ -1,6 +1,4 @@ + /* +- * linux/arch/arm/mach-bcm2708/vcio.c +- * + * Copyright (C) 2010 Broadcom + * + * This program is free software; you can redistribute it and/or modify +@@ -12,195 +10,38 @@ + * VideoCore processor + */ + +-#include + #include +-#include +-#include +-#include + #include +-#include +-#include +-#include ++#include + #include +-#include + #include ++#include + + #define DRIVER_NAME "bcm2708_vcio" +-#define DEVICE_FILE_NAME "vcio" +- +-/* offsets from a mail box base address */ +-#define MAIL0_RD 0x00 /* read - and next 4 words */ +-#define MAIL0_POL 0x10 /* read without popping the fifo */ +-#define MAIL0_SND 0x14 /* sender ID (bottom two bits) */ +-#define MAIL0_STA 0x18 /* status */ +-#define MAIL0_CNF 0x1C /* configuration */ +-#define MAIL1_WRT 0x20 /* write - and next 4 words */ +-#define MAIL1_STA 0x38 /* status */ +- +-/* On MACH_BCM270x these come through (arm_control.h ) */ +-#ifndef ARM_MS_EMPTY +-#define ARM_MS_EMPTY BIT(30) +-#define ARM_MS_FULL BIT(31) +- +-#define ARM_MC_IHAVEDATAIRQEN BIT(0) +-#endif +- +-#define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf)) +-#define MBOX_MSG_LSB(chan, data28) (((data28) << 4) | ((chan) & 0xf)) +-#define MBOX_CHAN(msg) ((msg) & 0xf) +-#define MBOX_DATA28(msg) ((msg) & ~0xf) +-#define MBOX_DATA28_LSB(msg) (((uint32_t)msg) >> 4) +- +-#define MBOX_MAGIC 0xd0d0c0de +- +-#define MAJOR_NUM 100 +-#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *) +- +-static struct class *vcio_class; +- +-struct vc_mailbox { +- void __iomem *regs; +- uint32_t msg[MBOX_CHAN_COUNT]; +- struct semaphore sema[MBOX_CHAN_COUNT]; +- uint32_t magic; +-}; +- +-static void mbox_init(struct vc_mailbox *mbox_out) +-{ +- int i; +- +- for (i = 0; i < MBOX_CHAN_COUNT; i++) { +- mbox_out->msg[i] = 0; +- sema_init(&mbox_out->sema[i], 0); +- } +- +- /* Enable the interrupt on data reception */ +- writel(ARM_MC_IHAVEDATAIRQEN, mbox_out->regs + MAIL0_CNF); +- +- mbox_out->magic = MBOX_MAGIC; +-} +- +-static int mbox_write(struct vc_mailbox *mbox, unsigned chan, uint32_t data28) +-{ +- if (mbox->magic != MBOX_MAGIC) +- return -EINVAL; +- +- /* wait for the mailbox FIFO to have some space in it */ +- while (0 != (readl(mbox->regs + MAIL1_STA) & ARM_MS_FULL)) +- cpu_relax(); +- +- writel(MBOX_MSG(chan, data28), mbox->regs + MAIL1_WRT); +- +- return 0; +-} +- +-static int mbox_read(struct vc_mailbox *mbox, unsigned chan, uint32_t *data28) +-{ +- if (mbox->magic != MBOX_MAGIC) +- return -EINVAL; +- +- down(&mbox->sema[chan]); +- *data28 = MBOX_DATA28(mbox->msg[chan]); +- mbox->msg[chan] = 0; +- +- return 0; +-} +- +-static irqreturn_t mbox_irq_handler(int irq, void *dev_id) +-{ +- /* wait for the mailbox FIFO to have some data in it */ +- struct vc_mailbox *mbox = (struct vc_mailbox *)dev_id; +- int status = readl(mbox->regs + MAIL0_STA); +- int ret = IRQ_NONE; +- +- while (!(status & ARM_MS_EMPTY)) { +- uint32_t msg = readl(mbox->regs + MAIL0_RD); +- int chan = MBOX_CHAN(msg); +- +- if (chan < MBOX_CHAN_COUNT) { +- if (mbox->msg[chan]) { +- pr_err(DRIVER_NAME +- ": mbox chan %d overflow - drop %08x\n", +- chan, msg); +- } else { +- mbox->msg[chan] = (msg | 0xf); +- up(&mbox->sema[chan]); +- } +- } else { +- pr_err(DRIVER_NAME +- ": invalid channel selector (msg %08x)\n", msg); +- } +- ret = IRQ_HANDLED; +- status = readl(mbox->regs + MAIL0_STA); +- } +- return ret; +-} +- +-/* Mailbox Methods */ +- +-static struct device *mbox_dev; /* we assume there's only one! */ +- +-static int dev_mbox_write(struct device *dev, unsigned chan, uint32_t data28) +-{ +- struct vc_mailbox *mailbox = dev_get_drvdata(dev); +- int rc; +- +- device_lock(dev); +- rc = mbox_write(mailbox, chan, data28); +- device_unlock(dev); +- +- return rc; +-} +- +-static int dev_mbox_read(struct device *dev, unsigned chan, uint32_t *data28) +-{ +- struct vc_mailbox *mailbox = dev_get_drvdata(dev); +- int rc; +- +- device_lock(dev); +- rc = mbox_read(mailbox, chan, data28); +- device_unlock(dev); +- +- return rc; +-} + + extern int bcm_mailbox_write(unsigned chan, uint32_t data28) + { +- if (!mbox_dev) ++ struct rpi_firmware *fw = rpi_firmware_get(NULL); ++ ++ if (!fw) + return -ENODEV; + +- return dev_mbox_write(mbox_dev, chan, data28); ++ return rpi_firmware_transaction(fw, chan, data28); + } + EXPORT_SYMBOL_GPL(bcm_mailbox_write); + + extern int bcm_mailbox_read(unsigned chan, uint32_t *data28) + { +- if (!mbox_dev) +- return -ENODEV; +- +- return dev_mbox_read(mbox_dev, chan, data28); +-} +-EXPORT_SYMBOL_GPL(bcm_mailbox_read); ++ struct rpi_firmware *fw = rpi_firmware_get(NULL); + +-static int mbox_copy_from_user(void *dst, const void *src, int size) +-{ +- if ((uint32_t)src < TASK_SIZE) +- return copy_from_user(dst, src, size); +- +- memcpy(dst, src, size); +- +- return 0; +-} +- +-static int mbox_copy_to_user(void *dst, const void *src, int size) +-{ +- if ((uint32_t)dst < TASK_SIZE) +- return copy_to_user(dst, src, size); ++ if (!fw) ++ return -ENODEV; + +- memcpy(dst, src, size); ++ *data28 = rpi_firmware_transaction_received(fw); + + return 0; + } ++EXPORT_SYMBOL_GPL(bcm_mailbox_read); + + static DEFINE_MUTEX(mailbox_lock); + extern int bcm_mailbox_property(void *data, int size) +@@ -216,7 +57,7 @@ extern int bcm_mailbox_property(void *data, int size) + GFP_KERNEL); + if (mem_kern) { + /* create the message */ +- mbox_copy_from_user(mem_kern, data, size); ++ memcpy(mem_kern, data, size); + + /* send the message */ + wmb(); +@@ -226,7 +67,7 @@ extern int bcm_mailbox_property(void *data, int size) + if (s == 0) { + /* copy the response */ + rmb(); +- mbox_copy_to_user(data, mem_kern, size); ++ memcpy(data, mem_kern, size); + } + dma_free_coherent(NULL, PAGE_ALIGN(size), mem_kern, mem_bus); + } else { +@@ -240,174 +81,6 @@ extern int bcm_mailbox_property(void *data, int size) + } + EXPORT_SYMBOL_GPL(bcm_mailbox_property); + +-/* Platform Device for Mailbox */ +- +-/* This is called whenever a process attempts to open the device file */ +-static int device_open(struct inode *inode, struct file *file) +-{ +- try_module_get(THIS_MODULE); +- +- return 0; +-} +- +-static int device_release(struct inode *inode, struct file *file) +-{ +- module_put(THIS_MODULE); +- +- return 0; +-} +- +-/* +- * This function is called whenever a process tries to do an ioctl on our +- * device file. We get two extra parameters (additional to the inode and file +- * structures, which all device functions get): the number of the ioctl called +- * and the parameter given to the ioctl function. +- * +- * If the ioctl is write or read/write (meaning output is returned to the +- * calling process), the ioctl call returns the output of this function. +- * +- */ +-static long device_ioctl(struct file *file, unsigned int ioctl_num, +- unsigned long ioctl_param) +-{ +- unsigned size; +- +- switch (ioctl_num) { +- case IOCTL_MBOX_PROPERTY: +- /* +- * Receive a pointer to a message (in user space) and set that +- * to be the device's message. Get the parameter given to +- * ioctl by the process. +- */ +- mbox_copy_from_user(&size, (void *)ioctl_param, sizeof(size)); +- return bcm_mailbox_property((void *)ioctl_param, size); +- default: +- pr_err(DRIVER_NAME "unknown ioctl: %d\n", ioctl_num); +- return -EINVAL; +- } +- +- return 0; +-} +- +-/* Module Declarations */ +- +-/* +- * This structure will hold the functions to be called +- * when a process does something to the device we +- * created. Since a pointer to this structure is kept in +- * the devices table, it can't be local to +- * init_module. NULL is for unimplemented functios. +- */ +-const struct file_operations fops = { +- .unlocked_ioctl = device_ioctl, +- .open = device_open, +- .release = device_release, /* a.k.a. close */ +-}; +- +-static int bcm_vcio_probe(struct platform_device *pdev) +-{ +- struct device *dev = &pdev->dev; +- struct device *vdev; +- struct vc_mailbox *mailbox; +- struct resource *res; +- int irq, ret; +- +- mailbox = devm_kzalloc(dev, sizeof(*mailbox), GFP_KERNEL); +- if (!mailbox) +- return -ENOMEM; +- +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- mailbox->regs = devm_ioremap_resource(dev, res); +- if (IS_ERR(mailbox->regs)) +- return PTR_ERR(mailbox->regs); +- +- irq = platform_get_irq(pdev, 0); +- ret = devm_request_irq(dev, irq, mbox_irq_handler, +- IRQF_IRQPOLL, +- dev_name(dev), mailbox); +- if (ret) { +- dev_err(dev, "Interrupt request failed %d\n", ret); +- return ret; +- } +- +- ret = register_chrdev(MAJOR_NUM, DEVICE_FILE_NAME, &fops); +- if (ret < 0) { +- pr_err("Character device registration failed %d\n", ret); +- return ret; +- } +- +- vcio_class = class_create(THIS_MODULE, DRIVER_NAME); +- if (IS_ERR(vcio_class)) { +- ret = PTR_ERR(vcio_class); +- pr_err("Class creation failed %d\n", ret); +- goto err_class; +- } +- +- vdev = device_create(vcio_class, NULL, MKDEV(MAJOR_NUM, 0), NULL, +- "vcio"); +- if (IS_ERR(vdev)) { +- ret = PTR_ERR(vdev); +- pr_err("Device creation failed %d\n", ret); +- goto err_dev; +- } +- +- mbox_init(mailbox); +- platform_set_drvdata(pdev, mailbox); +- mbox_dev = dev; +- +- dev_info(dev, "mailbox at %p\n", mailbox->regs); +- +- return 0; +- +-err_dev: +- class_destroy(vcio_class); +-err_class: +- unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); +- +- return ret; +-} +- +-static int bcm_vcio_remove(struct platform_device *pdev) +-{ +- mbox_dev = NULL; +- platform_set_drvdata(pdev, NULL); +- device_destroy(vcio_class, MKDEV(MAJOR_NUM, 0)); +- class_destroy(vcio_class); +- unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); +- +- return 0; +-} +- +-static const struct of_device_id bcm_vcio_of_match_table[] = { +- { .compatible = "brcm,bcm2708-vcio", }, +- {}, +-}; +-MODULE_DEVICE_TABLE(of, bcm_vcio_of_match_table); +- +-static struct platform_driver bcm_mbox_driver = { +- .probe = bcm_vcio_probe, +- .remove = bcm_vcio_remove, +- +- .driver = { +- .name = DRIVER_NAME, +- .owner = THIS_MODULE, +- .of_match_table = bcm_vcio_of_match_table, +- }, +-}; +- +-static int __init bcm_mbox_init(void) +-{ +- return platform_driver_register(&bcm_mbox_driver); +-} +- +-static void __exit bcm_mbox_exit(void) +-{ +- platform_driver_unregister(&bcm_mbox_driver); +-} +- +-arch_initcall(bcm_mbox_init); /* Initialize early */ +-module_exit(bcm_mbox_exit); +- + MODULE_AUTHOR("Gray Girling"); + MODULE_DESCRIPTION("ARM I/O to VideoCore processor"); + MODULE_LICENSE("GPL"); + +From 261e67ec20793d9a0f615e16b7bce7ae7a70e138 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 26 Jun 2015 14:39:21 +0200 +Subject: [PATCH 118/149] bcm2835: Switch to firmware driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +defconfig: enable BCM2835_MBOX, RASPBERRYPI_FIRMWARE and BCM_VCIO. + +Add firmware node and change mailbox node in Device Tree. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2835.dtsi | 3 ++- + arch/arm/configs/bcm2835_defconfig | 3 +++ + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi +index 4b6dd65f..4a63704 100644 +--- a/arch/arm/boot/dts/bcm2835.dtsi ++++ b/arch/arm/boot/dts/bcm2835.dtsi +@@ -62,9 +62,10 @@ + }; + + mailbox: mailbox@7e00b800 { +- compatible = "brcm,bcm2708-vcio"; ++ compatible = "brcm,bcm2835-mbox"; + reg = <0x7e00b880 0x40>; + interrupts = <0 1>; ++ #mbox-cells = <0>; + }; + + gpio: gpio@7e200000 { +diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig +index 47f2a6a..c284414 100644 +--- a/arch/arm/configs/bcm2835_defconfig ++++ b/arch/arm/configs/bcm2835_defconfig +@@ -568,6 +568,7 @@ CONFIG_HW_RANDOM_BCM2835=m + CONFIG_RAW_DRIVER=y + CONFIG_BRCM_CHAR_DRIVERS=y + CONFIG_BCM_VC_CMA=y ++CONFIG_BCM_VCIO=y + CONFIG_BCM_VC_SM=y + CONFIG_I2C=y + CONFIG_I2C_CHARDEV=m +@@ -1064,9 +1065,11 @@ CONFIG_FB_FLEX=m + CONFIG_FB_TFT_FBTFT_DEVICE=m + CONFIG_MAILBOX=y + CONFIG_BCM2708_MBOX=y ++CONFIG_BCM2835_MBOX=y + # CONFIG_IOMMU_SUPPORT is not set + CONFIG_EXTCON=m + CONFIG_EXTCON_ARIZONA=m ++CONFIG_RASPBERRYPI_FIRMWARE=y + CONFIG_EXT2_FS=y + CONFIG_EXT2_FS_XATTR=y + CONFIG_EXT2_FS_POSIX_ACL=y + +From 564c166a50d6db491679366414e4c51d58b951d4 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 13 Jul 2015 13:25:31 +0100 +Subject: [PATCH 119/149] Merge pull request #1059 from pelwell/rpi-4.0.y + +w1_therm: Back-port locking improvements from 4.2-rc1 +--- + Documentation/ABI/stable/sysfs-driver-w1_ds28ea00 | 6 ++ + Documentation/w1/slaves/w1_therm | 11 ++- + drivers/w1/slaves/w1_therm.c | 102 +++++++++++++++++++++- + 3 files changed, 117 insertions(+), 2 deletions(-) + create mode 100644 Documentation/ABI/stable/sysfs-driver-w1_ds28ea00 + +diff --git a/Documentation/ABI/stable/sysfs-driver-w1_ds28ea00 b/Documentation/ABI/stable/sysfs-driver-w1_ds28ea00 +new file mode 100644 +index 0000000..e928def +--- /dev/null ++++ b/Documentation/ABI/stable/sysfs-driver-w1_ds28ea00 +@@ -0,0 +1,6 @@ ++What: /sys/bus/w1/devices/.../w1_seq ++Date: Apr 2015 ++Contact: Matt Campbell ++Description: Support for the DS28EA00 chain sequence function ++ see Documentation/w1/slaves/w1_therm for detailed information ++Users: any user space application which wants to communicate with DS28EA00 +diff --git a/Documentation/w1/slaves/w1_therm b/Documentation/w1/slaves/w1_therm +index cc62a95..13411fe 100644 +--- a/Documentation/w1/slaves/w1_therm ++++ b/Documentation/w1/slaves/w1_therm +@@ -11,12 +11,14 @@ Author: Evgeniy Polyakov + Description + ----------- + +-w1_therm provides basic temperature conversion for ds18*20 devices. ++w1_therm provides basic temperature conversion for ds18*20 devices, and the ++ds28ea00 device. + supported family codes: + W1_THERM_DS18S20 0x10 + W1_THERM_DS1822 0x22 + W1_THERM_DS18B20 0x28 + W1_THERM_DS1825 0x3B ++W1_THERM_DS28EA00 0x42 + + Support is provided through the sysfs w1_slave file. Each open and + read sequence will initiate a temperature conversion then provide two +@@ -48,3 +50,10 @@ resistor). The DS18b20 temperature sensor specification lists a + maximum current draw of 1.5mA and that a 5k pullup resistor is not + sufficient. The strong pullup is designed to provide the additional + current required. ++ ++The DS28EA00 provides an additional two pins for implementing a sequence ++detection algorithm. This feature allows you to determine the physical ++location of the chip in the 1-wire bus without needing pre-existing ++knowledge of the bus ordering. Support is provided through the sysfs ++w1_seq file. The file will contain a single line with an integer value ++representing the device index in the bus starting at 0. +diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c +index 55eb86c..2f029e8 100644 +--- a/drivers/w1/slaves/w1_therm.c ++++ b/drivers/w1/slaves/w1_therm.c +@@ -92,13 +92,24 @@ static void w1_therm_remove_slave(struct w1_slave *sl) + static ssize_t w1_slave_show(struct device *device, + struct device_attribute *attr, char *buf); + ++static ssize_t w1_seq_show(struct device *device, ++ struct device_attribute *attr, char *buf); ++ + static DEVICE_ATTR_RO(w1_slave); ++static DEVICE_ATTR_RO(w1_seq); + + static struct attribute *w1_therm_attrs[] = { + &dev_attr_w1_slave.attr, + NULL, + }; ++ ++static struct attribute *w1_ds28ea00_attrs[] = { ++ &dev_attr_w1_slave.attr, ++ &dev_attr_w1_seq.attr, ++ NULL, ++}; + ATTRIBUTE_GROUPS(w1_therm); ++ATTRIBUTE_GROUPS(w1_ds28ea00); + + static struct w1_family_ops w1_therm_fops = { + .add_slave = w1_therm_add_slave, +@@ -106,6 +117,12 @@ static struct w1_family_ops w1_therm_fops = { + .groups = w1_therm_groups, + }; + ++static struct w1_family_ops w1_ds28ea00_fops = { ++ .add_slave = w1_therm_add_slave, ++ .remove_slave = w1_therm_remove_slave, ++ .groups = w1_ds28ea00_groups, ++}; ++ + static struct w1_family w1_therm_family_DS18S20 = { + .fid = W1_THERM_DS18S20, + .fops = &w1_therm_fops, +@@ -123,7 +140,7 @@ static struct w1_family w1_therm_family_DS1822 = { + + static struct w1_family w1_therm_family_DS28EA00 = { + .fid = W1_THERM_DS28EA00, +- .fops = &w1_therm_fops, ++ .fops = &w1_ds28ea00_fops, + }; + + static struct w1_family w1_therm_family_DS1825 = { +@@ -316,6 +333,89 @@ static ssize_t w1_slave_show(struct device *device, + return ret; + } + ++#define W1_42_CHAIN 0x99 ++#define W1_42_CHAIN_OFF 0x3C ++#define W1_42_CHAIN_OFF_INV 0xC3 ++#define W1_42_CHAIN_ON 0x5A ++#define W1_42_CHAIN_ON_INV 0xA5 ++#define W1_42_CHAIN_DONE 0x96 ++#define W1_42_CHAIN_DONE_INV 0x69 ++#define W1_42_COND_READ 0x0F ++#define W1_42_SUCCESS_CONFIRM_BYTE 0xAA ++#define W1_42_FINISHED_BYTE 0xFF ++static ssize_t w1_seq_show(struct device *device, ++ struct device_attribute *attr, char *buf) ++{ ++ struct w1_slave *sl = dev_to_w1_slave(device); ++ ssize_t c = PAGE_SIZE; ++ int rv; ++ int i; ++ u8 ack; ++ u64 rn; ++ struct w1_reg_num *reg_num; ++ int seq = 0; ++ ++ mutex_lock(&sl->master->bus_mutex); ++ /* Place all devices in CHAIN state */ ++ if (w1_reset_bus(sl->master)) ++ goto error; ++ w1_write_8(sl->master, W1_SKIP_ROM); ++ w1_write_8(sl->master, W1_42_CHAIN); ++ w1_write_8(sl->master, W1_42_CHAIN_ON); ++ w1_write_8(sl->master, W1_42_CHAIN_ON_INV); ++ msleep(sl->master->pullup_duration); ++ ++ /* check for acknowledgment */ ++ ack = w1_read_8(sl->master); ++ if (ack != W1_42_SUCCESS_CONFIRM_BYTE) ++ goto error; ++ ++ /* In case the bus fails to send 0xFF, limit*/ ++ for (i = 0; i <= 64; i++) { ++ if (w1_reset_bus(sl->master)) ++ goto error; ++ ++ w1_write_8(sl->master, W1_42_COND_READ); ++ rv = w1_read_block(sl->master, (u8 *)&rn, 8); ++ reg_num = (struct w1_reg_num *) &rn; ++ if (reg_num->family == W1_42_FINISHED_BYTE) ++ break; ++ if (sl->reg_num.id == reg_num->id) ++ seq = i; ++ ++ w1_write_8(sl->master, W1_42_CHAIN); ++ w1_write_8(sl->master, W1_42_CHAIN_DONE); ++ w1_write_8(sl->master, W1_42_CHAIN_DONE_INV); ++ w1_read_block(sl->master, &ack, sizeof(ack)); ++ ++ /* check for acknowledgment */ ++ ack = w1_read_8(sl->master); ++ if (ack != W1_42_SUCCESS_CONFIRM_BYTE) ++ goto error; ++ ++ } ++ ++ /* Exit from CHAIN state */ ++ if (w1_reset_bus(sl->master)) ++ goto error; ++ w1_write_8(sl->master, W1_SKIP_ROM); ++ w1_write_8(sl->master, W1_42_CHAIN); ++ w1_write_8(sl->master, W1_42_CHAIN_OFF); ++ w1_write_8(sl->master, W1_42_CHAIN_OFF_INV); ++ ++ /* check for acknowledgment */ ++ ack = w1_read_8(sl->master); ++ if (ack != W1_42_SUCCESS_CONFIRM_BYTE) ++ goto error; ++ mutex_unlock(&sl->master->bus_mutex); ++ ++ c -= snprintf(buf + PAGE_SIZE - c, c, "%d\n", seq); ++ return PAGE_SIZE - c; ++error: ++ mutex_unlock(&sl->master->bus_mutex); ++ return -EIO; ++} ++ + static int __init w1_therm_init(void) + { + int err, i; + +From 01f81174825984b4f3d309ffcdade224d94ab572 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 14 Jul 2015 11:11:51 +0100 +Subject: [PATCH 120/149] vchiq_arm: Sort out the vmalloc case + +See: https://github.com/raspberrypi/linux/issues/1055 +--- + .../misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +index 5edba23..56bff05 100644 +--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +@@ -394,21 +394,21 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, + if (is_vmalloc_addr(buf)) { + int dir = (type == PAGELIST_WRITE) ? + DMA_TO_DEVICE : DMA_FROM_DEVICE; +- unsigned long length = pagelist->length; +- unsigned int offset = pagelist->offset; ++ unsigned long length = count; ++ unsigned int off = offset; + + for (actual_pages = 0; actual_pages < num_pages; + actual_pages++) { + struct page *pg = vmalloc_to_page(buf + (actual_pages * + PAGE_SIZE)); +- size_t bytes = PAGE_SIZE - offset; ++ size_t bytes = PAGE_SIZE - off; + + if (bytes > length) + bytes = length; + pages[actual_pages] = pg; +- dmac_map_area(page_address(pg) + offset, bytes, dir); ++ dmac_map_area(page_address(pg) + off, bytes, dir); + length -= bytes; +- offset = 0; ++ off = 0; + } + *need_release = 0; /* do not try and release vmalloc pages */ + } else { + +From 6a9ee1422507ded4b20bb30b34a1ae8151ae2141 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 14 Jul 2015 10:26:09 +0100 +Subject: [PATCH 121/149] spidev: Add "spidev" compatible string to silence + warning + +See: https://github.com/raspberrypi/linux/issues/1054 +--- + drivers/spi/spidev.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c +index 92c909e..0535375 100644 +--- a/drivers/spi/spidev.c ++++ b/drivers/spi/spidev.c +@@ -706,6 +706,7 @@ static struct class *spidev_class; + #ifdef CONFIG_OF + static const struct of_device_id spidev_dt_ids[] = { + { .compatible = "rohm,dh2228fv" }, ++ { .compatible = "spidev" }, + {}, + }; + MODULE_DEVICE_TABLE(of, spidev_dt_ids); + +From 710b1c336c5ca81b429212218b6209df1db468c9 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 14 Jul 2015 14:32:47 +0100 +Subject: [PATCH 122/149] Merge pull request #1043 from XECDesign/sense-4.0 + +mfd: Add Raspberry Pi Sense HAT core driver +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 6 + + arch/arm/boot/dts/overlays/rpi-sense-overlay.dts | 47 +++++ + arch/arm/configs/bcm2709_defconfig | 2 + + arch/arm/configs/bcmrpi_defconfig | 2 + + drivers/input/joystick/Kconfig | 8 + + drivers/input/joystick/Makefile | 1 + + drivers/input/joystick/rpisense-js.c | 153 +++++++++++++++ + drivers/mfd/Kconfig | 8 + + drivers/mfd/Makefile | 2 + + drivers/mfd/rpisense-core.c | 157 +++++++++++++++ + drivers/video/fbdev/Kconfig | 13 ++ + drivers/video/fbdev/Makefile | 1 + + drivers/video/fbdev/rpisense-fb.c | 235 +++++++++++++++++++++++ + include/linux/mfd/rpisense/core.h | 47 +++++ + include/linux/mfd/rpisense/framebuffer.h | 28 +++ + include/linux/mfd/rpisense/joystick.h | 35 ++++ + 17 files changed, 746 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/rpi-sense-overlay.dts + create mode 100644 drivers/input/joystick/rpisense-js.c + create mode 100644 drivers/mfd/rpisense-core.c + create mode 100644 drivers/video/fbdev/rpisense-fb.c + create mode 100644 include/linux/mfd/rpisense/core.h + create mode 100644 include/linux/mfd/rpisense/framebuffer.h + create mode 100644 include/linux/mfd/rpisense/joystick.h + +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +index 4ff9836..5f6082f 100644 +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -39,6 +39,7 @@ dtb-$(RPI_DT_OVERLAYS) += rpi-dac-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += rpi-display-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += rpi-ft5406-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += rpi-proto-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += rpi-sense-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += sdhost-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += spi-bcm2708-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += spi-bcm2835-overlay.dtb +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 88ed678..8792f98 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -442,6 +442,12 @@ Load: dtoverlay=rpi-proto + Params: + + ++Name: rpi-sense ++Info: Raspberry Pi Sense HAT ++Load: dtoverlay=rpi-sense ++Params: ++ ++ + Name: sdhost + Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock + Load: dtoverlay=sdhost,= +diff --git a/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts b/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts +new file mode 100644 +index 0000000..2715324 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts +@@ -0,0 +1,47 @@ ++// rpi-sense HAT ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ rpi-sense@46 { ++ compatible = "rpi,rpi-sense"; ++ reg = <0x46>; ++ keys-int-gpios = <&gpio 23 1>; ++ status = "okay"; ++ }; ++ ++ lsm9ds1-magn@1c { ++ compatible = "st,lsm9ds1-magn"; ++ reg = <0x1c>; ++ status = "okay"; ++ }; ++ ++ lsm9ds1-accel6a { ++ compatible = "st,lsm9ds1-accel"; ++ reg = <0x6a>; ++ status = "okay"; ++ }; ++ ++ lps25h-press@5c { ++ compatible = "st,lps25h-press"; ++ reg = <0x5c>; ++ status = "okay"; ++ }; ++ ++ hts221-humid@5f { ++ compatible = "st,hts221-humid"; ++ reg = <0x5f>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index d75b104..f78a483 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -533,6 +533,7 @@ CONFIG_JOYSTICK_IFORCE=m + CONFIG_JOYSTICK_IFORCE_USB=y + CONFIG_JOYSTICK_XPAD=m + CONFIG_JOYSTICK_XPAD_FF=y ++CONFIG_JOYSTICK_RPISENSE=m + CONFIG_INPUT_TOUCHSCREEN=y + CONFIG_TOUCHSCREEN_ADS7846=m + CONFIG_TOUCHSCREEN_EGALAX=m +@@ -789,6 +790,7 @@ CONFIG_VIDEO_MT9V011=m + CONFIG_FB=y + CONFIG_FB_BCM2708=y + CONFIG_FB_SSD1307=m ++CONFIG_FB_RPISENSE=m + # CONFIG_BACKLIGHT_GENERIC is not set + CONFIG_BACKLIGHT_GPIO=m + CONFIG_FRAMEBUFFER_CONSOLE=y +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 9159892..b9b5bdf 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -526,6 +526,7 @@ CONFIG_JOYSTICK_IFORCE=m + CONFIG_JOYSTICK_IFORCE_USB=y + CONFIG_JOYSTICK_XPAD=m + CONFIG_JOYSTICK_XPAD_FF=y ++CONFIG_JOYSTICK_RPISENSE=m + CONFIG_INPUT_TOUCHSCREEN=y + CONFIG_TOUCHSCREEN_ADS7846=m + CONFIG_TOUCHSCREEN_EGALAX=m +@@ -782,6 +783,7 @@ CONFIG_VIDEO_MT9V011=m + CONFIG_FB=y + CONFIG_FB_BCM2708=y + CONFIG_FB_SSD1307=m ++CONFIG_FB_RPISENSE=m + # CONFIG_BACKLIGHT_GENERIC is not set + CONFIG_BACKLIGHT_GPIO=m + CONFIG_FRAMEBUFFER_CONSOLE=y +diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig +index 56eb471..73e3a23 100644 +--- a/drivers/input/joystick/Kconfig ++++ b/drivers/input/joystick/Kconfig +@@ -329,4 +329,12 @@ config JOYSTICK_MAPLE + To compile this as a module choose M here: the module will be called + maplecontrol. + ++config JOYSTICK_RPISENSE ++ tristate "Raspberry Pi Sense HAT joystick" ++ depends on GPIOLIB && INPUT ++ select MFD_RPISENSE_CORE ++ ++ help ++ This is the joystick driver for the Raspberry Pi Sense HAT ++ + endif +diff --git a/drivers/input/joystick/Makefile b/drivers/input/joystick/Makefile +index 92dc0de..1758160 100644 +--- a/drivers/input/joystick/Makefile ++++ b/drivers/input/joystick/Makefile +@@ -32,4 +32,5 @@ obj-$(CONFIG_JOYSTICK_WARRIOR) += warrior.o + obj-$(CONFIG_JOYSTICK_XPAD) += xpad.o + obj-$(CONFIG_JOYSTICK_ZHENHUA) += zhenhua.o + obj-$(CONFIG_JOYSTICK_WALKERA0701) += walkera0701.o ++obj-$(CONFIG_JOYSTICK_RPISENSE) += rpisense-js.o + +diff --git a/drivers/input/joystick/rpisense-js.c b/drivers/input/joystick/rpisense-js.c +new file mode 100644 +index 0000000..9eca897 +--- /dev/null ++++ b/drivers/input/joystick/rpisense-js.c +@@ -0,0 +1,153 @@ ++/* ++ * Raspberry Pi Sense HAT joystick driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#include ++ ++#include ++#include ++ ++struct rpisense *rpisense; ++unsigned char keymap[5] = {KEY_DOWN, KEY_RIGHT, KEY_UP, KEY_ENTER, KEY_LEFT,}; ++ ++static void keys_work_fn(struct work_struct *work) ++{ ++ int i; ++ static s32 prev_keys; ++ struct rpisense_js *rpisense_js = &rpisense->joystick; ++ s32 keys = rpisense_reg_read(rpisense, RPISENSE_KEYS); ++ s32 changes = keys ^ prev_keys; ++ ++ prev_keys = keys; ++ for (i = 0; i < 5; i++) { ++ if (changes & 1) { ++ input_report_key(rpisense_js->keys_dev, ++ keymap[i], keys & 1); ++ } ++ changes >>= 1; ++ keys >>= 1; ++ } ++ input_sync(rpisense_js->keys_dev); ++} ++ ++static irqreturn_t keys_irq_handler(int irq, void *pdev) ++{ ++ struct rpisense_js *rpisense_js = &rpisense->joystick; ++ ++ schedule_work(&rpisense_js->keys_work_s); ++ return IRQ_HANDLED; ++} ++ ++static int rpisense_js_probe(struct platform_device *pdev) ++{ ++ int ret; ++ int i; ++ struct rpisense_js *rpisense_js; ++ ++ rpisense = rpisense_get_dev(); ++ rpisense_js = &rpisense->joystick; ++ ++ INIT_WORK(&rpisense_js->keys_work_s, keys_work_fn); ++ ++ rpisense_js->keys_dev = input_allocate_device(); ++ if (!rpisense_js->keys_dev) { ++ dev_err(&pdev->dev, "Could not allocate input device.\n"); ++ return -ENOMEM; ++ } ++ ++ rpisense_js->keys_dev->evbit[0] = BIT_MASK(EV_KEY); ++ for (i = 0; i < ARRAY_SIZE(keymap); i++) { ++ set_bit(keymap[i], ++ rpisense_js->keys_dev->keybit); ++ } ++ ++ rpisense_js->keys_dev->name = "Raspberry Pi Sense HAT Joystick"; ++ rpisense_js->keys_dev->phys = "rpi-sense-joy/input0"; ++ rpisense_js->keys_dev->id.bustype = BUS_I2C; ++ rpisense_js->keys_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); ++ rpisense_js->keys_dev->keycode = keymap; ++ rpisense_js->keys_dev->keycodesize = sizeof(unsigned char); ++ rpisense_js->keys_dev->keycodemax = ARRAY_SIZE(keymap); ++ ++ ret = input_register_device(rpisense_js->keys_dev); ++ if (ret) { ++ dev_err(&pdev->dev, "Could not register input device.\n"); ++ goto err_keys_alloc; ++ } ++ ++ ret = gpiod_direction_input(rpisense_js->keys_desc); ++ if (ret) { ++ dev_err(&pdev->dev, "Could not set keys-int direction.\n"); ++ goto err_keys_reg; ++ } ++ ++ rpisense_js->keys_irq = gpiod_to_irq(rpisense_js->keys_desc); ++ if (rpisense_js->keys_irq < 0) { ++ dev_err(&pdev->dev, "Could not determine keys-int IRQ.\n"); ++ ret = rpisense_js->keys_irq; ++ goto err_keys_reg; ++ } ++ ++ ret = devm_request_irq(&pdev->dev, rpisense_js->keys_irq, ++ keys_irq_handler, IRQF_TRIGGER_RISING, ++ "keys", &pdev->dev); ++ if (ret) { ++ dev_err(&pdev->dev, "IRQ request failed.\n"); ++ goto err_keys_reg; ++ } ++ return 0; ++err_keys_reg: ++ input_unregister_device(rpisense_js->keys_dev); ++err_keys_alloc: ++ input_free_device(rpisense_js->keys_dev); ++ return ret; ++} ++ ++static int rpisense_js_remove(struct platform_device *pdev) ++{ ++ struct rpisense_js *rpisense_js = &rpisense->joystick; ++ ++ input_unregister_device(rpisense_js->keys_dev); ++ input_free_device(rpisense_js->keys_dev); ++ return 0; ++} ++ ++#ifdef CONFIG_OF ++static const struct of_device_id rpisense_js_id[] = { ++ { .compatible = "rpi,rpi-sense-js" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, rpisense_js_id); ++#endif ++ ++static struct platform_device_id rpisense_js_device_id[] = { ++ { .name = "rpi-sense-js" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(platform, rpisense_js_device_id); ++ ++static struct platform_driver rpisense_js_driver = { ++ .probe = rpisense_js_probe, ++ .remove = rpisense_js_remove, ++ .driver = { ++ .name = "rpi-sense-js", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++module_platform_driver(rpisense_js_driver); ++ ++MODULE_DESCRIPTION("Raspberry Pi Sense HAT joystick driver"); ++MODULE_AUTHOR("Serge Schneider "); ++MODULE_LICENSE("GPL"); +diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig +index d5ad04d..dfb730e 100644 +--- a/drivers/mfd/Kconfig ++++ b/drivers/mfd/Kconfig +@@ -10,6 +10,14 @@ config MFD_CORE + select IRQ_DOMAIN + default n + ++config MFD_RPISENSE_CORE ++ tristate "Raspberry Pi Sense HAT core functions" ++ depends on I2C ++ select MFD_CORE ++ help ++ This is the core driver for the Raspberry Pi Sense HAT. This provides ++ the necessary functions to communicate with the hardware. ++ + config MFD_CS5535 + tristate "AMD CS5535 and CS5536 southbridge core functions" + select MFD_CORE +diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile +index 0e5cfeb..9c491fb 100644 +--- a/drivers/mfd/Makefile ++++ b/drivers/mfd/Makefile +@@ -185,3 +185,5 @@ obj-$(CONFIG_MFD_SKY81452) += sky81452.o + intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o + obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o + obj-$(CONFIG_MFD_MT6397) += mt6397-core.o ++ ++obj-$(CONFIG_MFD_RPISENSE_CORE) += rpisense-core.o +diff --git a/drivers/mfd/rpisense-core.c b/drivers/mfd/rpisense-core.c +new file mode 100644 +index 0000000..7539547 +--- /dev/null ++++ b/drivers/mfd/rpisense-core.c +@@ -0,0 +1,157 @@ ++/* ++ * Raspberry Pi Sense HAT core driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ * This driver is based on wm8350 implementation. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++struct rpisense *rpisense; ++ ++static void rpisense_client_dev_register(struct rpisense *rpisense, ++ const char *name, ++ struct platform_device **pdev) ++{ ++ int ret; ++ ++ *pdev = platform_device_alloc(name, -1); ++ if (*pdev == NULL) { ++ dev_err(rpisense->dev, "Failed to allocate %s\n", name); ++ return; ++ } ++ ++ (*pdev)->dev.parent = rpisense->dev; ++ platform_set_drvdata(*pdev, rpisense); ++ ret = platform_device_add(*pdev); ++ if (ret != 0) { ++ dev_err(rpisense->dev, "Failed to register %s: %d\n", ++ name, ret); ++ platform_device_put(*pdev); ++ *pdev = NULL; ++ } ++} ++ ++static int rpisense_probe(struct i2c_client *i2c, ++ const struct i2c_device_id *id) ++{ ++ int ret; ++ struct rpisense_js *rpisense_js; ++ ++ rpisense = devm_kzalloc(&i2c->dev, sizeof(struct rpisense), GFP_KERNEL); ++ if (rpisense == NULL) ++ return -ENOMEM; ++ ++ i2c_set_clientdata(i2c, rpisense); ++ rpisense->dev = &i2c->dev; ++ rpisense->i2c_client = i2c; ++ ++ ret = rpisense_reg_read(rpisense, RPISENSE_WAI); ++ if (ret > 0) { ++ if (ret != 's') ++ return -EINVAL; ++ } else { ++ return ret; ++ } ++ ret = rpisense_reg_read(rpisense, RPISENSE_VER); ++ if (ret < 0) ++ return ret; ++ ++ dev_info(rpisense->dev, ++ "Raspberry Pi Sense HAT firmware version %i\n", ret); ++ ++ rpisense_js = &rpisense->joystick; ++ rpisense_js->keys_desc = devm_gpiod_get(&i2c->dev, ++ "keys-int", GPIOD_IN); ++ if (IS_ERR(rpisense_js->keys_desc)) { ++ dev_warn(&i2c->dev, "Failed to get keys-int descriptor.\n"); ++ rpisense_js->keys_desc = gpio_to_desc(23); ++ if (rpisense_js->keys_desc == NULL) { ++ dev_err(&i2c->dev, "GPIO23 fallback failed.\n"); ++ return PTR_ERR(rpisense_js->keys_desc); ++ } ++ } ++ rpisense_client_dev_register(rpisense, "rpi-sense-js", ++ &(rpisense->joystick.pdev)); ++ rpisense_client_dev_register(rpisense, "rpi-sense-fb", ++ &(rpisense->framebuffer.pdev)); ++ ++ return 0; ++} ++ ++static int rpisense_remove(struct i2c_client *i2c) ++{ ++ struct rpisense *rpisense = i2c_get_clientdata(i2c); ++ ++ platform_device_unregister(rpisense->joystick.pdev); ++ return 0; ++} ++ ++struct rpisense *rpisense_get_dev(void) ++{ ++ return rpisense; ++} ++EXPORT_SYMBOL_GPL(rpisense_get_dev); ++ ++s32 rpisense_reg_read(struct rpisense *rpisense, int reg) ++{ ++ int ret = i2c_smbus_read_byte_data(rpisense->i2c_client, reg); ++ ++ if (ret < 0) ++ dev_err(rpisense->dev, "Read from reg %d failed\n", reg); ++ /* Due to the BCM270x I2C clock stretching bug, some values ++ * may have MSB set. Clear it to avoid incorrect values. ++ * */ ++ return ret & 0x7F; ++} ++EXPORT_SYMBOL_GPL(rpisense_reg_read); ++ ++int rpisense_block_write(struct rpisense *rpisense, const char *buf, int count) ++{ ++ int ret = i2c_master_send(rpisense->i2c_client, buf, count); ++ ++ if (ret < 0) ++ dev_err(rpisense->dev, "Block write failed\n"); ++ return ret; ++} ++EXPORT_SYMBOL_GPL(rpisense_block_write); ++ ++static const struct i2c_device_id rpisense_i2c_id[] = { ++ { "rpi-sense", 0 }, ++ { } ++}; ++MODULE_DEVICE_TABLE(i2c, rpisense_i2c_id); ++ ++ ++static struct i2c_driver rpisense_driver = { ++ .driver = { ++ .name = "rpi-sense", ++ .owner = THIS_MODULE, ++ }, ++ .probe = rpisense_probe, ++ .remove = rpisense_remove, ++ .id_table = rpisense_i2c_id, ++}; ++ ++module_i2c_driver(rpisense_driver); ++ ++MODULE_DESCRIPTION("Raspberry Pi Sense HAT core driver"); ++MODULE_AUTHOR("Serge Schneider "); ++MODULE_LICENSE("GPL"); ++ +diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig +index 42e6c3b..3444a4c 100644 +--- a/drivers/video/fbdev/Kconfig ++++ b/drivers/video/fbdev/Kconfig +@@ -2495,3 +2495,16 @@ config FB_SSD1307 + help + This driver implements support for the Solomon SSD1307 + OLED controller over I2C. ++ ++config FB_RPISENSE ++ tristate "Raspberry Pi Sense HAT framebuffer" ++ depends on FB ++ select MFD_RPISENSE_CORE ++ select FB_SYS_FOPS ++ select FB_SYS_FILLRECT ++ select FB_SYS_COPYAREA ++ select FB_SYS_IMAGEBLIT ++ select FB_DEFERRED_IO ++ ++ help ++ This is the framebuffer driver for the Raspberry Pi Sense HAT +diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile +index 57181ad..ee7568b 100644 +--- a/drivers/video/fbdev/Makefile ++++ b/drivers/video/fbdev/Makefile +@@ -150,6 +150,7 @@ obj-$(CONFIG_FB_DA8XX) += da8xx-fb.o + obj-$(CONFIG_FB_MXS) += mxsfb.o + obj-$(CONFIG_FB_SSD1307) += ssd1307fb.o + obj-$(CONFIG_FB_SIMPLE) += simplefb.o ++obj-$(CONFIG_FB_RPISENSE) += rpisense-fb.o + + # the test framebuffer is last + obj-$(CONFIG_FB_VIRTUAL) += vfb.o +diff --git a/drivers/video/fbdev/rpisense-fb.c b/drivers/video/fbdev/rpisense-fb.c +new file mode 100644 +index 0000000..99bb8ea +--- /dev/null ++++ b/drivers/video/fbdev/rpisense-fb.c +@@ -0,0 +1,235 @@ ++/* ++ * Raspberry Pi Sense HAT framebuffer driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++struct rpisense *rpisense; ++ ++struct rpisense_fb_param { ++ char __iomem *vmem; ++ u8 *vmem_work; ++ u32 vmemsize; ++ u8 gamma[32]; ++}; ++ ++static struct rpisense_fb_param rpisense_fb_param = { ++ .vmem = NULL, ++ .vmemsize = 128, ++ .gamma = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, ++ 0x02, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x07, ++ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0E, 0x0F, 0x11, ++ 0x12, 0x14, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F,}, ++}; ++ ++static struct fb_deferred_io rpisense_fb_defio; ++ ++static struct fb_fix_screeninfo rpisense_fb_fix = { ++ .id = "RPi-Sense FB", ++ .type = FB_TYPE_PACKED_PIXELS, ++ .visual = FB_VISUAL_TRUECOLOR, ++ .xpanstep = 0, ++ .ypanstep = 0, ++ .ywrapstep = 0, ++ .accel = FB_ACCEL_NONE, ++ .line_length = 16, ++}; ++ ++static struct fb_var_screeninfo rpisense_fb_var = { ++ .xres = 8, ++ .yres = 8, ++ .xres_virtual = 8, ++ .yres_virtual = 8, ++ .bits_per_pixel = 16, ++ .red = {11, 5, 0}, ++ .green = {5, 6, 0}, ++ .blue = {0, 5, 0}, ++}; ++ ++static ssize_t rpisense_fb_write(struct fb_info *info, ++ const char __user *buf, size_t count, ++ loff_t *ppos) ++{ ++ ssize_t res = fb_sys_write(info, buf, count, ppos); ++ ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++ return res; ++} ++ ++static void rpisense_fb_fillrect(struct fb_info *info, ++ const struct fb_fillrect *rect) ++{ ++ sys_fillrect(info, rect); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++} ++ ++static void rpisense_fb_copyarea(struct fb_info *info, ++ const struct fb_copyarea *area) ++{ ++ sys_copyarea(info, area); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++} ++ ++static void rpisense_fb_imageblit(struct fb_info *info, ++ const struct fb_image *image) ++{ ++ sys_imageblit(info, image); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++} ++ ++static void rpisense_fb_deferred_io(struct fb_info *info, ++ struct list_head *pagelist) ++{ ++ int i; ++ int j; ++ u8 *vmem_work = rpisense_fb_param.vmem_work; ++ u16 *mem = (u16 *)rpisense_fb_param.vmem; ++ u8 *gamma = rpisense_fb_param.gamma; ++ ++ vmem_work[0] = 0; ++ for (j = 0; j < 8; j++) { ++ for (i = 0; i < 8; i++) { ++ vmem_work[(j * 24) + i + 1] = ++ gamma[(mem[(j * 8) + i] >> 11) & 0x1F]; ++ vmem_work[(j * 24) + (i + 8) + 1] = ++ gamma[(mem[(j * 8) + i] >> 6) & 0x1F]; ++ vmem_work[(j * 24) + (i + 16) + 1] = ++ gamma[(mem[(j * 8) + i]) & 0x1F]; ++ } ++ } ++ rpisense_block_write(rpisense, vmem_work, 193); ++} ++ ++static struct fb_deferred_io rpisense_fb_defio = { ++ .delay = HZ/100, ++ .deferred_io = rpisense_fb_deferred_io, ++}; ++ ++static struct fb_ops rpisense_fb_ops = { ++ .owner = THIS_MODULE, ++ .fb_read = fb_sys_read, ++ .fb_write = rpisense_fb_write, ++ .fb_fillrect = rpisense_fb_fillrect, ++ .fb_copyarea = rpisense_fb_copyarea, ++ .fb_imageblit = rpisense_fb_imageblit, ++}; ++ ++static int rpisense_fb_probe(struct platform_device *pdev) ++{ ++ struct fb_info *info; ++ int ret = -ENOMEM; ++ struct rpisense_fb *rpisense_fb; ++ ++ rpisense = rpisense_get_dev(); ++ rpisense_fb = &rpisense->framebuffer; ++ ++ rpisense_fb_param.vmem = vzalloc(rpisense_fb_param.vmemsize); ++ if (!rpisense_fb_param.vmem) ++ return ret; ++ ++ rpisense_fb_param.vmem_work = devm_kmalloc(&pdev->dev, 193, GFP_KERNEL); ++ if (!rpisense_fb_param.vmem_work) ++ goto err_malloc; ++ ++ info = framebuffer_alloc(0, &pdev->dev); ++ if (!info) { ++ dev_err(&pdev->dev, "Could not allocate framebuffer.\n"); ++ goto err_malloc; ++ } ++ rpisense_fb->info = info; ++ ++ rpisense_fb_fix.smem_start = (unsigned long)rpisense_fb_param.vmem; ++ rpisense_fb_fix.smem_len = rpisense_fb_param.vmemsize; ++ ++ info->fbops = &rpisense_fb_ops; ++ info->fix = rpisense_fb_fix; ++ info->var = rpisense_fb_var; ++ info->fbdefio = &rpisense_fb_defio; ++ info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB; ++ info->screen_base = rpisense_fb_param.vmem; ++ info->screen_size = rpisense_fb_param.vmemsize; ++ ++ fb_deferred_io_init(info); ++ ++ ret = register_framebuffer(info); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "Could not register framebuffer.\n"); ++ goto err_fballoc; ++ } ++ ++ fb_info(info, "%s frame buffer device\n", info->fix.id); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++ return 0; ++err_fballoc: ++ framebuffer_release(info); ++err_malloc: ++ vfree(rpisense_fb_param.vmem); ++ return ret; ++} ++ ++static int rpisense_fb_remove(struct platform_device *pdev) ++{ ++ struct rpisense_fb *rpisense_fb = &rpisense->framebuffer; ++ struct fb_info *info = rpisense_fb->info; ++ ++ if (info) { ++ unregister_framebuffer(info); ++ fb_deferred_io_cleanup(info); ++ framebuffer_release(info); ++ vfree(rpisense_fb_param.vmem); ++ } ++ ++ return 0; ++} ++ ++#ifdef CONFIG_OF ++static const struct of_device_id rpisense_fb_id[] = { ++ { .compatible = "rpi,rpi-sense-fb" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, rpisense_fb_id); ++#endif ++ ++static struct platform_device_id rpisense_fb_device_id[] = { ++ { .name = "rpi-sense-fb" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(platform, rpisense_fb_device_id); ++ ++static struct platform_driver rpisense_fb_driver = { ++ .probe = rpisense_fb_probe, ++ .remove = rpisense_fb_remove, ++ .driver = { ++ .name = "rpi-sense-fb", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++module_platform_driver(rpisense_fb_driver); ++ ++MODULE_DESCRIPTION("Raspberry Pi Sense HAT framebuffer driver"); ++MODULE_AUTHOR("Serge Schneider "); ++MODULE_LICENSE("GPL"); ++ +diff --git a/include/linux/mfd/rpisense/core.h b/include/linux/mfd/rpisense/core.h +new file mode 100644 +index 0000000..4856aa3 +--- /dev/null ++++ b/include/linux/mfd/rpisense/core.h +@@ -0,0 +1,47 @@ ++/* ++ * Raspberry Pi Sense HAT core driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#ifndef __LINUX_MFD_RPISENSE_CORE_H_ ++#define __LINUX_MFD_RPISENSE_CORE_H_ ++ ++#include ++#include ++ ++/* ++ * Register values. ++ */ ++#define RPISENSE_FB 0x00 ++#define RPISENSE_WAI 0xF0 ++#define RPISENSE_VER 0xF1 ++#define RPISENSE_KEYS 0xF2 ++#define RPISENSE_EE_WP 0xF3 ++ ++#define RPISENSE_ID 's' ++ ++struct rpisense { ++ struct device *dev; ++ struct i2c_client *i2c_client; ++ ++ /* Client devices */ ++ struct rpisense_js joystick; ++ struct rpisense_fb framebuffer; ++}; ++ ++struct rpisense *rpisense_get_dev(void); ++s32 rpisense_reg_read(struct rpisense *rpisense, int reg); ++int rpisense_reg_write(struct rpisense *rpisense, int reg, u16 val); ++int rpisense_block_write(struct rpisense *rpisense, const char *buf, int count); ++ ++#endif +diff --git a/include/linux/mfd/rpisense/framebuffer.h b/include/linux/mfd/rpisense/framebuffer.h +new file mode 100644 +index 0000000..c4c1118 +--- /dev/null ++++ b/include/linux/mfd/rpisense/framebuffer.h +@@ -0,0 +1,28 @@ ++/* ++ * Raspberry Pi Sense HAT framebuffer driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#ifndef __LINUX_RPISENSE_FB_H_ ++#define __LINUX_RPISENSE_FB_H_ ++ ++#include ++ ++struct rpisense; ++ ++struct rpisense_fb { ++ struct platform_device *pdev; ++ struct fb_info *info; ++}; ++ ++#endif +diff --git a/include/linux/mfd/rpisense/joystick.h b/include/linux/mfd/rpisense/joystick.h +new file mode 100644 +index 0000000..56196dc +--- /dev/null ++++ b/include/linux/mfd/rpisense/joystick.h +@@ -0,0 +1,35 @@ ++/* ++ * Raspberry Pi Sense HAT joystick driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#ifndef __LINUX_RPISENSE_JOYSTICK_H_ ++#define __LINUX_RPISENSE_JOYSTICK_H_ ++ ++#include ++#include ++#include ++#include ++ ++struct rpisense; ++ ++struct rpisense_js { ++ struct platform_device *pdev; ++ struct input_dev *keys_dev; ++ struct gpio_desc *keys_desc; ++ struct work_struct keys_work_s; ++ int keys_irq; ++}; ++ ++ ++#endif + +From 2dce729ff88f1ae4fc318dc36e16732c8f152469 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 15 Jul 2015 13:46:08 +0100 +Subject: [PATCH 123/149] leds-gpio: Implement the brightness_get method + +The power LED uses some clever logic that means it is driven +by a voltage measuring circuit when configured as input, otherwise +it is driven by the GPIO output value. This patch wires up the +brightness_get method for leds-gpio so that user-space can monitor +the LED value via /sys/class/gpio/led1/brightness. Using the input +trigger this returns an indication of the system power health, +otherwise it is just whatever value the trigger has written most +recently. + +See: https://github.com/raspberrypi/linux/issues/1064 +--- + drivers/leds/leds-gpio.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c +index 3cfbd6a..4e4e132 100644 +--- a/drivers/leds/leds-gpio.c ++++ b/drivers/leds/leds-gpio.c +@@ -82,6 +82,13 @@ static void gpio_led_set(struct led_classdev *led_cdev, + } + } + ++static enum led_brightness gpio_led_get(struct led_classdev *led_cdev) ++{ ++ struct gpio_led_data *led_dat = ++ container_of(led_cdev, struct gpio_led_data, cdev); ++ return gpiod_get_value_cansleep(led_dat->gpiod) ? LED_FULL : LED_OFF; ++} ++ + static int gpio_blink_set(struct led_classdev *led_cdev, + unsigned long *delay_on, unsigned long *delay_off) + { +@@ -138,6 +145,7 @@ static int create_gpio_led(const struct gpio_led *template, + led_dat->cdev.blink_set = gpio_blink_set; + } + led_dat->cdev.brightness_set = gpio_led_set; ++ led_dat->cdev.brightness_get = gpio_led_get; + if (template->default_state == LEDS_GPIO_DEFSTATE_KEEP) + state = !!gpiod_get_value_cansleep(led_dat->gpiod); + else + +From 45d1edd1051ba8c3dcff92c18b0d56adea55ab5c Mon Sep 17 00:00:00 2001 +From: Robert Tiemann +Date: Fri, 17 Jul 2015 09:50:55 +0200 +Subject: [PATCH 124/149] dmaengine: bcm2708-dmaengine: Fix memory leak when + stopping a running transfer + +--- + drivers/dma/bcm2708-dmaengine.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/dma/bcm2708-dmaengine.c b/drivers/dma/bcm2708-dmaengine.c +index 987ed53..73c6c00 100644 +--- a/drivers/dma/bcm2708-dmaengine.c ++++ b/drivers/dma/bcm2708-dmaengine.c +@@ -964,6 +964,7 @@ static int bcm2835_dma_terminate_all(struct dma_chan *chan) + * c->desc is NULL and exit.) + */ + if (c->desc) { ++ bcm2835_dma_desc_free(&c->desc->vd); + c->desc = NULL; + bcm2835_dma_abort(c->chan_base); + + +From 5f40c5575ed6f7831637415de4e99400f270dd22 Mon Sep 17 00:00:00 2001 +From: Robert Tiemann +Date: Mon, 20 Jul 2015 11:01:13 +0200 +Subject: [PATCH 125/149] BCM270X_DT: Fix I2S register map + +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index 2dd25f7..728e14a 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -117,8 +117,8 @@ + + i2s: i2s@7e203000 { + compatible = "brcm,bcm2708-i2s"; +- reg = <0x7e203000 0x20>, +- <0x7e101098 0x02>; ++ reg = <0x7e203000 0x24>, ++ <0x7e101098 0x08>; + + //dmas = <&dma 2>, + // <&dma 3>; + +From cc5fa860bef4a444edca29c4493da61837e1b7e7 Mon Sep 17 00:00:00 2001 +From: Robert Tiemann +Date: Mon, 20 Jul 2015 11:01:25 +0200 +Subject: [PATCH 126/149] BCM2835_DT: Fix I2S register map + +--- + Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt | 4 ++-- + Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt | 4 ++-- + arch/arm/boot/dts/bcm2835.dtsi | 4 ++-- + 3 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt b/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt +index 1396078..2db8294 100644 +--- a/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt ++++ b/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt +@@ -48,8 +48,8 @@ Example: + + bcm2835_i2s: i2s@7e203000 { + compatible = "brcm,bcm2835-i2s"; +- reg = < 0x7e203000 0x20>, +- < 0x7e101098 0x02>; ++ reg = < 0x7e203000 0x24>, ++ < 0x7e101098 0x08>; + + dmas = <&dma 2>, + <&dma 3>; +diff --git a/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt b/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt +index 65783de..a89fe42 100644 +--- a/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt ++++ b/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt +@@ -16,8 +16,8 @@ Example: + + bcm2835_i2s: i2s@7e203000 { + compatible = "brcm,bcm2835-i2s"; +- reg = <0x7e203000 0x20>, +- <0x7e101098 0x02>; ++ reg = <0x7e203000 0x24>, ++ <0x7e101098 0x08>; + + dmas = <&dma 2>, + <&dma 3>; +diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi +index 4a63704..1135120 100644 +--- a/arch/arm/boot/dts/bcm2835.dtsi ++++ b/arch/arm/boot/dts/bcm2835.dtsi +@@ -101,8 +101,8 @@ + + i2s: i2s@7e203000 { + compatible = "brcm,bcm2835-i2s"; +- reg = <0x7e203000 0x20>, +- <0x7e101098 0x02>; ++ reg = <0x7e203000 0x24>, ++ <0x7e101098 0x08>; + + dmas = <&dma 2>, + <&dma 3>; + +From 0480e8bf45e8c4fd614ce16c1f3091d85ce95576 Mon Sep 17 00:00:00 2001 +From: David Frey +Date: Tue, 14 Jul 2015 15:57:36 +0200 +Subject: [PATCH 127/149] config: Enable SHT drivers for raspberry pi + +The SHT temperature and humidity sensors are often used in weather +station projects. + +Signed-off-by: David Frey +--- + arch/arm/configs/bcm2709_defconfig | 4 +++- + arch/arm/configs/bcmrpi_defconfig | 4 +++- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index f78a483..dd00e7c 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -611,7 +611,9 @@ CONFIG_W1_SLAVE_BQ27000=m + CONFIG_BATTERY_DS2760=m + CONFIG_POWER_RESET=y + CONFIG_POWER_RESET_GPIO=y +-# CONFIG_HWMON is not set ++CONFIG_HWMON=m ++CONFIG_SENSORS_SHT21=m ++CONFIG_SENSORS_SHTC1=m + CONFIG_THERMAL=y + CONFIG_THERMAL_BCM2835=y + CONFIG_WATCHDOG=y +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index b9b5bdf..7b24274 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -604,7 +604,9 @@ CONFIG_W1_SLAVE_BQ27000=m + CONFIG_BATTERY_DS2760=m + CONFIG_POWER_RESET=y + CONFIG_POWER_RESET_GPIO=y +-# CONFIG_HWMON is not set ++CONFIG_HWMON=m ++CONFIG_SENSORS_SHT21=m ++CONFIG_SENSORS_SHTC1=m + CONFIG_THERMAL=y + CONFIG_THERMAL_BCM2835=y + CONFIG_WATCHDOG=y + +From a433727025805fd09e50b829738fc02b99446617 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 20 Jul 2015 14:07:14 +0100 +Subject: [PATCH 128/149] BCM270X_DT: Correct typo in overlays/README + +--- + arch/arm/boot/dts/overlays/README | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 8792f98..ed484ae 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -78,7 +78,7 @@ Name: + Info: Configures the base Raspberry Pi hardware + Load: + Params: +- audio Set to "on" to disable the onboard ALSA audio ++ audio Set to "on" to enable the onboard ALSA audio + interface (default "off") + + i2c_arm Set to "on" to enable the ARM's i2c interface + +From 26be449bd477753ba005248dfde121a9e4c16a39 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 20 Jul 2015 10:53:26 +0100 +Subject: [PATCH 129/149] bcm2835-sdhost: Add the ERASE capability + +See: https://github.com/raspberrypi/linux/issues/1076 +--- + drivers/mmc/host/bcm2835-sdhost.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c +index d65870a..57a6ad3 100644 +--- a/drivers/mmc/host/bcm2835-sdhost.c ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -1675,7 +1675,7 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) + /* host controller capabilities */ + mmc->caps |= /* MMC_CAP_SDIO_IRQ |*/ MMC_CAP_4_BIT_DATA | + MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED | +- MMC_CAP_NEEDS_POLL | MMC_CAP_HW_RESET | ++ MMC_CAP_NEEDS_POLL | MMC_CAP_HW_RESET | MMC_CAP_ERASE | + (ALLOW_CMD23 * MMC_CAP_CMD23); + + spin_lock_init(&host->lock); + +From 02c4ebf0f3e2f379496ce265f883e23a0b7be363 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 20 Jul 2015 17:32:18 +0100 +Subject: [PATCH 130/149] bcm2835-sdhost: Ignore CRC7 for MMC CMD1 + +It seems that the sdhost interface returns CRC7 errors for CMD1, +which is the MMC-specific SEND_OP_COND. Returning these errors to +the MMC layer causes a downward spiral, but ignoring them seems +to be harmless. +--- + drivers/mmc/host/bcm2835-sdhost.c | 39 +++++++++++++++++++++++---------------- + 1 file changed, 23 insertions(+), 16 deletions(-) + +diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c +index 57a6ad3..84f645f 100644 +--- a/drivers/mmc/host/bcm2835-sdhost.c ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -959,25 +959,32 @@ static void bcm2835_sdhost_finish_command(struct bcm2835_host *host) + mmc_hostname(host->mmc), sdcmd, sdhsts, + bcm2835_sdhost_read(host, SDEDM)); + +- if (sdhsts & SDHSTS_CMD_TIME_OUT) { +- switch (host->cmd->opcode) { +- case 5: case 52: case 53: +- /* Don't warn about SDIO commands */ +- break; +- default: +- pr_err("%s: command timeout\n", ++ if ((sdhsts & SDHSTS_CRC7_ERROR) && ++ (host->cmd->opcode == 1)) { ++ if (host->debug) ++ pr_info("%s: ignoring CRC7 error for CMD1\n", ++ mmc_hostname(host->mmc)); ++ } else { ++ if (sdhsts & SDHSTS_CMD_TIME_OUT) { ++ switch (host->cmd->opcode) { ++ case 5: case 52: case 53: ++ /* Don't warn about SDIO commands */ ++ break; ++ default: ++ pr_err("%s: command timeout\n", ++ mmc_hostname(host->mmc)); ++ break; ++ } ++ host->cmd->error = -ETIMEDOUT; ++ } else { ++ pr_err("%s: unexpected command error\n", + mmc_hostname(host->mmc)); +- break; ++ bcm2835_sdhost_dumpregs(host); ++ host->cmd->error = -EIO; + } +- host->cmd->error = -ETIMEDOUT; +- } else { +- pr_err("%s: unexpected command error\n", +- mmc_hostname(host->mmc)); +- bcm2835_sdhost_dumpregs(host); +- host->cmd->error = -EIO; ++ tasklet_schedule(&host->finish_tasklet); ++ return; + } +- tasklet_schedule(&host->finish_tasklet); +- return; + } + + if (host->cmd->flags & MMC_RSP_PRESENT) { + +From 995b4ff06b418b3dbc8d560547c95d8e9e501c0c Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 20 Jul 2015 14:48:21 +0100 +Subject: [PATCH 131/149] BCM270X_DT: Add unit address to gpio node name + +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index 728e14a..cb608df 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -92,7 +92,7 @@ + status = "disabled"; + }; + +- gpio: gpio { ++ gpio: gpio@7e200000 { + compatible = "brcm,bcm2835-gpio"; + reg = <0x7e200000 0xb4>; + interrupts = <2 17>, <2 18>; + +From 56bc2c9c4ef10c7dc0b0ed9bf1868e2010e4adb6 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 24 Jul 2015 10:36:32 +0100 +Subject: [PATCH 132/149] BCM270X_DT: Use i2c_arm for rtc and bmp085 overlays + +--- + arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts | 2 +- + arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts b/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts +index b830bf2..782b171 100644 +--- a/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts ++++ b/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts +@@ -6,7 +6,7 @@ + compatible = "brcm,bcm2708"; + + fragment@0 { +- target = <&i2c1>; ++ target = <&i2c_arm>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; +diff --git a/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts +index 7052c71..fed4bd8 100644 +--- a/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts ++++ b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts +@@ -6,7 +6,7 @@ + compatible = "brcm,bcm2708"; + + fragment@0 { +- target = <&i2c1>; ++ target = <&i2c_arm>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + +From a3201af81c47ab3cf0ca61d3632a6df14e935b23 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 24 Jul 2015 12:11:31 +0100 +Subject: [PATCH 133/149] BCM2708_DT: CM dtparams for audio, watchdog and RNG + +--- + arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +index 34d4bc6..713e5a2 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +@@ -17,14 +17,14 @@ + status = "okay"; + }; + +-&audio { +- status = "okay"; +-}; +- + / { + __overrides__ { + act_led_gpio = <&act_led>,"gpios:4"; + act_led_activelow = <&act_led>,"gpios:8"; + act_led_trigger = <&act_led>,"linux,default-trigger"; ++ ++ audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; + }; + }; + +From 30929ea53242c1f5efc06caf4a17b9c7922fd437 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Mon, 20 Jul 2015 12:13:18 +0200 +Subject: [PATCH 134/149] vchiq: Use firmware API +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Use the new firmware API instead of the legacy mailbox API. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 1 + + .../vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 17 +++++++++-------- + .../misc/vc04_services/interface/vchiq_arm/vchiq_arm.c | 17 +++++++++++++++++ + 3 files changed, 27 insertions(+), 8 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index cb608df..df66e64 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -225,6 +225,7 @@ + reg = <0x7e00b840 0xf>; + interrupts = <0 2>; + cache-line-size = <32>; ++ firmware = <&firmware>; + }; + + thermal: thermal { +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +index 56bff05..c9febcc 100644 +--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +@@ -39,11 +39,11 @@ + #include + #include + #include +-#include + #include + #include + #include + #include ++#include + + #define TOTAL_SLOTS (VCHIQ_SLOT_ZERO_SLOTS + 2 * 32) + +@@ -89,10 +89,12 @@ free_pagelist(PAGELIST_T *pagelist, int actual); + int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) + { + struct device *dev = &pdev->dev; ++ struct rpi_firmware *fw = platform_get_drvdata(pdev); + VCHIQ_SLOT_ZERO_T *vchiq_slot_zero; + struct resource *res; + void *slot_mem; + dma_addr_t slot_phys; ++ u32 channelbase; + int slot_mem_size, frag_mem_size; + int err, irq, i; + +@@ -157,13 +159,12 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) + } + + /* Send the base address of the slots to VideoCore */ +- +- dsb(); /* Ensure all writes have completed */ +- +- err = bcm_mailbox_write(MBOX_CHAN_VCHIQ, (unsigned int)slot_phys); +- if (err) { +- dev_err(dev, "mailbox write failed\n"); +- return err; ++ channelbase = slot_phys; ++ err = rpi_firmware_property(fw, RPI_FIRMWARE_VCHIQ_INIT, ++ &channelbase, sizeof(channelbase)); ++ if (err || channelbase) { ++ dev_err(dev, "failed to set channelbase\n"); ++ return err ? : -ENXIO; + } + + vchiq_log_info(vchiq_arm_log_level, +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c +index 31e2cba..e11c0e0 100644 +--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c +@@ -45,7 +45,9 @@ + #include + #include + #include ++#include + #include ++#include + + #include "vchiq_core.h" + #include "vchiq_ioctl.h" +@@ -2793,9 +2795,24 @@ void vchiq_platform_conn_state_changed(VCHIQ_STATE_T *state, + + static int vchiq_probe(struct platform_device *pdev) + { ++ struct device_node *fw_node; ++ struct rpi_firmware *fw; + int err; + void *ptr_err; + ++ fw_node = of_parse_phandle(pdev->dev.of_node, "firmware", 0); ++/* Remove comment when booting without Device Tree is no longer supported ++ if (!fw_node) { ++ dev_err(&pdev->dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } ++*/ ++ fw = rpi_firmware_get(fw_node); ++ if (!fw) ++ return -EPROBE_DEFER; ++ ++ platform_set_drvdata(pdev, fw); ++ + /* create debugfs entries */ + err = vchiq_debugfs_init(); + if (err != 0) + +From 978ebf9c4c2ef238e19ea1478b5fd11c3252c912 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Mon, 20 Jul 2015 12:17:10 +0200 +Subject: [PATCH 135/149] thermal: bcm2835: Use firmware API +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Use the new firmware API instead of the legacy mailbox API. +Remove retry loop on failure to read temperature. +Clean up code. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 1 + + drivers/thermal/bcm2835-thermal.c | 197 +++++++++++++--------------------- + 2 files changed, 75 insertions(+), 123 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index df66e64..bd8ac0a 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -230,6 +230,7 @@ + + thermal: thermal { + compatible = "brcm,bcm2835-thermal"; ++ firmware = <&firmware>; + }; + }; + +diff --git a/drivers/thermal/bcm2835-thermal.c b/drivers/thermal/bcm2835-thermal.c +index 3bc80f1..c1d8f1b 100644 +--- a/drivers/thermal/bcm2835-thermal.c ++++ b/drivers/thermal/bcm2835-thermal.c +@@ -12,161 +12,113 @@ + * consent. + *****************************************************************************/ + +-#include + #include +-#include +-#include + #include +-#include +-#include + #include ++#include + +- +-/* --- DEFINITIONS --- */ +-#define MODULE_NAME "bcm2835_thermal" +- +-/*#define THERMAL_DEBUG_ENABLE*/ +- +-#ifdef THERMAL_DEBUG_ENABLE +-#define print_debug(fmt,...) printk(KERN_INFO "%s:%s:%d: "fmt"\n", MODULE_NAME, __func__, __LINE__, ##__VA_ARGS__) +-#else +-#define print_debug(fmt,...) +-#endif +-#define print_err(fmt,...) printk(KERN_ERR "%s:%s:%d: "fmt"\n", MODULE_NAME, __func__,__LINE__, ##__VA_ARGS__) +- +-#define VC_TAG_GET_TEMP 0x00030006 +-#define VC_TAG_GET_MAX_TEMP 0x0003000A +- +-typedef enum { +- TEMP, +- MAX_TEMP, +-} temp_type; +- +-/* --- STRUCTS --- */ +-/* tag part of the message */ +-struct vc_msg_tag { +- uint32_t tag_id; /* the tag ID for the temperature */ +- uint32_t buffer_size; /* size of the buffer (should be 8) */ +- uint32_t request_code; /* identifies message as a request (should be 0) */ +- uint32_t id; /* extra ID field (should be 0) */ +- uint32_t val; /* returned value of the temperature */ +-}; +- +-/* message structure to be sent to videocore */ +-struct vc_msg { +- uint32_t msg_size; /* simply, sizeof(struct vc_msg) */ +- uint32_t request_code; /* holds various information like the success and number of bytes returned (refer to mailboxes wiki) */ +- struct vc_msg_tag tag; /* the tag structure above to make */ +- uint32_t end_tag; /* an end identifier, should be set to NULL */ +-}; +- +-struct bcm2835_thermal_data { +- struct thermal_zone_device *thermal_dev; +- struct vc_msg msg; +-}; +- +-/* --- GLOBALS --- */ +-static struct bcm2835_thermal_data bcm2835_data; +- +-/* Thermal Device Operations */ +-static struct thermal_zone_device_ops ops; +- +-/* --- FUNCTIONS --- */ +- +-static int bcm2835_get_temp_or_max(struct thermal_zone_device *thermal_dev, unsigned long *temp, unsigned tag_id) ++static int bcm2835_thermal_get_property(struct thermal_zone_device *tz, ++ unsigned long *temp, u32 tag) + { +- int result = -1, retry = 3; +- print_debug("IN"); ++ struct rpi_firmware *fw = tz->devdata; ++ struct { ++ u32 id; ++ u32 val; ++ } packet; ++ int ret; + + *temp = 0; +- while (result != 0 && retry-- > 0) { +- /* wipe all previous message data */ +- memset(&bcm2835_data.msg, 0, sizeof bcm2835_data.msg); +- +- /* prepare message */ +- bcm2835_data.msg.msg_size = sizeof bcm2835_data.msg; +- bcm2835_data.msg.tag.buffer_size = 8; +- bcm2835_data.msg.tag.tag_id = tag_id; +- +- /* send the message */ +- result = bcm_mailbox_property(&bcm2835_data.msg, sizeof bcm2835_data.msg); +- print_debug("Got %stemperature as %u (%d,%x)\n", tag_id==VC_TAG_GET_MAX_TEMP ? "max ":"", (uint)bcm2835_data.msg.tag.val, result, bcm2835_data.msg.request_code); +- if (!(bcm2835_data.msg.request_code & 0x80000000)) +- result = -1; ++ packet.id = 0; ++ ret = rpi_firmware_property(fw, tag, &packet, sizeof(packet)); ++ if (ret) { ++ dev_err(&tz->device, "Failed to get temperature\n"); ++ return ret; + } + +- /* check if it was all ok and return the rate in milli degrees C */ +- if (result == 0) +- *temp = (uint)bcm2835_data.msg.tag.val; +- else +- print_err("Failed to get temperature! (%x:%d)\n", tag_id, result); +- print_debug("OUT"); +- return result; ++ *temp = packet.val; ++ dev_dbg(&tz->device, "%stemp=%lu\n", ++ tag == RPI_FIRMWARE_GET_MAX_TEMPERATURE ? "max" : "", *temp); ++ ++ return 0; + } + +-static int bcm2835_get_temp(struct thermal_zone_device *thermal_dev, unsigned long *temp) ++static int bcm2835_thermal_get_temp(struct thermal_zone_device *tz, ++ unsigned long *temp) + { +- return bcm2835_get_temp_or_max(thermal_dev, temp, VC_TAG_GET_TEMP); ++ return bcm2835_thermal_get_property(tz, temp, ++ RPI_FIRMWARE_GET_TEMPERATURE); + } + +-static int bcm2835_get_max_temp(struct thermal_zone_device *thermal_dev, int trip_num, unsigned long *temp) ++static int bcm2835_thermal_get_max_temp(struct thermal_zone_device *tz, ++ int trip, unsigned long *temp) + { +- return bcm2835_get_temp_or_max(thermal_dev, temp, VC_TAG_GET_MAX_TEMP); ++ /* ++ * The maximum safe temperature of the SoC. ++ * Overclock may be disabled above this temperature. ++ */ ++ return bcm2835_thermal_get_property(tz, temp, ++ RPI_FIRMWARE_GET_MAX_TEMPERATURE); + } + +-static int bcm2835_get_trip_type(struct thermal_zone_device * thermal_dev, int trip_num, enum thermal_trip_type *trip_type) ++static int bcm2835_thermal_get_trip_type(struct thermal_zone_device *tz, ++ int trip, enum thermal_trip_type *type) + { +- *trip_type = THERMAL_TRIP_HOT; ++ *type = THERMAL_TRIP_HOT; ++ + return 0; + } + +- +-static int bcm2835_get_mode(struct thermal_zone_device *thermal_dev, enum thermal_device_mode *dev_mode) ++static int bcm2835_thermal_get_mode(struct thermal_zone_device *tz, ++ enum thermal_device_mode *mode) + { +- *dev_mode = THERMAL_DEVICE_ENABLED; ++ *mode = THERMAL_DEVICE_ENABLED; ++ + return 0; + } + ++static struct thermal_zone_device_ops ops = { ++ .get_temp = bcm2835_thermal_get_temp, ++ .get_trip_temp = bcm2835_thermal_get_max_temp, ++ .get_trip_type = bcm2835_thermal_get_trip_type, ++ .get_mode = bcm2835_thermal_get_mode, ++}; + + static int bcm2835_thermal_probe(struct platform_device *pdev) + { +- print_debug("IN"); +- print_debug("THERMAL Driver has been probed!"); +- +- /* check that the device isn't null!*/ +- if(pdev == NULL) +- { +- print_debug("Platform device is empty!"); +- return -ENODEV; ++ struct device_node *fw_np; ++ struct rpi_firmware *fw; ++ struct thermal_zone_device *tz; ++ ++ fw_np = of_parse_phandle(pdev->dev.of_node, "firmware", 0); ++/* Remove comment when booting without Device Tree is no longer supported ++ if (!fw_np) { ++ dev_err(&pdev->dev, "Missing firmware node\n"); ++ return -ENOENT; + } +- +- if(!(bcm2835_data.thermal_dev = thermal_zone_device_register("bcm2835_thermal", 1, 0, NULL, &ops, NULL, 0, 0))) +- { +- print_debug("Unable to register the thermal device!"); +- return -EFAULT; ++*/ ++ fw = rpi_firmware_get(fw_np); ++ if (!fw) ++ return -EPROBE_DEFER; ++ ++ tz = thermal_zone_device_register("bcm2835_thermal", 1, 0, fw, &ops, ++ NULL, 0, 0); ++ if (IS_ERR(tz)) { ++ dev_err(&pdev->dev, "Failed to register the thermal device\n"); ++ return PTR_ERR(tz); + } ++ ++ platform_set_drvdata(pdev, tz); ++ + return 0; + } + +- + static int bcm2835_thermal_remove(struct platform_device *pdev) + { +- print_debug("IN"); +- +- thermal_zone_device_unregister(bcm2835_data.thermal_dev); +- +- print_debug("OUT"); ++ thermal_zone_device_unregister(platform_get_drvdata(pdev)); + + return 0; + } + +-static struct thermal_zone_device_ops ops = { +- .get_temp = bcm2835_get_temp, +- .get_trip_temp = bcm2835_get_max_temp, +- .get_trip_type = bcm2835_get_trip_type, +- .get_mode = bcm2835_get_mode, +-}; +- + static const struct of_device_id bcm2835_thermal_of_match_table[] = { + { .compatible = "brcm,bcm2835-thermal", }, + {}, +@@ -177,14 +129,13 @@ static struct platform_driver bcm2835_thermal_driver = { + .probe = bcm2835_thermal_probe, + .remove = bcm2835_thermal_remove, + .driver = { +- .name = "bcm2835_thermal", +- .owner = THIS_MODULE, +- .of_match_table = bcm2835_thermal_of_match_table, +- }, ++ .name = "bcm2835_thermal", ++ .of_match_table = bcm2835_thermal_of_match_table, ++ }, + }; ++module_platform_driver(bcm2835_thermal_driver); + +-MODULE_LICENSE("GPL"); + MODULE_AUTHOR("Dorian Peake"); ++MODULE_AUTHOR("Noralf Trønnes"); + MODULE_DESCRIPTION("Thermal driver for bcm2835 chip"); +- +-module_platform_driver(bcm2835_thermal_driver); ++MODULE_LICENSE("GPL"); + +From 26b1f0b224f9e59fc87d02e8d0a683a3ca847356 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Mon, 20 Jul 2015 12:18:36 +0200 +Subject: [PATCH 136/149] cpufreq: bcm2835: Use firmware API +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Use the new firmware API instead of the legacy mailbox API. + +Signed-off-by: Noralf Trønnes +--- + drivers/cpufreq/bcm2835-cpufreq.c | 117 +++++++++++++++++--------------------- + 1 file changed, 53 insertions(+), 64 deletions(-) + +diff --git a/drivers/cpufreq/bcm2835-cpufreq.c b/drivers/cpufreq/bcm2835-cpufreq.c +index 6735da9..3eb9e93 100644 +--- a/drivers/cpufreq/bcm2835-cpufreq.c ++++ b/drivers/cpufreq/bcm2835-cpufreq.c +@@ -26,7 +26,7 @@ + #include + #include + #include +-#include ++#include + + /* ---------- DEFINES ---------- */ + /*#define CPUFREQ_DEBUG_ENABLE*/ /* enable debugging */ +@@ -43,23 +43,6 @@ + #define print_err(fmt,...) pr_err("%s:%s:%d: "fmt, MODULE_NAME, __func__,__LINE__, ##__VA_ARGS__) + #define print_info(fmt,...) pr_info("%s: "fmt, MODULE_NAME, ##__VA_ARGS__) + +-/* tag part of the message */ +-struct vc_msg_tag { +- uint32_t tag_id; /* the message id */ +- uint32_t buffer_size; /* size of the buffer (which in this case is always 8 bytes) */ +- uint32_t data_size; /* amount of data being sent or received */ +- uint32_t dev_id; /* the ID of the clock/voltage to get or set */ +- uint32_t val; /* the value (e.g. rate (in Hz)) to set */ +-}; +- +-/* message structure to be sent to videocore */ +-struct vc_msg { +- uint32_t msg_size; /* simply, sizeof(struct vc_msg) */ +- uint32_t request_code; /* holds various information like the success and number of bytes returned (refer to mailboxes wiki) */ +- struct vc_msg_tag tag; /* the tag structure above to make */ +- uint32_t end_tag; /* an end identifier, should be set to NULL */ +-}; +- + /* ---------- GLOBALS ---------- */ + static struct cpufreq_driver bcm2835_cpufreq_driver; /* the cpufreq driver global */ + +@@ -74,62 +57,63 @@ static struct cpufreq_frequency_table bcm2835_freq_table[] = { + clk_rate either gets or sets the clock rates. + =============================================== + */ +-static uint32_t bcm2835_cpufreq_set_clock(int cur_rate, int arm_rate) ++ ++static int bcm2835_cpufreq_clock_property(u32 tag, u32 id, u32 *val) + { +- int s, actual_rate=0; +- struct vc_msg msg; ++ struct rpi_firmware *fw = rpi_firmware_get(NULL); ++ struct { ++ u32 id; ++ u32 val; ++ } packet; ++ int ret; ++ ++ packet.id = id; ++ packet.val = *val; ++ ret = rpi_firmware_property(fw, tag, &packet, sizeof(packet)); ++ if (ret) ++ return ret; + +- /* wipe all previous message data */ +- memset(&msg, 0, sizeof msg); ++ *val = packet.val; + +- msg.msg_size = sizeof msg; ++ return 0; ++} + +- msg.tag.tag_id = VCMSG_SET_CLOCK_RATE; +- msg.tag.buffer_size = 8; +- msg.tag.data_size = 8; /* we're sending the clock ID and the new rates which is a total of 2 words */ +- msg.tag.dev_id = VCMSG_ID_ARM_CLOCK; +- msg.tag.val = arm_rate * 1000; ++static uint32_t bcm2835_cpufreq_set_clock(int cur_rate, int arm_rate) ++{ ++ u32 rate = arm_rate * 1000; ++ int ret; + +- /* send the message */ +- s = bcm_mailbox_property(&msg, sizeof msg); ++ ret = bcm2835_cpufreq_clock_property(RPI_FIRMWARE_SET_CLOCK_RATE, VCMSG_ID_ARM_CLOCK, &rate); ++ if (ret) { ++ print_err("Failed to set clock: %d (%d)\n", arm_rate, ret); ++ return 0; ++ } + +- /* check if it was all ok and return the rate in KHz */ +- if (s == 0 && (msg.request_code & 0x80000000)) +- actual_rate = msg.tag.val/1000; ++ rate /= 1000; ++ print_debug("Setting new frequency = %d -> %d (actual %d)\n", cur_rate, arm_rate, rate); + +- print_debug("Setting new frequency = %d -> %d (actual %d)\n", cur_rate, arm_rate, actual_rate); +- return actual_rate; ++ return rate; + } + + static uint32_t bcm2835_cpufreq_get_clock(int tag) + { +- int s; +- int arm_rate = 0; +- struct vc_msg msg; +- +- /* wipe all previous message data */ +- memset(&msg, 0, sizeof msg); +- +- msg.msg_size = sizeof msg; +- msg.tag.tag_id = tag; +- msg.tag.buffer_size = 8; +- msg.tag.data_size = 4; /* we're just sending the clock ID which is one word long */ +- msg.tag.dev_id = VCMSG_ID_ARM_CLOCK; ++ u32 rate; ++ int ret; + +- /* send the message */ +- s = bcm_mailbox_property(&msg, sizeof msg); +- +- /* check if it was all ok and return the rate in KHz */ +- if (s == 0 && (msg.request_code & 0x80000000)) +- arm_rate = msg.tag.val/1000; ++ ret = bcm2835_cpufreq_clock_property(tag, VCMSG_ID_ARM_CLOCK, &rate); ++ if (ret) { ++ print_err("Failed to get clock (%d)\n", ret); ++ return 0; ++ } + +- print_debug("%s frequency = %d\n", +- tag == VCMSG_GET_CLOCK_RATE ? "Current": +- tag == VCMSG_GET_MIN_CLOCK ? "Min": +- tag == VCMSG_GET_MAX_CLOCK ? "Max": +- "Unexpected", arm_rate); ++ rate /= 1000; ++ print_debug("%s frequency = %u\n", ++ tag == RPI_FIRMWARE_GET_CLOCK_RATE ? "Current": ++ tag == RPI_FIRMWARE_GET_MIN_CLOCK_RATE ? "Min": ++ tag == RPI_FIRMWARE_GET_MAX_CLOCK_RATE ? "Max": ++ "Unexpected", rate); + +- return arm_rate; ++ return rate; + } + + /* +@@ -165,9 +149,14 @@ static int bcm2835_cpufreq_driver_init(struct cpufreq_policy *policy) + /* measured value of how long it takes to change frequency */ + const unsigned int transition_latency = 355000; /* ns */ + ++ if (!rpi_firmware_get(NULL)) { ++ print_err("Firmware is not available\n"); ++ return -ENODEV; ++ } ++ + /* now find out what the maximum and minimum frequencies are */ +- bcm2835_freq_table[0].frequency = bcm2835_cpufreq_get_clock(VCMSG_GET_MIN_CLOCK); +- bcm2835_freq_table[1].frequency = bcm2835_cpufreq_get_clock(VCMSG_GET_MAX_CLOCK); ++ bcm2835_freq_table[0].frequency = bcm2835_cpufreq_get_clock(RPI_FIRMWARE_GET_MIN_CLOCK_RATE); ++ bcm2835_freq_table[1].frequency = bcm2835_cpufreq_get_clock(RPI_FIRMWARE_GET_MAX_CLOCK_RATE); + + print_info("min=%d max=%d\n", bcm2835_freq_table[0].frequency, bcm2835_freq_table[1].frequency); + return cpufreq_generic_init(policy, bcm2835_freq_table, transition_latency); +@@ -201,8 +190,8 @@ static int bcm2835_cpufreq_driver_target_index(struct cpufreq_policy *policy, un + + static unsigned int bcm2835_cpufreq_driver_get(unsigned int cpu) + { +- unsigned int actual_rate = bcm2835_cpufreq_get_clock(VCMSG_GET_CLOCK_RATE); +- print_debug("%d: freq=%d\n", cpu, actual_rate); ++ unsigned int actual_rate = bcm2835_cpufreq_get_clock(RPI_FIRMWARE_GET_CLOCK_RATE); ++ print_debug("cpu%d: freq=%d\n", cpu, actual_rate); + return actual_rate <= bcm2835_freq_table[0].frequency ? bcm2835_freq_table[0].frequency : bcm2835_freq_table[1].frequency; + } + + +From a15106c0300ea7958fa7e1cc62c573d999eb4ee2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Mon, 20 Jul 2015 12:20:59 +0200 +Subject: [PATCH 137/149] fbdev: bcm2708: Use firmware API +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Use the new firmware API instead of the legacy mailbox API. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 1 + + drivers/video/fbdev/bcm2708_fb.c | 273 +++++++++++++++++++--------------- + 2 files changed, 152 insertions(+), 122 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index bd8ac0a..d1c3bdf 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -217,6 +217,7 @@ + + fb: fb { + compatible = "brcm,bcm2708-fb"; ++ firmware = <&firmware>; + status = "disabled"; + }; + +diff --git a/drivers/video/fbdev/bcm2708_fb.c b/drivers/video/fbdev/bcm2708_fb.c +index f6ac7da..06a96d16 100644 +--- a/drivers/video/fbdev/bcm2708_fb.c ++++ b/drivers/video/fbdev/bcm2708_fb.c +@@ -25,7 +25,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -34,6 +33,7 @@ + #include + #include + #include ++#include + + //#define BCM2708_FB_DEBUG + #define MODULE_NAME "bcm2708_fb" +@@ -58,15 +58,19 @@ static u32 dma_busy_wait_threshold = 1<<15; + module_param(dma_busy_wait_threshold, int, 0644); + MODULE_PARM_DESC(dma_busy_wait_threshold, "Busy-wait for DMA completion below this area"); + +-/* this data structure describes each frame buffer device we find */ +- +-struct fbinfo_s { +- u32 xres, yres, xres_virtual, yres_virtual; +- u32 pitch, bpp; ++struct fb_alloc_tags { ++ struct rpi_firmware_property_tag_header tag1; ++ u32 xres, yres; ++ struct rpi_firmware_property_tag_header tag2; ++ u32 xres_virtual, yres_virtual; ++ struct rpi_firmware_property_tag_header tag3; ++ u32 bpp; ++ struct rpi_firmware_property_tag_header tag4; + u32 xoffset, yoffset; +- u32 base; +- u32 screen_size; +- u16 cmap[256]; ++ struct rpi_firmware_property_tag_header tag5; ++ u32 base, screen_size; ++ struct rpi_firmware_property_tag_header tag6; ++ u32 pitch; + }; + + struct bcm2708_fb_stats { +@@ -78,9 +82,9 @@ struct bcm2708_fb_stats { + struct bcm2708_fb { + struct fb_info fb; + struct platform_device *dev; +- struct fbinfo_s *info; +- dma_addr_t dma; ++ struct rpi_firmware *fw; + u32 cmap[16]; ++ u32 gpu_cmap[256]; + int dma_chan; + int dma_irq; + void __iomem *dma_chan_base; +@@ -270,69 +274,71 @@ static int bcm2708_fb_check_var(struct fb_var_screeninfo *var, + + static int bcm2708_fb_set_par(struct fb_info *info) + { +- uint32_t val = 0; + struct bcm2708_fb *fb = to_bcm2708(info); +- volatile struct fbinfo_s *fbinfo = fb->info; +- fbinfo->xres = info->var.xres; +- fbinfo->yres = info->var.yres; +- fbinfo->xres_virtual = info->var.xres_virtual; +- fbinfo->yres_virtual = info->var.yres_virtual; +- fbinfo->bpp = info->var.bits_per_pixel; +- fbinfo->xoffset = info->var.xoffset; +- fbinfo->yoffset = info->var.yoffset; +- fbinfo->base = 0; /* filled in by VC */ +- fbinfo->pitch = 0; /* filled in by VC */ ++ struct fb_alloc_tags fbinfo = { ++ .tag1 = { RPI_FIRMWARE_FRAMEBUFFER_SET_PHYSICAL_WIDTH_HEIGHT, ++ 8, 0, }, ++ .xres = info->var.xres, ++ .yres = info->var.yres, ++ .tag2 = { RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT, ++ 8, 0, }, ++ .xres_virtual = info->var.xres_virtual, ++ .yres_virtual = info->var.yres_virtual, ++ .tag3 = { RPI_FIRMWARE_FRAMEBUFFER_SET_DEPTH, 4, 0 }, ++ .bpp = info->var.bits_per_pixel, ++ .tag4 = { RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_OFFSET, 8, 0 }, ++ .xoffset = info->var.xoffset, ++ .yoffset = info->var.yoffset, ++ .tag5 = { RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE, 8, 0 }, ++ .base = 0, ++ .screen_size = 0, ++ .tag6 = { RPI_FIRMWARE_FRAMEBUFFER_GET_PITCH, 4, 0 }, ++ .pitch = 0, ++ }; ++ int ret; + + print_debug("bcm2708_fb_set_par info(%p) %dx%d (%dx%d), %d, %d\n", info, + info->var.xres, info->var.yres, info->var.xres_virtual, + info->var.yres_virtual, (int)info->screen_size, + info->var.bits_per_pixel); + +- /* ensure last write to fbinfo is visible to GPU */ +- wmb(); +- +- /* inform vc about new framebuffer */ +- bcm_mailbox_write(MBOX_CHAN_FB, fb->dma); +- +- /* TODO: replace fb driver with vchiq version */ +- /* wait for response */ +- bcm_mailbox_read(MBOX_CHAN_FB, &val); +- +- /* ensure GPU writes are visible to us */ +- rmb(); +- +- if (val == 0) { +- fb->fb.fix.line_length = fbinfo->pitch; +- +- if (info->var.bits_per_pixel <= 8) +- fb->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR; +- else +- fb->fb.fix.visual = FB_VISUAL_TRUECOLOR; +- +- fb->fb_bus_address = fbinfo->base; +- fbinfo->base &= ~0xc0000000; +- fb->fb.fix.smem_start = fbinfo->base; +- fb->fb.fix.smem_len = fbinfo->pitch * fbinfo->yres_virtual; +- fb->fb.screen_size = fbinfo->screen_size; +- if (fb->fb.screen_base) +- iounmap(fb->fb.screen_base); +- fb->fb.screen_base = +- (void *)ioremap_wc(fbinfo->base, fb->fb.screen_size); +- if (!fb->fb.screen_base) { +- /* the console may currently be locked */ +- console_trylock(); +- console_unlock(); +- pr_err("bcm2708_fb_set_par: Failed to set screen_base\n"); +- return -EIO; +- } ++ ret = rpi_firmware_property_list(fb->fw, &fbinfo, sizeof(fbinfo)); ++ if (ret) { ++ dev_err(info->device, ++ "Failed to allocate GPU framebuffer (%d)\n", ret); ++ return ret; + } ++ ++ if (info->var.bits_per_pixel <= 8) ++ fb->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR; ++ else ++ fb->fb.fix.visual = FB_VISUAL_TRUECOLOR; ++ ++ fb->fb.fix.line_length = fbinfo.pitch; ++ fbinfo.base |= 0x40000000; ++ fb->fb_bus_address = fbinfo.base; ++ fbinfo.base &= ~0xc0000000; ++ fb->fb.fix.smem_start = fbinfo.base; ++ fb->fb.fix.smem_len = fbinfo.pitch * fbinfo.yres_virtual; ++ fb->fb.screen_size = fbinfo.screen_size; ++ if (fb->fb.screen_base) ++ iounmap(fb->fb.screen_base); ++ fb->fb.screen_base = ioremap_wc(fbinfo.base, fb->fb.screen_size); ++ if (!fb->fb.screen_base) { ++ /* the console may currently be locked */ ++ console_trylock(); ++ console_unlock(); ++ dev_err(info->device, "Failed to set screen_base\n"); ++ return -ENOMEM; ++ } ++ + print_debug +- ("BCM2708FB: start = %p,%p width=%d, height=%d, bpp=%d, pitch=%d size=%d success=%d\n", ++ ("BCM2708FB: start = %p,%p width=%d, height=%d, bpp=%d, pitch=%d size=%d\n", + (void *)fb->fb.screen_base, (void *)fb->fb_bus_address, +- fbinfo->xres, fbinfo->yres, fbinfo->bpp, +- fbinfo->pitch, (int)fb->fb.screen_size, val); ++ fbinfo.xres, fbinfo.yres, fbinfo.bpp, ++ fbinfo.pitch, (int)fb->fb.screen_size); + +- return val; ++ return 0; + } + + static inline u32 convert_bitfield(int val, struct fb_bitfield *bf) +@@ -352,15 +358,34 @@ static int bcm2708_fb_setcolreg(unsigned int regno, unsigned int red, + /*print_debug("BCM2708FB: setcolreg %d:(%02x,%02x,%02x,%02x) %x\n", regno, red, green, blue, transp, fb->fb.fix.visual);*/ + if (fb->fb.var.bits_per_pixel <= 8) { + if (regno < 256) { +- /* blue [0:4], green [5:10], red [11:15] */ +- fb->info->cmap[regno] = ((red >> (16-5)) & 0x1f) << 11 | +- ((green >> (16-6)) & 0x3f) << 5 | +- ((blue >> (16-5)) & 0x1f) << 0; ++ /* blue [23:16], green [15:8], red [7:0] */ ++ fb->gpu_cmap[regno] = ((red >> 8) & 0xff) << 0 | ++ ((green >> 8) & 0xff) << 8 | ++ ((blue >> 8) & 0xff) << 16; + } + /* Hack: we need to tell GPU the palette has changed, but currently bcm2708_fb_set_par takes noticable time when called for every (256) colour */ + /* So just call it for what looks like the last colour in a list for now. */ +- if (regno == 15 || regno == 255) +- bcm2708_fb_set_par(info); ++ if (regno == 15 || regno == 255) { ++ struct packet { ++ u32 offset; ++ u32 length; ++ u32 cmap[256]; ++ } *packet; ++ int ret; ++ ++ packet = kmalloc(sizeof(*packet), GFP_KERNEL); ++ if (!packet) ++ return -ENOMEM; ++ packet->offset = 0; ++ packet->length = regno + 1; ++ memcpy(packet->cmap, fb->gpu_cmap, sizeof(packet->cmap)); ++ ret = rpi_firmware_property(fb->fw, RPI_FIRMWARE_FRAMEBUFFER_SET_PALETTE, ++ packet, (2 + packet->length) * sizeof(u32)); ++ if (ret || packet->offset) ++ dev_err(info->device, "Failed to set palette (%d,%u)\n", ++ ret, packet->offset); ++ kfree(packet); ++ } + } else if (regno < 16) { + fb->cmap[regno] = convert_bitfield(transp, &fb->fb.var.transp) | + convert_bitfield(blue, &fb->fb.var.blue) | +@@ -372,27 +397,31 @@ static int bcm2708_fb_setcolreg(unsigned int regno, unsigned int red, + + static int bcm2708_fb_blank(int blank_mode, struct fb_info *info) + { +- s32 result = -1; +- u32 p[7]; +- if ( (blank_mode == FB_BLANK_NORMAL) || +- (blank_mode == FB_BLANK_UNBLANK)) { +- +- p[0] = 28; // size = sizeof u32 * length of p +- p[1] = VCMSG_PROCESS_REQUEST; // process request +- p[2] = VCMSG_SET_BLANK_SCREEN; // (the tag id) +- p[3] = 4; // (size of the response buffer) +- p[4] = 4; // (size of the request data) +- p[5] = blank_mode; +- p[6] = VCMSG_PROPERTY_END; // end tag +- +- bcm_mailbox_property(&p, p[0]); +- +- if ( p[1] == VCMSG_REQUEST_SUCCESSFUL ) +- result = 0; +- else +- pr_err("bcm2708_fb_blank(%d) returns=%d p[1]=0x%x\n", blank_mode, p[5], p[1]); ++ struct bcm2708_fb *fb = to_bcm2708(info); ++ u32 value; ++ int ret; ++ ++ switch (blank_mode) { ++ case FB_BLANK_UNBLANK: ++ value = 0; ++ break; ++ case FB_BLANK_NORMAL: ++ case FB_BLANK_VSYNC_SUSPEND: ++ case FB_BLANK_HSYNC_SUSPEND: ++ case FB_BLANK_POWERDOWN: ++ value = 1; ++ break; ++ default: ++ return -EINVAL; + } +- return result; ++ ++ ret = rpi_firmware_property(fb->fw, RPI_FIRMWARE_FRAMEBUFFER_BLANK, ++ &value, sizeof(value)); ++ if (ret) ++ dev_err(info->device, "bcm2708_fb_blank(%d) failed: %d\n", ++ blank_mode, ret); ++ ++ return ret; + } + + static int bcm2708_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) +@@ -408,25 +437,25 @@ static int bcm2708_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info + + static int bcm2708_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) + { +- s32 result = -1; +- u32 p[7]; +- if (cmd == FBIO_WAITFORVSYNC) { +- p[0] = 28; // size = sizeof u32 * length of p +- p[1] = VCMSG_PROCESS_REQUEST; // process request +- p[2] = VCMSG_SET_VSYNC; // (the tag id) +- p[3] = 4; // (size of the response buffer) +- p[4] = 4; // (size of the request data) +- p[5] = 0; // dummy +- p[6] = VCMSG_PROPERTY_END; // end tag +- +- bcm_mailbox_property(&p, p[0]); +- +- if ( p[1] == VCMSG_REQUEST_SUCCESSFUL ) +- result = 0; +- else +- pr_err("bcm2708_fb_ioctl %x,%lx returns=%d p[1]=0x%x\n", cmd, arg, p[5], p[1]); ++ struct bcm2708_fb *fb = to_bcm2708(info); ++ u32 dummy = 0; ++ int ret; ++ ++ switch (cmd) { ++ case FBIO_WAITFORVSYNC: ++ ret = rpi_firmware_property(fb->fw, ++ RPI_FIRMWARE_FRAMEBUFFER_SET_VSYNC, ++ &dummy, sizeof(dummy)); ++ break; ++ default: ++ dev_err(info->device, "Unknown ioctl 0x%x\n", cmd); ++ return -EINVAL; + } +- return result; ++ ++ if (ret) ++ dev_err(info->device, "ioctl 0x%x failed (%d)\n", cmd, ret); ++ ++ return ret; + } + static void bcm2708_fb_fillrect(struct fb_info *info, + const struct fb_fillrect *rect) +@@ -621,20 +650,7 @@ static struct fb_ops bcm2708_fb_ops = { + static int bcm2708_fb_register(struct bcm2708_fb *fb) + { + int ret; +- dma_addr_t dma; +- void *mem; +- +- mem = +- dma_alloc_coherent(&fb->dev->dev, PAGE_ALIGN(sizeof(*fb->info)), &dma, +- GFP_KERNEL); + +- if (NULL == mem) { +- pr_err(": unable to allocate fbinfo buffer\n"); +- ret = -ENOMEM; +- } else { +- fb->info = (struct fbinfo_s *)mem; +- fb->dma = dma; +- } + fb->fb.fbops = &bcm2708_fb_ops; + fb->fb.flags = FBINFO_FLAG_DEFAULT | FBINFO_HWACCEL_COPYAREA; + fb->fb.pseudo_palette = fb->cmap; +@@ -693,9 +709,22 @@ static int bcm2708_fb_register(struct bcm2708_fb *fb) + + static int bcm2708_fb_probe(struct platform_device *dev) + { ++ struct device_node *fw_np; ++ struct rpi_firmware *fw; + struct bcm2708_fb *fb; + int ret; + ++ fw_np = of_parse_phandle(dev->dev.of_node, "firmware", 0); ++/* Remove comment when booting without Device Tree is no longer supported ++ if (!fw_np) { ++ dev_err(&dev->dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } ++*/ ++ fw = rpi_firmware_get(fw_np); ++ if (!fw) ++ return -EPROBE_DEFER; ++ + fb = kzalloc(sizeof(struct bcm2708_fb), GFP_KERNEL); + if (!fb) { + dev_err(&dev->dev, +@@ -704,6 +733,7 @@ static int bcm2708_fb_probe(struct platform_device *dev) + goto free_region; + } + ++ fb->fw = fw; + bcm2708_fb_debugfs_init(fb); + + fb->cb_base = dma_alloc_writecombine(&dev->dev, SZ_64K, +@@ -737,6 +767,7 @@ static int bcm2708_fb_probe(struct platform_device *dev) + fb->dma_chan, fb->dma_chan_base); + + fb->dev = dev; ++ fb->fb.device = &dev->dev; + + ret = bcm2708_fb_register(fb); + if (ret == 0) { +@@ -769,8 +800,6 @@ static int bcm2708_fb_remove(struct platform_device *dev) + dma_free_writecombine(&dev->dev, SZ_64K, fb->cb_base, fb->cb_handle); + bcm_dma_chan_free(fb->dma_chan); + +- dma_free_coherent(NULL, PAGE_ALIGN(sizeof(*fb->info)), (void *)fb->info, +- fb->dma); + bcm2708_fb_debugfs_deinit(fb); + + free_irq(fb->dma_irq, fb); + +From 8af174253322c75147e90fbc0ec0698d171e15ad Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Mon, 20 Jul 2015 12:27:17 +0200 +Subject: [PATCH 138/149] bcm2835: Add firmware property to affected devices +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Also move firmware depending devices to the rpi dtsi file since +they depend on the Pi specific firmware. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2835-rpi.dtsi | 22 ++++++++++++++++++---- + arch/arm/boot/dts/bcm2835.dtsi | 15 --------------- + 2 files changed, 18 insertions(+), 19 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2835-rpi.dtsi b/arch/arm/boot/dts/bcm2835-rpi.dtsi +index 5cdfd5a..6c3daaf 100644 +--- a/arch/arm/boot/dts/bcm2835-rpi.dtsi ++++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi +@@ -32,6 +32,24 @@ + compatible = "raspberrypi,bcm2835-firmware"; + mboxes = <&mailbox>; + }; ++ ++ fb: fb { ++ compatible = "brcm,bcm2708-fb"; ++ firmware = <&firmware>; ++ }; ++ ++ thermal: thermal { ++ compatible = "brcm,bcm2835-thermal"; ++ firmware = <&firmware>; ++ }; ++ ++ vchiq: vchiq { ++ compatible = "brcm,bcm2835-vchiq"; ++ reg = <0x7e00b840 0xf>; ++ interrupts = <0 2>; ++ cache-line-size = <32>; ++ firmware = <&firmware>; ++ }; + }; + + /* Onboard audio */ +@@ -101,10 +119,6 @@ + bus-width = <4>; + }; + +-&fb { +- status = "okay"; +-}; +- + / { + __overrides__ { + i2s = <&i2s>,"status"; +diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi +index 1135120..807264d 100644 +--- a/arch/arm/boot/dts/bcm2835.dtsi ++++ b/arch/arm/boot/dts/bcm2835.dtsi +@@ -160,21 +160,6 @@ + arm-pmu { + compatible = "arm,arm1176-pmu"; + }; +- +- fb: fb { +- compatible = "brcm,bcm2708-fb"; +- status = "disabled"; +- }; +- +- vchiq: vchiq { +- compatible = "brcm,bcm2835-vchiq"; +- reg = <0x7e00b840 0xf>; +- interrupts = <0 2>; +- }; +- +- thermal: thermal { +- compatible = "brcm,bcm2835-thermal"; +- }; + }; + + clocks { + +From 66840ef91d4a460062686c8312f267264b567f98 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Tue, 21 Jul 2015 19:09:39 +0200 +Subject: [PATCH 139/149] rpi-ft5406: Use firmware API +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts | 1 + + drivers/input/touchscreen/rpi-ft5406.c | 74 ++++++++++------------- + 2 files changed, 32 insertions(+), 43 deletions(-) + +diff --git a/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts b/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts +index 40deab5..2e53a17 100644 +--- a/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts ++++ b/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts +@@ -9,6 +9,7 @@ + __overlay__ { + rpi_ft5406: rpi_ft5406 { + compatible = "rpi,rpi-ft5406"; ++ firmware = <&firmware>; + status = "okay"; + }; + }; +diff --git a/drivers/input/touchscreen/rpi-ft5406.c b/drivers/input/touchscreen/rpi-ft5406.c +index d41851d..c08817e 100644 +--- a/drivers/input/touchscreen/rpi-ft5406.c ++++ b/drivers/input/touchscreen/rpi-ft5406.c +@@ -21,7 +21,7 @@ + #include + #include + #include +-#include ++#include + + #define MAXIMUM_SUPPORTED_POINTS 10 + struct ft5406_regs { +@@ -49,23 +49,6 @@ struct ft5406 { + struct task_struct * thread; + }; + +- +-/* tag part of the message */ +-struct vc_msg_tag { +- uint32_t tag_id; /* the message id */ +- uint32_t buffer_size; /* size of the buffer (which in this case is always 8 bytes) */ +- uint32_t data_size; /* amount of data being sent or received */ +- uint32_t val; /* data buffer */ +-}; +- +-/* message structure to be sent to videocore */ +-struct vc_msg { +- uint32_t msg_size; /* simply, sizeof(struct vc_msg) */ +- uint32_t request_code; /* holds various information like the success and number of bytes returned (refer to mailboxes wiki) */ +- struct vc_msg_tag tag; /* the tag structure above to make */ +- uint32_t end_tag; /* an end identifier, should be set to NULL */ +-}; +- + /* Thread to poll for touchscreen events + * + * This thread polls the memory based register copy of the ft5406 registers +@@ -136,11 +119,37 @@ static int ft5406_probe(struct platform_device *pdev) + { + int ret; + struct input_dev * input_dev = input_allocate_device(); +- struct vc_msg request; + struct ft5406 * ts; ++ struct device_node *fw_node; ++ struct rpi_firmware *fw; ++ u32 touchbuf; + + dev_info(&pdev->dev, "Probing device\n"); + ++ fw_node = of_parse_phandle(pdev->dev.of_node, "firmware", 0); ++ if (!fw_node) { ++ dev_err(&pdev->dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } ++ ++ fw = rpi_firmware_get(fw_node); ++ if (!fw) ++ return -EPROBE_DEFER; ++ ++ ret = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_GET_TOUCHBUF, ++ &touchbuf, sizeof(touchbuf)); ++ if (ret) { ++ dev_err(&pdev->dev, "Failed to get touch buffer\n"); ++ return ret; ++ } ++ ++ if (!touchbuf) { ++ dev_err(&pdev->dev, "Touchscreen not detected\n"); ++ return -ENODEV; ++ } ++ ++ dev_dbg(&pdev->dev, "Got TS buffer 0x%x\n", touchbuf); ++ + ts = kzalloc(sizeof(struct ft5406), GFP_KERNEL); + + if (!ts || !input_dev) { +@@ -174,36 +183,15 @@ static int ft5406_probe(struct platform_device *pdev) + return ret; + } + +- memset(&request, 0, sizeof request); +- +- request.msg_size = sizeof request; +- request.request_code = VCMSG_PROCESS_REQUEST; +- request.tag.tag_id = VCMSG_GET_TOUCHBUF; +- request.tag.buffer_size = 4; +- request.tag.data_size = 4; +- +- bcm_mailbox_property(&request, sizeof(request)); +- +- if(request.request_code == VCMSG_REQUEST_SUCCESSFUL && request.tag.val != 0) +- { +- dev_dbg(&pdev->dev, "Got TS buffer 0x%x\n", request.tag.val); +- } +- else +- { +- input_unregister_device(input_dev); +- kzfree(ts); +- return -1; +- } +- + // mmap the physical memory +- request.tag.val &= ~0xc0000000; +- ts->ts_base = ioremap(request.tag.val, sizeof(*ts->regs)); ++ touchbuf &= ~0xc0000000; ++ ts->ts_base = ioremap(touchbuf, sizeof(*ts->regs)); + if(ts->ts_base == NULL) + { + dev_err(&pdev->dev, "Failed to map physical address\n"); + input_unregister_device(input_dev); + kzfree(ts); +- return -1; ++ return -ENOMEM; + } + + ts->regs = (struct ft5406_regs *) ts->ts_base; + +From c1a5966807b9f6111684fda87e17df03f948e4d2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 12 Jun 2015 19:01:05 +0200 +Subject: [PATCH 140/149] irqchip: bcm2835: Add FIQ support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add a duplicate irq range with an offset on the hwirq's so the +driver can detect that enable_fiq() is used. +Tested with downstream dwc_otg USB controller driver. + +Signed-off-by: Noralf Trønnes +Reviewed-by: Eric Anholt +Acked-by: Stephen Warren +--- + arch/arm/mach-bcm/Kconfig | 1 + + drivers/irqchip/irq-bcm2835.c | 53 ++++++++++++++++++++++++++++++++++++++----- + 2 files changed, 48 insertions(+), 6 deletions(-) + +diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig +index 8b11f44..7cfef7b 100644 +--- a/arch/arm/mach-bcm/Kconfig ++++ b/arch/arm/mach-bcm/Kconfig +@@ -114,6 +114,7 @@ config ARCH_BCM2835 + select ARM_ERRATA_411920 + select ARM_TIMER_SP804 + select CLKSRC_OF ++ select FIQ + select PINCTRL + select PINCTRL_BCM2835 + help +diff --git a/drivers/irqchip/irq-bcm2835.c b/drivers/irqchip/irq-bcm2835.c +index 5916d6c..db66246 100644 +--- a/drivers/irqchip/irq-bcm2835.c ++++ b/drivers/irqchip/irq-bcm2835.c +@@ -56,7 +56,7 @@ + #include "irqchip.h" + + /* Put the bank and irq (32 bits) into the hwirq */ +-#define MAKE_HWIRQ(b, n) ((b << 5) | (n)) ++#define MAKE_HWIRQ(b, n) (((b) << 5) | (n)) + #define HWIRQ_BANK(i) (i >> 5) + #define HWIRQ_BIT(i) BIT(i & 0x1f) + +@@ -72,9 +72,13 @@ + | SHORTCUT1_MASK | SHORTCUT2_MASK) + + #define REG_FIQ_CONTROL 0x0c ++#define REG_FIQ_ENABLE 0x80 ++#define REG_FIQ_DISABLE 0 + + #define NR_BANKS 3 + #define IRQS_PER_BANK 32 ++#define NUMBER_IRQS MAKE_HWIRQ(NR_BANKS, 0) ++#define FIQ_START (NR_IRQS_BANK0 + MAKE_HWIRQ(NR_BANKS - 1, 0)) + + static int reg_pending[] __initconst = { 0x00, 0x04, 0x08 }; + static int reg_enable[] __initconst = { 0x18, 0x10, 0x14 }; +@@ -98,14 +102,38 @@ static struct armctrl_ic intc __read_mostly; + static void __exception_irq_entry bcm2835_handle_irq( + struct pt_regs *regs); + ++static inline unsigned int hwirq_to_fiq(unsigned long hwirq) ++{ ++ hwirq -= NUMBER_IRQS; ++ /* ++ * The hwirq numbering used in this driver is: ++ * BASE (0-7) GPU1 (32-63) GPU2 (64-95). ++ * This differ from the one used in the FIQ register: ++ * GPU1 (0-31) GPU2 (32-63) BASE (64-71) ++ */ ++ if (hwirq >= 32) ++ return hwirq - 32; ++ ++ return hwirq + 64; ++} ++ + static void armctrl_mask_irq(struct irq_data *d) + { +- writel_relaxed(HWIRQ_BIT(d->hwirq), intc.disable[HWIRQ_BANK(d->hwirq)]); ++ if (d->hwirq >= NUMBER_IRQS) ++ writel_relaxed(REG_FIQ_DISABLE, intc.base + REG_FIQ_CONTROL); ++ else ++ writel_relaxed(HWIRQ_BIT(d->hwirq), ++ intc.disable[HWIRQ_BANK(d->hwirq)]); + } + + static void armctrl_unmask_irq(struct irq_data *d) + { +- writel_relaxed(HWIRQ_BIT(d->hwirq), intc.enable[HWIRQ_BANK(d->hwirq)]); ++ if (d->hwirq >= NUMBER_IRQS) ++ writel_relaxed(REG_FIQ_ENABLE | hwirq_to_fiq(d->hwirq), ++ intc.base + REG_FIQ_CONTROL); ++ else ++ writel_relaxed(HWIRQ_BIT(d->hwirq), ++ intc.enable[HWIRQ_BANK(d->hwirq)]); + } + + static struct irq_chip armctrl_chip = { +@@ -150,8 +178,9 @@ static int __init armctrl_of_init(struct device_node *node, + panic("%s: unable to map IC registers\n", + node->full_name); + +- intc.domain = irq_domain_add_linear(node, MAKE_HWIRQ(NR_BANKS, 0), +- &armctrl_ops, NULL); ++ intc.base = base; ++ intc.domain = irq_domain_add_linear(node, NUMBER_IRQS * 2, ++ &armctrl_ops, NULL); + if (!intc.domain) + panic("%s: unable to create IRQ domain\n", node->full_name); + +@@ -168,8 +197,20 @@ static int __init armctrl_of_init(struct device_node *node, + set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); + } + } +- + set_handle_irq(bcm2835_handle_irq); ++ ++ /* Make a duplicate irq range which is used to enable FIQ */ ++ for (b = 0; b < NR_BANKS; b++) { ++ for (i = 0; i < bank_irqs[b]; i++) { ++ irq = irq_create_mapping(intc.domain, ++ MAKE_HWIRQ(b, i) + NUMBER_IRQS); ++ BUG_ON(irq <= 0); ++ irq_set_chip(irq, &armctrl_chip); ++ set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); ++ } ++ } ++ init_FIQ(FIQ_START); ++ + return 0; + } + + +From 0086c10ac490fb95a1ec82df80587b591ee74ab3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 24 Jul 2015 15:50:04 +0200 +Subject: [PATCH 141/149] dwc_otg: Add ARCH_BCM2835 support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Noralf Trønnes +--- + drivers/usb/host/dwc_otg/dwc_otg_driver.c | 1 + + drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 1 - + drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c | 4 ++++ + 3 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_driver.c b/drivers/usb/host/dwc_otg/dwc_otg_driver.c +index 53307f0..95edadf 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_driver.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_driver.c +@@ -723,6 +723,7 @@ static int dwc_otg_driver_probe( + + memset(dwc_otg_device, 0, sizeof(*dwc_otg_device)); + dwc_otg_device->os_dep.reg_offset = 0xFFFFFFFF; ++ dwc_otg_device->os_dep.platformdev = _dev; + + /* + * Map the DWC_otg Core memory into virtual address space. +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +index 8a31562..3f71f29 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +@@ -36,7 +36,6 @@ + #include "dwc_otg_regs.h" + + #include +-#include + #include + + +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c +index 0f4ebcd..5c83309 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c +@@ -445,7 +445,11 @@ static void hcd_init_fiq(void *cookie) + DWC_WARN("MPHI periph has NOT been enabled"); + #endif + // Enable FIQ interrupt from USB peripheral ++#ifdef CONFIG_ARCH_BCM2835 ++ enable_fiq(platform_get_irq(otg_dev->os_dep.platformdev, 1)); ++#else + enable_fiq(INTERRUPT_VC_USB); ++#endif + local_fiq_enable(); + } + + +From 025a502906cf5454047391a95846c4d6a3065240 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 24 Jul 2015 15:50:24 +0200 +Subject: [PATCH 142/149] bcm2835: Use DWC_OTG +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2835.dtsi | 8 +++++--- + arch/arm/configs/bcm2835_defconfig | 1 + + 2 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi +index 807264d..8a5d6ec 100644 +--- a/arch/arm/boot/dts/bcm2835.dtsi ++++ b/arch/arm/boot/dts/bcm2835.dtsi +@@ -152,9 +152,11 @@ + }; + + usb: usb@7e980000 { +- compatible = "brcm,bcm2835-usb"; +- reg = <0x7e980000 0x10000>; +- interrupts = <1 9>; ++ compatible = "brcm,bcm2708-usb"; ++ reg = <0x7e980000 0x10000>, ++ <0x7e006000 0x1000>; ++ interrupts = <2 0>, ++ <1 9>; + }; + + arm-pmu { +diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig +index c284414..14ef294 100644 +--- a/arch/arm/configs/bcm2835_defconfig ++++ b/arch/arm/configs/bcm2835_defconfig +@@ -869,6 +869,7 @@ CONFIG_USB_HIDDEV=y + CONFIG_USB=y + CONFIG_USB_ANNOUNCE_NEW_DEVICES=y + CONFIG_USB_MON=m ++CONFIG_USB_DWCOTG=y + CONFIG_USB_PRINTER=m + CONFIG_USB_STORAGE=y + CONFIG_USB_STORAGE_REALTEK=m + +From 808a80f803c9f8897b0867a5a7c0d52cfe984bfe Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 24 Jul 2015 19:33:16 +0200 +Subject: [PATCH 143/149] Fix RASPBERRYPI_FIRMWARE dependents +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If forgot this when converting the drivers. + +Signed-off-by: Noralf Trønnes +--- + drivers/cpufreq/Kconfig.arm | 2 +- + drivers/input/touchscreen/Kconfig | 2 +- + drivers/misc/vc04_services/Kconfig | 2 +- + drivers/thermal/Kconfig | 2 +- + drivers/video/fbdev/Kconfig | 2 +- + 5 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm +index a1039f0..0037516 100644 +--- a/drivers/cpufreq/Kconfig.arm ++++ b/drivers/cpufreq/Kconfig.arm +@@ -259,7 +259,7 @@ config ARM_SPEAR_CPUFREQ + This adds the CPUFreq driver support for SPEAr SOCs. + + config ARM_BCM2835_CPUFREQ +- depends on BCM2708_MBOX ++ depends on RASPBERRYPI_FIRMWARE + bool "BCM2835 Driver" + default y + help +diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig +index 5848562..d7e74a1 100644 +--- a/drivers/input/touchscreen/Kconfig ++++ b/drivers/input/touchscreen/Kconfig +@@ -585,7 +585,7 @@ config TOUCHSCREEN_EDT_FT5X06 + + config TOUCHSCREEN_RPI_FT5406 + tristate "Raspberry Pi FT5406 driver" +- depends on ARCH_BCM2708 || ARCH_BCM2709 ++ depends on RASPBERRYPI_FIRMWARE + help + Say Y here to enable the Raspberry Pi memory based FT5406 device + +diff --git a/drivers/misc/vc04_services/Kconfig b/drivers/misc/vc04_services/Kconfig +index c5ba283..db8e1be 100644 +--- a/drivers/misc/vc04_services/Kconfig ++++ b/drivers/misc/vc04_services/Kconfig +@@ -1,6 +1,6 @@ + config BCM2708_VCHIQ + tristate "Videocore VCHIQ" +- depends on (MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835) && BCM2708_MBOX ++ depends on RASPBERRYPI_FIRMWARE + default y + help + Kernel to VideoCore communication interface for the +diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig +index ddc77ad..b911213 100644 +--- a/drivers/thermal/Kconfig ++++ b/drivers/thermal/Kconfig +@@ -239,7 +239,7 @@ config INTEL_POWERCLAMP + user interface is exposed via generic thermal framework. + + config THERMAL_BCM2835 +- depends on BCM2708_MBOX ++ depends on RASPBERRYPI_FIRMWARE + tristate "BCM2835 Thermal Driver" + help + This will enable temperature monitoring for the Broadcom BCM2835 +diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig +index 3444a4c..c073d55 100644 +--- a/drivers/video/fbdev/Kconfig ++++ b/drivers/video/fbdev/Kconfig +@@ -226,7 +226,7 @@ comment "Frame buffer hardware drivers" + + config FB_BCM2708 + tristate "BCM2708 framebuffer support" +- depends on FB && ARM && BCM2708_MBOX ++ depends on FB && RASPBERRYPI_FIRMWARE + select FB_CFB_FILLRECT + select FB_CFB_COPYAREA + select FB_CFB_IMAGEBLIT + +From eca36789db0d78a939c6520e28bbb7f7e8ea1442 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 24 Jul 2015 19:33:46 +0200 +Subject: [PATCH 144/149] vc_mem: Remove unnecessary include +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Noralf Trønnes +--- + drivers/char/broadcom/vc_mem.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/char/broadcom/vc_mem.c b/drivers/char/broadcom/vc_mem.c +index fcde6b1..be64f23 100644 +--- a/drivers/char/broadcom/vc_mem.c ++++ b/drivers/char/broadcom/vc_mem.c +@@ -22,7 +22,6 @@ + #include + #include + #include +-#include + #include + + #define DRIVER_NAME "vc-mem" + +From 89df011c7e129660df28ee2bc7744f8ff60ed316 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 24 Jul 2015 19:34:06 +0200 +Subject: [PATCH 145/149] configs: Remove BCM2708_MBOX +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Noralf Trønnes +--- + arch/arm/configs/bcm2709_defconfig | 1 - + arch/arm/configs/bcm2835_defconfig | 1 - + arch/arm/configs/bcmrpi_defconfig | 1 - + 3 files changed, 3 deletions(-) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index dd00e7c..e3155da 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -1078,7 +1078,6 @@ CONFIG_FB_TFT_WATTEROTT=m + CONFIG_FB_FLEX=m + CONFIG_FB_TFT_FBTFT_DEVICE=m + CONFIG_MAILBOX=y +-CONFIG_BCM2708_MBOX=y + CONFIG_BCM2835_MBOX=y + # CONFIG_IOMMU_SUPPORT is not set + CONFIG_EXTCON=m +diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig +index 14ef294..24d4df6 100644 +--- a/arch/arm/configs/bcm2835_defconfig ++++ b/arch/arm/configs/bcm2835_defconfig +@@ -1065,7 +1065,6 @@ CONFIG_FB_TFT_WATTEROTT=m + CONFIG_FB_FLEX=m + CONFIG_FB_TFT_FBTFT_DEVICE=m + CONFIG_MAILBOX=y +-CONFIG_BCM2708_MBOX=y + CONFIG_BCM2835_MBOX=y + # CONFIG_IOMMU_SUPPORT is not set + CONFIG_EXTCON=m +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 7b24274..0859113 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -1071,7 +1071,6 @@ CONFIG_FB_TFT_WATTEROTT=m + CONFIG_FB_FLEX=m + CONFIG_FB_TFT_FBTFT_DEVICE=m + CONFIG_MAILBOX=y +-CONFIG_BCM2708_MBOX=y + CONFIG_BCM2835_MBOX=y + # CONFIG_IOMMU_SUPPORT is not set + CONFIG_EXTCON=m + +From 73e04a4d5c4e57aa0874fa5e79688e2b8eb6d0f8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 24 Jul 2015 19:34:31 +0200 +Subject: [PATCH 146/149] bcm2708-vcio: Remove module +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +All drivers have been converted to the new firmware API, so this +module is not needed anymore. + +Signed-off-by: Noralf Trønnes +--- + drivers/mailbox/Kconfig | 6 -- + drivers/mailbox/Makefile | 2 - + drivers/mailbox/bcm2708-vcio.c | 86 ----------------- + include/linux/platform_data/mailbox-bcm2708.h | 127 -------------------------- + 4 files changed, 221 deletions(-) + delete mode 100644 drivers/mailbox/bcm2708-vcio.c + delete mode 100644 include/linux/platform_data/mailbox-bcm2708.h + +diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig +index d1a6671..3965e10 100644 +--- a/drivers/mailbox/Kconfig ++++ b/drivers/mailbox/Kconfig +@@ -7,12 +7,6 @@ menuconfig MAILBOX + + if MAILBOX + +-config BCM2708_MBOX +- bool "Broadcom BCM2708 Mailbox (vcio)" +- depends on BCM2835_MBOX +- help +- Broadcom BCM2708 Mailbox (vcio) +- + config ARM_MHU + tristate "ARM MHU Mailbox" + depends on ARM_AMBA +diff --git a/drivers/mailbox/Makefile b/drivers/mailbox/Makefile +index c86bc91..8e6d822 100644 +--- a/drivers/mailbox/Makefile ++++ b/drivers/mailbox/Makefile +@@ -2,8 +2,6 @@ + + obj-$(CONFIG_MAILBOX) += mailbox.o + +-obj-$(CONFIG_BCM2708_MBOX) += bcm2708-vcio.o +- + obj-$(CONFIG_ARM_MHU) += arm_mhu.o + + obj-$(CONFIG_PL320_MBOX) += pl320-ipc.o +diff --git a/drivers/mailbox/bcm2708-vcio.c b/drivers/mailbox/bcm2708-vcio.c +deleted file mode 100644 +index 2e4031b..0000000 +--- a/drivers/mailbox/bcm2708-vcio.c ++++ /dev/null +@@ -1,86 +0,0 @@ +-/* +- * Copyright (C) 2010 Broadcom +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License version 2 as +- * published by the Free Software Foundation. +- * +- * This device provides a shared mechanism for writing to the mailboxes, +- * semaphores, doorbells etc. that are shared between the ARM and the +- * VideoCore processor +- */ +- +-#include +-#include +-#include +-#include +-#include +-#include +- +-#define DRIVER_NAME "bcm2708_vcio" +- +-extern int bcm_mailbox_write(unsigned chan, uint32_t data28) +-{ +- struct rpi_firmware *fw = rpi_firmware_get(NULL); +- +- if (!fw) +- return -ENODEV; +- +- return rpi_firmware_transaction(fw, chan, data28); +-} +-EXPORT_SYMBOL_GPL(bcm_mailbox_write); +- +-extern int bcm_mailbox_read(unsigned chan, uint32_t *data28) +-{ +- struct rpi_firmware *fw = rpi_firmware_get(NULL); +- +- if (!fw) +- return -ENODEV; +- +- *data28 = rpi_firmware_transaction_received(fw); +- +- return 0; +-} +-EXPORT_SYMBOL_GPL(bcm_mailbox_read); +- +-static DEFINE_MUTEX(mailbox_lock); +-extern int bcm_mailbox_property(void *data, int size) +-{ +- uint32_t success; +- dma_addr_t mem_bus; /* the memory address accessed from videocore */ +- void *mem_kern; /* the memory address accessed from driver */ +- int s = 0; +- +- mutex_lock(&mailbox_lock); +- /* allocate some memory for the messages communicating with GPU */ +- mem_kern = dma_alloc_coherent(NULL, PAGE_ALIGN(size), &mem_bus, +- GFP_KERNEL); +- if (mem_kern) { +- /* create the message */ +- memcpy(mem_kern, data, size); +- +- /* send the message */ +- wmb(); +- s = bcm_mailbox_write(MBOX_CHAN_PROPERTY, (uint32_t)mem_bus); +- if (s == 0) +- s = bcm_mailbox_read(MBOX_CHAN_PROPERTY, &success); +- if (s == 0) { +- /* copy the response */ +- rmb(); +- memcpy(data, mem_kern, size); +- } +- dma_free_coherent(NULL, PAGE_ALIGN(size), mem_kern, mem_bus); +- } else { +- s = -ENOMEM; +- } +- if (s != 0) +- pr_err(DRIVER_NAME ": %s failed (%d)\n", __func__, s); +- +- mutex_unlock(&mailbox_lock); +- return s; +-} +-EXPORT_SYMBOL_GPL(bcm_mailbox_property); +- +-MODULE_AUTHOR("Gray Girling"); +-MODULE_DESCRIPTION("ARM I/O to VideoCore processor"); +-MODULE_LICENSE("GPL"); +diff --git a/include/linux/platform_data/mailbox-bcm2708.h b/include/linux/platform_data/mailbox-bcm2708.h +deleted file mode 100644 +index d3ea839..0000000 +--- a/include/linux/platform_data/mailbox-bcm2708.h ++++ /dev/null +@@ -1,127 +0,0 @@ +-/* +- * Copyright (C) 2010 Broadcom +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- */ +-#ifndef _PLAT_MAILBOX_BCM2708_H +-#define _PLAT_MAILBOX_BCM2708_H +- +-/* Routines to handle I/O via the VideoCore "ARM control" registers +- * (semaphores, doorbells, mailboxes) +- */ +- +-/* Constants shared with the ARM identifying separate mailbox channels */ +-#define MBOX_CHAN_POWER 0 /* for use by the power management interface */ +-#define MBOX_CHAN_FB 1 /* for use by the frame buffer */ +-#define MBOX_CHAN_VCHIQ 3 /* for use by the VCHIQ interface */ +-#define MBOX_CHAN_PROPERTY 8 /* for use by the property channel */ +-#define MBOX_CHAN_COUNT 9 +- +-enum { +- VCMSG_PROCESS_REQUEST = 0x00000000 +-}; +- +-enum { +- VCMSG_REQUEST_SUCCESSFUL = 0x80000000, +- VCMSG_REQUEST_FAILED = 0x80000001 +-}; +- +-/* Mailbox property tags */ +-enum { +- VCMSG_PROPERTY_END = 0x00000000, +- VCMSG_GET_FIRMWARE_REVISION = 0x00000001, +- VCMSG_GET_BOARD_MODEL = 0x00010001, +- VCMSG_GET_BOARD_REVISION = 0x00010002, +- VCMSG_GET_BOARD_MAC_ADDRESS = 0x00010003, +- VCMSG_GET_BOARD_SERIAL = 0x00010004, +- VCMSG_GET_ARM_MEMORY = 0x00010005, +- VCMSG_GET_VC_MEMORY = 0x00010006, +- VCMSG_GET_CLOCKS = 0x00010007, +- VCMSG_GET_COMMAND_LINE = 0x00050001, +- VCMSG_GET_DMA_CHANNELS = 0x00060001, +- VCMSG_GET_POWER_STATE = 0x00020001, +- VCMSG_GET_TIMING = 0x00020002, +- VCMSG_SET_POWER_STATE = 0x00028001, +- VCMSG_GET_CLOCK_STATE = 0x00030001, +- VCMSG_SET_CLOCK_STATE = 0x00038001, +- VCMSG_GET_CLOCK_RATE = 0x00030002, +- VCMSG_SET_CLOCK_RATE = 0x00038002, +- VCMSG_GET_VOLTAGE = 0x00030003, +- VCMSG_SET_VOLTAGE = 0x00038003, +- VCMSG_GET_MAX_CLOCK = 0x00030004, +- VCMSG_GET_MAX_VOLTAGE = 0x00030005, +- VCMSG_GET_TEMPERATURE = 0x00030006, +- VCMSG_GET_MIN_CLOCK = 0x00030007, +- VCMSG_GET_MIN_VOLTAGE = 0x00030008, +- VCMSG_GET_TURBO = 0x00030009, +- VCMSG_GET_MAX_TEMPERATURE = 0x0003000a, +- VCMSG_GET_STC = 0x0003000b, +- VCMSG_SET_TURBO = 0x00038009, +- VCMSG_SET_ALLOCATE_MEM = 0x0003000c, +- VCMSG_SET_LOCK_MEM = 0x0003000d, +- VCMSG_SET_UNLOCK_MEM = 0x0003000e, +- VCMSG_SET_RELEASE_MEM = 0x0003000f, +- VCMSG_SET_EXECUTE_CODE = 0x00030010, +- VCMSG_SET_EXECUTE_QPU = 0x00030011, +- VCMSG_SET_ENABLE_QPU = 0x00030012, +- VCMSG_GET_RESOURCE_HANDLE = 0x00030014, +- VCMSG_GET_EDID_BLOCK = 0x00030020, +- VCMSG_GET_CUSTOMER_OTP = 0x00030021, +- VCMSG_SET_CUSTOMER_OTP = 0x00038021, +- VCMSG_SET_ALLOCATE_BUFFER = 0x00040001, +- VCMSG_SET_RELEASE_BUFFER = 0x00048001, +- VCMSG_SET_BLANK_SCREEN = 0x00040002, +- VCMSG_TST_BLANK_SCREEN = 0x00044002, +- VCMSG_GET_PHYSICAL_WIDTH_HEIGHT = 0x00040003, +- VCMSG_TST_PHYSICAL_WIDTH_HEIGHT = 0x00044003, +- VCMSG_SET_PHYSICAL_WIDTH_HEIGHT = 0x00048003, +- VCMSG_GET_VIRTUAL_WIDTH_HEIGHT = 0x00040004, +- VCMSG_TST_VIRTUAL_WIDTH_HEIGHT = 0x00044004, +- VCMSG_SET_VIRTUAL_WIDTH_HEIGHT = 0x00048004, +- VCMSG_GET_DEPTH = 0x00040005, +- VCMSG_TST_DEPTH = 0x00044005, +- VCMSG_SET_DEPTH = 0x00048005, +- VCMSG_GET_PIXEL_ORDER = 0x00040006, +- VCMSG_TST_PIXEL_ORDER = 0x00044006, +- VCMSG_SET_PIXEL_ORDER = 0x00048006, +- VCMSG_GET_ALPHA_MODE = 0x00040007, +- VCMSG_TST_ALPHA_MODE = 0x00044007, +- VCMSG_SET_ALPHA_MODE = 0x00048007, +- VCMSG_GET_PITCH = 0x00040008, +- VCMSG_TST_PITCH = 0x00044008, +- VCMSG_SET_PITCH = 0x00048008, +- VCMSG_GET_VIRTUAL_OFFSET = 0x00040009, +- VCMSG_TST_VIRTUAL_OFFSET = 0x00044009, +- VCMSG_SET_VIRTUAL_OFFSET = 0x00048009, +- VCMSG_GET_OVERSCAN = 0x0004000a, +- VCMSG_TST_OVERSCAN = 0x0004400a, +- VCMSG_SET_OVERSCAN = 0x0004800a, +- VCMSG_GET_PALETTE = 0x0004000b, +- VCMSG_TST_PALETTE = 0x0004400b, +- VCMSG_SET_PALETTE = 0x0004800b, +- VCMSG_GET_LAYER = 0x0004000c, +- VCMSG_TST_LAYER = 0x0004400c, +- VCMSG_SET_LAYER = 0x0004800c, +- VCMSG_GET_TRANSFORM = 0x0004000d, +- VCMSG_TST_TRANSFORM = 0x0004400d, +- VCMSG_SET_TRANSFORM = 0x0004800d, +- VCMSG_TST_VSYNC = 0x0004400e, +- VCMSG_SET_VSYNC = 0x0004800e, +- VCMSG_GET_TOUCHBUF = 0x0004000f, +- VCMSG_SET_CURSOR_INFO = 0x00008010, +- VCMSG_SET_CURSOR_STATE = 0x00008011, +-}; +- +-int bcm_mailbox_read(unsigned chan, uint32_t *data28); +-int bcm_mailbox_write(unsigned chan, uint32_t data28); +-int bcm_mailbox_property(void *data, int size); +- +-#endif + +From f69941fbc0eb961fbf580165ad5022e26095db49 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 24 Jul 2015 19:34:55 +0200 +Subject: [PATCH 147/149] Revert "firmware: bcm2835: Support legacy mailbox + API" +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This reverts commit 40aa3c4f0c430cd5c574498f4d1d5e9f0bc1cf11. + +The legacy mailbox API has been removed so this is not needed. + +Signed-off-by: Noralf Trønnes +--- + drivers/firmware/raspberrypi.c | 15 ++------------- + include/soc/bcm2835/raspberrypi-firmware.h | 2 -- + 2 files changed, 2 insertions(+), 15 deletions(-) + +diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c +index 89421a9..b980d53 100644 +--- a/drivers/firmware/raspberrypi.c ++++ b/drivers/firmware/raspberrypi.c +@@ -19,7 +19,6 @@ + #define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf)) + #define MBOX_CHAN(msg) ((msg) & 0xf) + #define MBOX_DATA28(msg) ((msg) & ~0xf) +-#define MBOX_CHAN_VCHIQ 3 + #define MBOX_CHAN_PROPERTY 8 + + struct rpi_firmware { +@@ -27,7 +26,6 @@ struct rpi_firmware { + struct mbox_chan *chan; /* The property channel. */ + struct completion c; + u32 enabled; +- u32 received; + }; + + static struct platform_device *g_pdev; +@@ -37,7 +35,6 @@ static DEFINE_MUTEX(transaction_lock); + static void response_callback(struct mbox_client *cl, void *msg) + { + struct rpi_firmware *fw = container_of(cl, struct rpi_firmware, cl); +- fw->received = *(u32 *)msg; + complete(&fw->c); + } + +@@ -45,7 +42,7 @@ static void response_callback(struct mbox_client *cl, void *msg) + * Sends a request to the firmware through the BCM2835 mailbox driver, + * and synchronously waits for the reply. + */ +-int ++static int + rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data) + { + u32 message = MBOX_MSG(chan, data); +@@ -57,8 +54,7 @@ rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data) + reinit_completion(&fw->c); + ret = mbox_send_message(fw->chan, &message); + if (ret >= 0) { +- if (chan != MBOX_CHAN_VCHIQ) +- wait_for_completion(&fw->c); ++ wait_for_completion(&fw->c); + ret = 0; + } else { + dev_err(fw->cl.dev, "mbox_send_message returned %d\n", ret); +@@ -67,13 +63,6 @@ rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data) + + return ret; + } +-EXPORT_SYMBOL(rpi_firmware_transaction); +- +-u32 rpi_firmware_transaction_received(struct rpi_firmware *fw) +-{ +- return MBOX_DATA28(fw->received); +-} +-EXPORT_SYMBOL(rpi_firmware_transaction_received); + + /** + * rpi_firmware_property_list - Submit firmware property list +diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h +index 9a08cf1..d3933af 100644 +--- a/include/soc/bcm2835/raspberrypi-firmware.h ++++ b/include/soc/bcm2835/raspberrypi-firmware.h +@@ -116,8 +116,6 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001, + }; + +-int rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data); +-u32 rpi_firmware_transaction_received(struct rpi_firmware *fw); + int rpi_firmware_property(struct rpi_firmware *fw, + u32 tag, void *data, size_t len); + int rpi_firmware_property_list(struct rpi_firmware *fw, + +From 63de8df89946ca2bf9e663941c6d9108d212d1ba Mon Sep 17 00:00:00 2001 +From: Jonathan Bell +Date: Tue, 30 Jun 2015 12:35:39 +0100 +Subject: [PATCH 148/149] pinctrl: bcm2835: Clear the event latch register when + disabling interrupts + +It's possible to hit a race condition if interrupts are generated on a GPIO +pin when the IRQ line in question is being disabled. + +If the interrupt is freed, bcm2835_gpio_irq_disable() is called which +disables the event generation sources (edge, level). If an event occurred +between the last disabling of hard IRQs and the write to the event +source registers, a bit would be set in the GPIO event detect register +(GPEDSn) which goes unacknowledged by bcm2835_gpio_irq_handler() +so Linux complains loudly. + +There is no per-GPIO mask register, so when disabling GPIO interrupts +write 1 to the relevant bit in GPEDSn to clear out any stale events. + +Signed-off-by: Jonathan Bell +Acked-by: Stephen Warren +Signed-off-by: Linus Walleij +--- + drivers/pinctrl/bcm/pinctrl-bcm2835.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +index 986779a..61ef002 100644 +--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c ++++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +@@ -503,6 +503,8 @@ static void bcm2835_gpio_irq_disable(struct irq_data *data) + + spin_lock_irqsave(&pc->irq_lock[bank], flags); + bcm2835_gpio_irq_config(pc, gpio, false); ++ /* Clear events that were latched prior to clearing event sources */ ++ bcm2835_gpio_set_bit(pc, GPEDS0, gpio); + clear_bit(offset, &pc->enabled_irq_map[bank]); + spin_unlock_irqrestore(&pc->irq_lock[bank], flags); + } + +From 8dcf91adc86b5ee16627c8fe777b4e2f5ca4efc1 Mon Sep 17 00:00:00 2001 +From: P33M +Date: Tue, 4 Aug 2015 01:15:20 +0100 +Subject: [PATCH 149/149] dwc_otg: fiq_fsm: Make high-speed isochronous strided + transfers work properly + +Certain low-bandwidth high-speed USB devices (specialist audio devices, +compressed-frame webcams) have packet intervals > 1 microframe. + +Stride these transfers in the FIQ by using the start-of-frame interrupt +to restart the channel at the right time. +--- + drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c | 17 +++++++++++++---- + drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h | 5 ++++- + drivers/usb/host/dwc_otg/dwc_otg_hcd.c | 7 ++++++- + drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 6 ++++-- + 4 files changed, 27 insertions(+), 8 deletions(-) + +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c +index 7e0c726..85d82f3 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c +@@ -615,8 +615,11 @@ static int notrace noinline fiq_fsm_do_sof(struct fiq_state *state, int num_chan + break; + + case FIQ_HS_ISOC_SLEEPING: +- state->channel[n].fsm = FIQ_HS_ISOC_TURBO; +- fiq_fsm_restart_channel(state, n, 0); ++ /* Is it time to wake this channel yet? */ ++ if (--state->channel[n].uframe_sleeps == 0) { ++ state->channel[n].fsm = FIQ_HS_ISOC_TURBO; ++ fiq_fsm_restart_channel(state, n, 0); ++ } + break; + + case FIQ_PER_SSPLIT_QUEUED: +@@ -624,7 +627,7 @@ static int notrace noinline fiq_fsm_do_sof(struct fiq_state *state, int num_chan + break; + if(!fiq_fsm_tt_in_use(state, num_channels, n)) { + if (!fiq_fsm_too_late(state, n)) { +- fiq_print(FIQDBG_INT, st, "SOF GO %01d", n); ++ fiq_print(FIQDBG_INT, state, "SOF GO %01d", n); + fiq_fsm_restart_channel(state, n, 0); + state->channel[n].fsm = FIQ_PER_SSPLIT_STARTED; + } else { +@@ -1069,8 +1072,14 @@ static int notrace noinline fiq_fsm_do_hcintr(struct fiq_state *state, int num_c + if (fiq_fsm_update_hs_isoc(state, n, hcint)) { + /* more transactions to come */ + handled = 1; +- restart = 1; + fiq_print(FIQDBG_INT, state, "HSISO M "); ++ /* For strided transfers, put ourselves to sleep */ ++ if (st->hs_isoc_info.stride > 1) { ++ st->uframe_sleeps = st->hs_isoc_info.stride - 1; ++ st->fsm = FIQ_HS_ISOC_SLEEPING; ++ } else { ++ restart = 1; ++ } + } else { + st->fsm = FIQ_HS_ISOC_DONE; + fiq_print(FIQDBG_INT, state, "HSISO F "); +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h +index 8455324..f9fddfb 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h ++++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h +@@ -260,12 +260,13 @@ struct fiq_dma_blob { + * @iso_frame: Pointer to the array of OTG URB iso_frame_descs. + * @nrframes: Total length of iso_frame_desc array + * @index: Current index (FIQ-maintained) +- * ++ * @stride: Interval in uframes between HS isoc transactions + */ + struct fiq_hs_isoc_info { + struct dwc_otg_hcd_iso_packet_desc *iso_desc; + unsigned int nrframes; + unsigned int index; ++ unsigned int stride; + }; + + /** +@@ -296,6 +297,8 @@ struct fiq_channel_state { + /* Hardware bug workaround: sometimes channel halt interrupts are + * delayed until the next SOF. Keep track of when we expected to get interrupted. */ + unsigned int expected_uframe; ++ /* number of uframes remaining (for interval > 1 HS isoc transfers) before next transfer */ ++ unsigned int uframe_sleeps; + /* in/out for communicating number of dma buffers used, or number of ISOC to do */ + unsigned int nrpackets; + struct fiq_dma_info dma_info; +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c +index 4d7c7bb..135b611 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c +@@ -1678,6 +1678,9 @@ int fiq_fsm_queue_isoc_transaction(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) + } + } + ++ st->hs_isoc_info.stride = qh->interval; ++ st->uframe_sleeps = 0; ++ + fiq_print(FIQDBG_INT, hcd->fiq_state, "FSMQ %01d ", hc->hc_num); + fiq_print(FIQDBG_INT, hcd->fiq_state, "%08x", st->hcchar_copy.d32); + fiq_print(FIQDBG_INT, hcd->fiq_state, "%08x", st->hctsiz_copy.d32); +@@ -1692,9 +1695,11 @@ int fiq_fsm_queue_isoc_transaction(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) + DWC_WRITE_REG32(&hc_regs->hcintmsk, st->hcintmsk_copy.d32); + if (hfnum.b.frrem < PERIODIC_FRREM_BACKOFF) { + /* Prevent queueing near EOF1. Bad things happen if a periodic +- * split transaction is queued very close to EOF. ++ * split transaction is queued very close to EOF. SOF interrupt handler ++ * will wake this channel at the next interrupt. + */ + st->fsm = FIQ_HS_ISOC_SLEEPING; ++ st->uframe_sleeps = 1; + } else { + st->fsm = FIQ_HS_ISOC_TURBO; + st->hcchar_copy.b.chen = 1; +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +index 3f71f29..8db3dfc 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +@@ -2297,10 +2297,10 @@ void dwc_otg_fiq_unmangle_isoc(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh, dwc_otg_qtd + dwc_urb->error_count++; + } + } ++ qh->sched_frame = dwc_frame_num_inc(qh->sched_frame, qh->interval * (nr_frames - 1)); ++ + //printk_ratelimited(KERN_INFO "%s: HS isochronous of %d/%d frames with %d errors complete\n", + // __FUNCTION__, i, dwc_urb->packet_count, dwc_urb->error_count); +- hcd->fops->complete(hcd, dwc_urb->priv, dwc_urb, 0); +- release_channel(hcd, qh->channel, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); + } + + /** +@@ -2543,6 +2543,8 @@ void dwc_otg_hcd_handle_hc_fsm(dwc_otg_hcd_t *hcd, uint32_t num) + * fail. + */ + dwc_otg_fiq_unmangle_isoc(hcd, qh, qtd, num); ++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); + break; + + case FIQ_PER_SPLIT_LS_ABORTED: diff --git a/projects/RPi2/linux/linux.arm.conf b/projects/RPi2/linux/linux.arm.conf index bd727de916..332675965d 100644 --- a/projects/RPi2/linux/linux.arm.conf +++ b/projects/RPi2/linux/linux.arm.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 4.1.0-rc8 Kernel Configuration +# Linux/arm 4.1.2 Kernel Configuration # CONFIG_ARM=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y @@ -1150,7 +1150,7 @@ CONFIG_PHYLIB=y # CONFIG_MDIO_BUS_MUX_MMIOREG is not set # CONFIG_MDIO_BCM_UNIMAC is not set # CONFIG_MICREL_KS8995MA is not set -CONFIG_PPP=y +CONFIG_PPP=m CONFIG_PPP_BSDCOMP=m CONFIG_PPP_DEFLATE=m # CONFIG_PPP_FILTER is not set @@ -1160,7 +1160,7 @@ CONFIG_PPPOE=m CONFIG_PPP_ASYNC=m # CONFIG_PPP_SYNC_TTY is not set # CONFIG_SLIP is not set -CONFIG_SLHC=y +CONFIG_SLHC=m CONFIG_USB_NET_DRIVERS=y # CONFIG_USB_CATC is not set # CONFIG_USB_KAWETH is not set @@ -1341,6 +1341,7 @@ CONFIG_INPUT_JOYSTICK=y CONFIG_JOYSTICK_XPAD=m CONFIG_JOYSTICK_XPAD_FF=y CONFIG_JOYSTICK_XPAD_LEDS=y +# CONFIG_JOYSTICK_RPISENSE is not set # CONFIG_INPUT_TABLET is not set # CONFIG_INPUT_TOUCHSCREEN is not set CONFIG_INPUT_MISC=y @@ -1433,6 +1434,7 @@ CONFIG_HW_RANDOM_BCM2708=m CONFIG_BRCM_CHAR_DRIVERS=y CONFIG_BCM_VC_CMA=y CONFIG_BCM2708_VCMEM=y +CONFIG_BCM_VCIO=y CONFIG_BCM_VC_SM=y # CONFIG_XILLYBUS is not set @@ -1834,6 +1836,7 @@ CONFIG_BCMA_DRIVER_GMAC_CMN=y # Multifunction device drivers # CONFIG_MFD_CORE=y +# CONFIG_MFD_RPISENSE_CORE is not set # CONFIG_MFD_AS3711 is not set # CONFIG_MFD_AS3722 is not set # CONFIG_PMIC_ADP5520 is not set @@ -2357,6 +2360,7 @@ CONFIG_FB_BCM2708=y # CONFIG_FB_AUO_K190X is not set # CONFIG_FB_SIMPLE is not set # CONFIG_FB_SSD1307 is not set +# CONFIG_FB_RPISENSE is not set # CONFIG_BACKLIGHT_LCD_SUPPORT is not set # CONFIG_VGASTATE is not set @@ -2507,7 +2511,7 @@ CONFIG_SND_SOC_WM8731=m # CONFIG_SND_SOC_WM8770 is not set # CONFIG_SND_SOC_WM8776 is not set CONFIG_SND_SOC_WM8804=m -# CONFIG_SND_SOC_WM8804_I2C is not set +CONFIG_SND_SOC_WM8804_I2C=m # CONFIG_SND_SOC_WM8804_SPI is not set # CONFIG_SND_SOC_WM8903 is not set # CONFIG_SND_SOC_WM8962 is not set @@ -3073,6 +3077,7 @@ CONFIG_BCM2708_MBOX=y # CONFIG_ARM_MHU is not set # CONFIG_PL320_MBOX is not set # CONFIG_ALTERA_MBOX is not set +CONFIG_BCM2835_MBOX=y # CONFIG_IOMMU_SUPPORT is not set # @@ -3087,7 +3092,6 @@ CONFIG_BCM2708_MBOX=y # # SOC (System On Chip) specific Drivers # -CONFIG_BCM2708_POWER=y # CONFIG_SOC_TI is not set # CONFIG_PM_DEVFREQ is not set CONFIG_EXTCON=m @@ -3125,6 +3129,7 @@ CONFIG_IRQCHIP=y # Firmware Drivers # # CONFIG_FIRMWARE_MEMMAP is not set +CONFIG_RASPBERRYPI_FIRMWARE=y # # File systems diff --git a/projects/RPi2/patches/kodi/kodi-001-isengard-rpb-backports.patch b/projects/RPi2/patches/kodi/kodi-001-isengard-rpb-backports.patch index e1ec4be1b1..0699fba75b 100644 --- a/projects/RPi2/patches/kodi/kodi-001-isengard-rpb-backports.patch +++ b/projects/RPi2/patches/kodi/kodi-001-isengard-rpb-backports.patch @@ -1,7 +1,7 @@ -From d4dbab9f0c3bc4ab02ba312ba0d4aa9f41371fdf Mon Sep 17 00:00:00 2001 +From fca20ce71da054984d648316b362c9318dfeab10 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 7 Apr 2014 18:19:32 +0100 -Subject: [PATCH 01/58] [rbp/omxplayer] When opening a stream don't try to +Subject: [PATCH 01/87] [rbp/omxplayer] When opening a stream don't try to update gui so often --- @@ -9,7 +9,7 @@ Subject: [PATCH 01/58] [rbp/omxplayer] When opening a stream don't try to 1 file changed, 4 insertions(+) diff --git a/xbmc/dialogs/GUIDialogBusy.cpp b/xbmc/dialogs/GUIDialogBusy.cpp -index 2faceea..889d7a2 100644 +index 318ecec..59698f6 100644 --- a/xbmc/dialogs/GUIDialogBusy.cpp +++ b/xbmc/dialogs/GUIDialogBusy.cpp @@ -68,7 +68,11 @@ bool CGUIDialogBusy::WaitOnEvent(CEvent &event, unsigned int displaytime /* = 10 @@ -25,10 +25,10 @@ index 2faceea..889d7a2 100644 g_windowManager.ProcessRenderLoop(false); if (allowCancel && dialog->IsCanceled()) -From 1ecf22c5b4c919e3aed5274c67f748bbae86fbf0 Mon Sep 17 00:00:00 2001 +From cda1cae0c13be8b8db75d61f64879291a994426c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 8 Mar 2014 15:36:06 +0000 -Subject: [PATCH 03/58] [hifiberry] Hack: force it to be recognised as IEC958 +Subject: [PATCH 03/87] [hifiberry] Hack: force it to be recognised as IEC958 capable to enable passthrough options --- @@ -51,10 +51,10 @@ index e22db7a..0120bd5 100644 info.m_displayName.substr(info.m_displayName.size()-5) == " HDMI") { -From ac054e5b5efd9ec9205598f9b7549a8e953272fd Mon Sep 17 00:00:00 2001 +From b8992693e016eed3d5e89ddc437aa4c59b561d13 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Thu, 1 May 2014 16:28:39 +0100 -Subject: [PATCH 04/58] Improved file buffering in CArchive +Subject: [PATCH 04/87] Improved file buffering in CArchive Even though memcpy is typically inlined by the compiler into byte/word loads and stores (at least for release builds), the frequency with which 1, 2 and 4 @@ -114,20 +114,20 @@ index 6ed0f8f..8506d95 100644 } else -From 1a7d63a938850a884f08bd3af66808bef91b7588 Mon Sep 17 00:00:00 2001 +From 396257e8ed99f16e3088a650f47d1356410ae912 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 12 Aug 2014 00:31:36 +0100 -Subject: [PATCH 05/58] [omxcodec] Don't force software codec with dvds +Subject: [PATCH 05/87] [omxcodec] Don't force software codec with dvds --- xbmc/cores/dvdplayer/DVDPlayer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 82b5baa..70b1ac3 100644 +index 7c84557..87463a7 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -3421,7 +3421,9 @@ bool CDVDPlayer::OpenVideoStream(CDVDStreamInfo& hint, bool reset) +@@ -3417,7 +3417,9 @@ bool CDVDPlayer::OpenVideoStream(CDVDStreamInfo& hint, bool reset) hint.aspect = aspect; hint.forced_aspect = true; } @@ -138,10 +138,10 @@ index 82b5baa..70b1ac3 100644 else if (m_pInputStream && m_pInputStream->IsStreamType(DVDSTREAM_TYPE_PVRMANAGER)) { -From 47e9b3430cd67a4e9e17de65df96f9c0dbb7c39c Mon Sep 17 00:00:00 2001 +From c44cf37f3ab1c1b836044c503f51609190c6d1cc Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 10 Aug 2014 16:45:16 +0100 -Subject: [PATCH 06/58] filesystem: Make support of browsing into archives +Subject: [PATCH 06/87] filesystem: Make support of browsing into archives optional The ability to browse, scan and play content in archives can cause problems on low powered/low memory devices. @@ -159,10 +159,10 @@ We'll let people who don't use archives disable it manually 3 files changed, 18 insertions(+) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index ff32bfd..5345dc2 100644 +index faf423c..52117a2 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16582,6 +16582,15 @@ msgstr "" +@@ -16605,6 +16605,15 @@ msgstr "" #: system/settings/rbp.xml msgctxt "#38010" msgid "GPU accelerated" @@ -179,7 +179,7 @@ index ff32bfd..5345dc2 100644 #. Setting #38011 "Videos -> Library -> Show All Items entry" diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 8f69bcb..cbcde85 100644 +index 3ef33e0..10e8552 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -304,6 +304,11 @@ @@ -224,10 +224,10 @@ index 5af92e7..568a1a8 100644 { // XBMC Smart playlist - just XML renamed to XSP // read the name of the playlist in -From e863fd0253902d92c56ed85e589bffadc98b245f Mon Sep 17 00:00:00 2001 +From 39ca696d7683f645fab217a4971e8f884f0f4bfc Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 27 Oct 2014 13:06:57 +0000 -Subject: [PATCH 08/58] [rbp] Make cachemembuffersize default depend on memory +Subject: [PATCH 08/87] [rbp] Make cachemembuffersize default depend on memory size --- @@ -329,10 +329,11 @@ index 2e3282c..d1606a2 100644 } -From 06bd0674846783738e6b81f351ba49bb633c473b Mon Sep 17 00:00:00 2001 + +From f9d47dcf9d04a28308404a77b516e28d57b97f2a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 30 May 2014 14:58:43 +0100 -Subject: [PATCH 10/58] [settings] Experiment: Report DESKTOP resolution in +Subject: [PATCH 10/87] [settings] Experiment: Report DESKTOP resolution in video settings --- @@ -354,10 +355,10 @@ index 4376463..fc4e5ea 100644 StringUtils::Format("%dx%d%s", resolution->width, resolution->height, ModeFlagsToString(resolution->flags, false).c_str()), -From c2b0eafa1ed07258aa09a24a443d4535db8b3a1e Mon Sep 17 00:00:00 2001 +From 76c5fd374e30835b61684da8a62ed6c6ddefa4cb Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 9 Sep 2014 12:04:26 +0100 -Subject: [PATCH 11/58] egl: Treat unknown display aspect ratio as square pixel +Subject: [PATCH 11/87] egl: Treat unknown display aspect ratio as square pixel --- xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 4 ++-- @@ -386,10 +387,10 @@ index bda7430..68fc647 100644 SetResolutionString(m_desktopRes); -From 5f1821e4d8157a890c795744841dcb895a1349b4 Mon Sep 17 00:00:00 2001 +From af06dc9a5a99bcf774a760bf46f88989ae03c6c4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 19 Sep 2014 11:54:49 +0100 -Subject: [PATCH 12/58] [dvdplayer/rbp] Add pi specific option to maintain +Subject: [PATCH 12/87] [dvdplayer/rbp] Add pi specific option to maintain vsync with pll adjustment New A/V sync option in settings/video/playback to do "Adjust PLL". @@ -414,7 +415,7 @@ Needed updated firmware 9 files changed, 91 insertions(+), 7 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 5345dc2..6d08156 100644 +index 52117a2..530b3d4 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -6321,7 +6321,22 @@ msgctxt "#13459" @@ -441,7 +442,7 @@ index 5345dc2..6d08156 100644 #: system/settings/settings.xml msgctxt "#13505" -@@ -16628,3 +16643,10 @@ msgstr "" +@@ -16651,3 +16666,10 @@ msgstr "" msgctxt "#38016" msgid "%d fps" msgstr "" @@ -453,7 +454,7 @@ index 5345dc2..6d08156 100644 +msgstr "" + diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index cbcde85..a3d4728 100644 +index 10e8552..f493675 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -572,6 +572,20 @@ @@ -681,10 +682,10 @@ index 7df1bf7..732b69d 100644 float m_audioPlayCountMinimumPercent; bool m_dvdplayerIgnoreDTSinWAV; -From 6ead5d132f5d43c6ea3063c5fcd1c7d3b23eca18 Mon Sep 17 00:00:00 2001 +From 855155cecdc39ff1586f84cec624bdbc1689ad41 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 24 Sep 2014 23:13:52 +0100 -Subject: [PATCH 13/58] [audio] Add settings option to boost centre channel +Subject: [PATCH 13/87] [audio] Add settings option to boost centre channel when downmixing This allows a dB volume increase to be added to centre channel. @@ -702,10 +703,10 @@ Should work with Pi Sink (dvdplayer/paplayer) and omxplayer 5 files changed, 45 insertions(+) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 6d08156..6e36b42 100644 +index 530b3d4..bedbd87 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16650,3 +16650,17 @@ msgctxt "#38006" +@@ -16673,3 +16673,17 @@ msgctxt "#38006" msgid "Audio has to stay in sync, this can either be done by resampling, or adjusting the PLL" msgstr "" @@ -724,7 +725,7 @@ index 6d08156..6e36b42 100644 +msgid "%i dB" +msgstr "" diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index a3d4728..09c3d10 100644 +index f493675..4843ab8 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -2597,6 +2597,18 @@ @@ -806,10 +807,10 @@ index f99c0e6..1911189 100644 // stereo upmix if (upmix && m_src_channels == 2 && m_dst_channels > 2) -From aca0d43f243143b6776e1cc8ef259197d2bee97a Mon Sep 17 00:00:00 2001 +From e46c99c1b4d75dd9f162d80c9cec1ebf1a8d3074 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 27 Oct 2014 15:23:51 +0000 -Subject: [PATCH 14/58] [rbp] Default extract thumbnails to false +Subject: [PATCH 14/87] [rbp] Default extract thumbnails to false It can take 80 seconds for a single file on a Pi. It can cause crashes with out-of-memory errors. It genereates a lot of support issues. Best to default to disabled and let users enable it if they must @@ -839,10 +840,1065 @@ index 50fe36a..a54a4c4 100644
-From 35f0f171ab8a9c37b2ebb5aca81b2242834fda72 Mon Sep 17 00:00:00 2001 +From b860125828104f62039468f8af95cd8b82fedaa5 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 10 Feb 2015 15:29:16 +0000 +Subject: [PATCH 15/87] [libcec] Add repeating keypress patch from popcornmix' + repo + +--- + tools/depends/target/libcec/Makefile | 1 + + tools/depends/target/libcec/popcornmix.patch | 859 +++++++++++++++++++++++++++ + 2 files changed, 860 insertions(+) + create mode 100644 tools/depends/target/libcec/popcornmix.patch + +diff --git a/tools/depends/target/libcec/Makefile b/tools/depends/target/libcec/Makefile +index f54af9e..ddf9963 100644 +--- a/tools/depends/target/libcec/Makefile ++++ b/tools/depends/target/libcec/Makefile +@@ -21,6 +21,7 @@ $(TARBALLS_LOCATION)/$(ARCHIVE): + $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) + rm -rf $(PLATFORM); mkdir -p $(PLATFORM)/build + cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) ++ cd $(PLATFORM); patch -p1 < ../popcornmix.patch + cd $(PLATFORM)/build; $(CMAKE) -DBUILD_SHARED_LIBS=1 -DSKIP_PYTHON_WRAPPER:STRING=1 -DCMAKE_INSTALL_LIBDIR=$(PREFIX)/lib .. + + $(LIBDYLIB): $(PLATFORM) +diff --git a/tools/depends/target/libcec/popcornmix.patch b/tools/depends/target/libcec/popcornmix.patch +new file mode 100644 +index 0000000..8366a69 +--- /dev/null ++++ b/tools/depends/target/libcec/popcornmix.patch +@@ -0,0 +1,859 @@ ++From ec982e9800ae312972d306b67779215a2add6cde Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Fri, 24 Oct 2014 13:45:21 +0100 ++Subject: [PATCH 1/6] Make released key polling wait for exact time until key ++ gets released ++ ++--- ++ src/libcec/CECClient.cpp | 16 ++++++++++++++-- ++ src/libcec/CECClient.h | 2 +- ++ src/libcec/CECProcessor.cpp | 8 +++++--- ++ src/libcec/LibCEC.cpp | 10 ++++++++-- ++ src/libcec/LibCEC.h | 4 +++- ++ 5 files changed, 31 insertions(+), 9 deletions(-) ++ ++diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp ++index 35c2d3e..e307c0e 100644 ++--- a/src/libcec/CECClient.cpp +++++ b/src/libcec/CECClient.cpp ++@@ -1067,7 +1067,7 @@ void CCECClient::SetCurrentButton(const cec_user_control_code iButtonCode) ++ AddKey(key); ++ } ++ ++-void CCECClient::CheckKeypressTimeout(void) +++uint16_t CCECClient::CheckKeypressTimeout(void) ++ { ++ cec_keypress key; ++ ++@@ -1091,12 +1091,24 @@ void CCECClient::CheckKeypressTimeout(void) ++ } ++ else ++ { ++- return; +++ // time when this keypress will be released and we'd like to be called again +++ unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; +++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) +++ timeout = iTimeoutMs - (iNow - m_buttontime) + 1; +++ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey) +++ timeout = CEC_BUTTON_TIMEOUT - (iNow - m_buttontime) + 1; +++ if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) +++ { +++ LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_buttontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); +++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; +++ } +++ return timeout; ++ } ++ } ++ ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key auto-released: %s (%1x)", ToString(key.keycode), key.keycode); ++ QueueAddKey(key); +++ return CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ } ++ ++ bool CCECClient::EnableCallbacks(void *cbParam, ICECCallbacks *callbacks) ++diff --git a/src/libcec/CECClient.h b/src/libcec/CECClient.h ++index 12f8a3b..c9ce5e3 100644 ++--- a/src/libcec/CECClient.h +++++ b/src/libcec/CECClient.h ++@@ -272,7 +272,7 @@ namespace CEC ++ virtual void AddKey(bool bSendComboKey = false); ++ virtual void AddKey(const cec_keypress &key); ++ virtual void SetCurrentButton(const cec_user_control_code iButtonCode); ++- virtual void CheckKeypressTimeout(void); +++ virtual uint16_t CheckKeypressTimeout(void); ++ virtual void SourceActivated(const cec_logical_address logicalAddress); ++ virtual void SourceDeactivated(const cec_logical_address logicalAddress); ++ ++diff --git a/src/libcec/CECProcessor.cpp b/src/libcec/CECProcessor.cpp ++index 99f71aa..604b950 100644 ++--- a/src/libcec/CECProcessor.cpp +++++ b/src/libcec/CECProcessor.cpp ++@@ -52,7 +52,6 @@ ++ using namespace CEC; ++ using namespace PLATFORM; ++ ++-#define CEC_PROCESSOR_SIGNAL_WAIT_TIME 1000 ++ #define ACTIVE_SOURCE_CHECK_INTERVAL 500 ++ #define TV_PRESENT_CHECK_INTERVAL 30000 ++ ++@@ -260,6 +259,7 @@ bool CCECProcessor::OnCommandReceived(const cec_command &command) ++ ++ void *CCECProcessor::Process(void) ++ { +++ uint16_t timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ m_libcec->AddLog(CEC_LOG_DEBUG, "processor thread started"); ++ ++ if (!m_connCheck) ++@@ -274,13 +274,13 @@ void *CCECProcessor::Process(void) ++ while (!IsStopped() && m_communication->IsOpen()) ++ { ++ // wait for a new incoming command, and process it ++- if (m_inBuffer.Pop(command, CEC_PROCESSOR_SIGNAL_WAIT_TIME)) +++ if (m_inBuffer.Pop(command, timeout)) ++ ProcessCommand(command); ++ ++ if (CECInitialised() && !IsStopped()) ++ { ++ // check clients for keypress timeouts ++- m_libcec->CheckKeypressTimeout(); +++ timeout = m_libcec->CheckKeypressTimeout(); ++ ++ // check if we need to replace handlers ++ ReplaceHandlers(); ++@@ -311,6 +311,8 @@ void *CCECProcessor::Process(void) ++ tvPresentCheck.Init(TV_PRESENT_CHECK_INTERVAL); ++ } ++ } +++ else +++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ } ++ ++ return NULL; ++diff --git a/src/libcec/LibCEC.cpp b/src/libcec/LibCEC.cpp ++index af36b79..5ccb8dd 100644 ++--- a/src/libcec/LibCEC.cpp +++++ b/src/libcec/LibCEC.cpp ++@@ -361,11 +361,17 @@ bool CLibCEC::IsValidPhysicalAddress(uint16_t iPhysicalAddress) ++ iPhysicalAddress <= CEC_MAX_PHYSICAL_ADDRESS; ++ } ++ ++-void CLibCEC::CheckKeypressTimeout(void) +++uint16_t CLibCEC::CheckKeypressTimeout(void) ++ { +++ uint16_t timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ // check all clients ++ for (std::vector::iterator it = m_clients.begin(); it != m_clients.end(); it++) ++- (*it)->CheckKeypressTimeout(); +++ { +++ uint16_t t = (*it)->CheckKeypressTimeout(); +++ if (t < timeout) +++ timeout = t; +++ } +++ return timeout; ++ } ++ ++ void CLibCEC::AddLog(const cec_log_level level, const char *strFormat, ...) ++diff --git a/src/libcec/LibCEC.h b/src/libcec/LibCEC.h ++index 6d9a229..d9d1e7b 100644 ++--- a/src/libcec/LibCEC.h +++++ b/src/libcec/LibCEC.h ++@@ -39,6 +39,8 @@ ++ #include "CECTypeUtils.h" ++ #include ++ +++#define CEC_PROCESSOR_SIGNAL_WAIT_TIME 1000 +++ ++ namespace CEC ++ { ++ class CAdapterCommunication; ++@@ -125,7 +127,7 @@ namespace CEC ++ ++ void AddLog(const cec_log_level level, const char *strFormat, ...); ++ void AddCommand(const cec_command &command); ++- void CheckKeypressTimeout(void); +++ uint16_t CheckKeypressTimeout(void); ++ void Alert(const libcec_alert type, const libcec_parameter ¶m); ++ ++ static bool IsValidPhysicalAddress(uint16_t iPhysicalAddress); ++-- ++1.9.1 ++ ++ ++From 41f0f3ec9ac136da3565c96fd5a7075499f3938d Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Fri, 24 Oct 2014 13:51:34 +0100 ++Subject: [PATCH 2/6] Keep track of time since initial button press and last ++ button update ++ ++--- ++ src/libcec/CECClient.cpp | 44 +++++++++++++++++++++++++++----------------- ++ src/libcec/CECClient.h | 3 ++- ++ 2 files changed, 29 insertions(+), 18 deletions(-) ++ ++diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp ++index e307c0e..e7935b9 100644 ++--- a/src/libcec/CECClient.cpp +++++ b/src/libcec/CECClient.cpp ++@@ -54,7 +54,8 @@ CCECClient::CCECClient(CCECProcessor *processor, const libcec_configuration &con ++ m_bInitialised(false), ++ m_bRegistered(false), ++ m_iCurrentButton(CEC_USER_CONTROL_CODE_UNKNOWN), ++- m_buttontime(0), +++ m_initialButtontime(0), +++ m_updateButtontime(0), ++ m_iPreventForwardingPowerOffCommand(0), ++ m_iLastKeypressTime(0) ++ { ++@@ -981,9 +982,10 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */) ++ CLockObject lock(m_mutex); ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN) ++ { ++- key.duration = (unsigned int) (GetTimeMs() - m_buttontime); +++ unsigned int duration = (unsigned int) (GetTimeMs() - m_updateButtontime); +++ key.duration = (unsigned int) (GetTimeMs() - m_initialButtontime); ++ ++- if (key.duration > m_configuration.iComboKeyTimeoutMs || +++ if (duration > m_configuration.iComboKeyTimeoutMs || ++ m_configuration.iComboKeyTimeoutMs == 0 || ++ m_iCurrentButton != m_configuration.comboKey || ++ bSendComboKey) ++@@ -991,14 +993,15 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */) ++ key.keycode = m_iCurrentButton; ++ ++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; ++- m_buttontime = 0; +++ m_initialButtontime = 0; +++ m_updateButtontime = 0; ++ } ++ } ++ } ++ ++ if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) ++ { ++- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key released: %s (%1x)", ToString(key.keycode), key.keycode); +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key released: %s (%1x) D:%dms", ToString(key.keycode), key.keycode, key.duration); ++ QueueAddKey(key); ++ } ++ } ++@@ -1012,7 +1015,7 @@ void CCECClient::AddKey(const cec_keypress &key) ++ AddKey(); ++ return; ++ } ++- +++ bool isrepeat = false; ++ cec_keypress transmitKey(key); ++ cec_user_control_code comboKey(m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5) ? ++ m_configuration.comboKey : CEC_USER_CONTROL_CODE_STOP); ++@@ -1035,22 +1038,27 @@ void CCECClient::AddKey(const cec_keypress &key) ++ AddKey(true); ++ } ++ +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x) current(%lx) duration(%d)", ToString(transmitKey.keycode), transmitKey.keycode, m_iCurrentButton, key.duration); +++ ++ if (m_iCurrentButton == key.keycode) ++ { ++- m_buttontime = GetTimeMs(); +++ m_updateButtontime = GetTimeMs(); +++ isrepeat = true; ++ } ++ else ++ { ++- AddKey(); +++ if (m_iCurrentButton != transmitKey.keycode) +++ AddKey(); ++ if (key.duration == 0) ++ { ++ m_iCurrentButton = transmitKey.keycode; ++- m_buttontime = m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN || key.duration > 0 ? 0 : GetTimeMs(); +++ m_initialButtontime = m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN || key.duration > 0 ? 0 : GetTimeMs(); +++ m_updateButtontime = m_initialButtontime; ++ } ++ } ++ } ++ ++- if (key.keycode != comboKey || key.duration > 0) +++ if (!isrepeat && (key.keycode != comboKey || key.duration > 0)) ++ { ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x)", ToString(transmitKey.keycode), transmitKey.keycode); ++ QueueAddKey(transmitKey); ++@@ -1074,32 +1082,34 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ { ++ CLockObject lock(m_mutex); ++ uint64_t iNow = GetTimeMs(); +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s T:%.3f", __FUNCTION__, iNow*1e-3); ++ cec_user_control_code comboKey(m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5) ? ++ m_configuration.comboKey : CEC_USER_CONTROL_CODE_STOP); ++ uint32_t iTimeoutMs(m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5) ? ++ m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); ++ ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++- ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_buttontime > iTimeoutMs) || ++- (m_iCurrentButton != comboKey && iNow - m_buttontime > CEC_BUTTON_TIMEOUT))) +++ ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime > iTimeoutMs) || +++ (m_iCurrentButton != comboKey && iNow - m_updateButtontime > CEC_BUTTON_TIMEOUT))) ++ { ++- key.duration = (unsigned int) (iNow - m_buttontime); +++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = m_iCurrentButton; ++ ++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; ++- m_buttontime = 0; +++ m_initialButtontime = 0; +++ m_updateButtontime = 0; ++ } ++ else ++ { ++ // time when this keypress will be released and we'd like to be called again ++ unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) ++- timeout = iTimeoutMs - (iNow - m_buttontime) + 1; +++ timeout = iTimeoutMs - (iNow - m_updateButtontime) + 1; ++ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey) ++- timeout = CEC_BUTTON_TIMEOUT - (iNow - m_buttontime) + 1; +++ timeout = CEC_BUTTON_TIMEOUT - (iNow - m_updateButtontime) + 1; ++ if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) ++ { ++- LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_buttontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); +++ LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_updateButtontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); ++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ } ++ return timeout; ++diff --git a/src/libcec/CECClient.h b/src/libcec/CECClient.h ++index c9ce5e3..611c68b 100644 ++--- a/src/libcec/CECClient.h +++++ b/src/libcec/CECClient.h ++@@ -404,7 +404,8 @@ namespace CEC ++ PLATFORM::CMutex m_mutex; /**< mutex for changes to this instance */ ++ PLATFORM::CMutex m_cbMutex; /**< mutex that is held when doing anything with callbacks */ ++ cec_user_control_code m_iCurrentButton; /**< the control code of the button that's currently held down (if any) */ ++- int64_t m_buttontime; /**< the timestamp when the button was pressed (in seconds since epoch), or 0 if none was pressed. */ +++ int64_t m_initialButtontime; /**< the timestamp when the button was initially pressed (in seconds since epoch), or 0 if none was pressed. */ +++ int64_t m_updateButtontime; /**< the timestamp when the button was updated (in seconds since epoch), or 0 if none was pressed. */ ++ int64_t m_iPreventForwardingPowerOffCommand; /**< prevent forwarding standby commands until this time */ ++ int64_t m_iLastKeypressTime; /**< last time a key press was sent to the client */ ++ cec_keypress m_lastKeypress; /**< the last key press that was sent to the client */ ++-- ++1.9.1 ++ ++ ++From 273ead6980b69eddf98810eb1eb33d94a7d74fce Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Tue, 28 Oct 2014 00:09:18 +0000 ++Subject: [PATCH 3/6] Support repeating button presses with configurable repeat ++ rate ++ ++--- ++ include/cectypes.h | 6 ++ ++ src/libcec/CECClient.cpp | 100 +++++++++++++++++++---- ++ src/libcec/CECClient.h | 6 +- ++ src/libcec/implementations/CECCommandHandler.cpp | 2 +- ++ 4 files changed, 96 insertions(+), 18 deletions(-) ++ ++diff --git a/include/cectypes.h b/include/cectypes.h ++index acff259..8f098ef 100644 ++--- a/include/cectypes.h +++++ b/include/cectypes.h ++@@ -1493,6 +1493,8 @@ struct libcec_configuration ++ XXX changed meaning in 2.2.0 to not break binary compatibility. next major (3.0) release will fix it in a nicer way */ ++ cec_user_control_code comboKey; /*!< key code that initiates combo keys. defaults to CEC_USER_CONTROL_CODE_F1_BLUE. CEC_USER_CONTROL_CODE_UNKNOWN to disable. added in 2.0.5 */ ++ uint32_t iComboKeyTimeoutMs; /*!< timeout until the combo key is sent as normal keypress */ +++ uint32_t iButtonRepeatRateMs; /*!< rate at which buttons autorepeat. 0 means rely on CEC device */ +++ uint32_t iButtonReleaseDelayMs;/*!< duration after last update until a button is considered released */ ++ ++ #ifdef __cplusplus ++ libcec_configuration(void) { Clear(); } ++@@ -1527,6 +1529,8 @@ struct libcec_configuration ++ cecVersion == other.cecVersion && ++ adapterType == other.adapterType && ++ iDoubleTapTimeout50Ms == other.iDoubleTapTimeout50Ms && +++ iButtonRepeatRateMs == other.iButtonRepeatRateMs && +++ iButtonReleaseDelayMs == other.iButtonReleaseDelayMs && ++ (other.clientVersion <= LIBCEC_VERSION_TO_UINT(2, 0, 4) || comboKey == other.comboKey) && ++ (other.clientVersion <= LIBCEC_VERSION_TO_UINT(2, 0, 4) || iComboKeyTimeoutMs == other.iComboKeyTimeoutMs) && ++ (other.clientVersion < LIBCEC_VERSION_TO_UINT(2, 1, 0) || bPowerOnScreensaver == other.bPowerOnScreensaver)); ++@@ -1567,6 +1571,8 @@ struct libcec_configuration ++ iDoubleTapTimeout50Ms = CEC_DOUBLE_TAP_TIMEOUT_50_MS; ++ comboKey = CEC_USER_CONTROL_CODE_STOP; ++ iComboKeyTimeoutMs = CEC_DEFAULT_COMBO_TIMEOUT_MS; +++ iButtonRepeatRateMs = 0; +++ iButtonReleaseDelayMs = CEC_BUTTON_TIMEOUT; ++ ++ memset(strDeviceName, 0, 13); ++ deviceTypes.Clear(); ++diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp ++index e7935b9..598628d 100644 ++--- a/src/libcec/CECClient.cpp +++++ b/src/libcec/CECClient.cpp ++@@ -56,6 +56,10 @@ CCECClient::CCECClient(CCECProcessor *processor, const libcec_configuration &con ++ m_iCurrentButton(CEC_USER_CONTROL_CODE_UNKNOWN), ++ m_initialButtontime(0), ++ m_updateButtontime(0), +++ m_repeatButtontime(0), +++ m_releaseButtontime(0), +++ m_pressedButtoncount(0), +++ m_releasedButtoncount(0), ++ m_iPreventForwardingPowerOffCommand(0), ++ m_iLastKeypressTime(0) ++ { ++@@ -851,6 +855,9 @@ bool CCECClient::GetCurrentConfiguration(libcec_configuration &configuration) ++ configuration.bMonitorOnly = m_configuration.bMonitorOnly; ++ configuration.cecVersion = m_configuration.cecVersion; ++ configuration.adapterType = m_configuration.adapterType; +++ configuration.iDoubleTapTimeout50Ms = m_configuration.iDoubleTapTimeout50Ms; +++ configuration.iButtonRepeatRateMs = m_configuration.iButtonRepeatRateMs; +++ configuration.iButtonReleaseDelayMs = m_configuration.iButtonReleaseDelayMs; ++ ++ return true; ++ } ++@@ -894,6 +901,9 @@ bool CCECClient::SetConfiguration(const libcec_configuration &configuration) ++ m_configuration.cecVersion = configuration.cecVersion; ++ m_configuration.adapterType = configuration.adapterType; ++ m_configuration.iDoubleTapTimeout50Ms = configuration.iDoubleTapTimeout50Ms; +++ m_configuration.iButtonRepeatRateMs = configuration.iButtonRepeatRateMs; +++ m_configuration.iButtonReleaseDelayMs = configuration.iButtonReleaseDelayMs; +++ ++ m_configuration.deviceTypes.Add(configuration.deviceTypes[0]); ++ ++ if (m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5)) ++@@ -950,6 +960,7 @@ bool CCECClient::SetConfiguration(const libcec_configuration &configuration) ++ primary->ActivateSource(); ++ } ++ +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s: %d:%d:%d", __FUNCTION__, DoubleTapTimeoutMS(), m_configuration.iButtonRepeatRateMs, m_configuration.iButtonReleaseDelayMs); ++ return true; ++ } ++ ++@@ -973,11 +984,15 @@ void CCECClient::AddCommand(const cec_command &command) ++ } ++ } ++ ++-void CCECClient::AddKey(bool bSendComboKey /* = false */) +++void CCECClient::AddKey(bool bSendComboKey /* = false */, bool bButtonRelease /* = false */) ++ { ++ cec_keypress key; ++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++ +++ // we ignore button releases when supporting repeating keys +++ if (bButtonRelease && m_configuration.iButtonRepeatRateMs && m_configuration.iButtonReleaseDelayMs) +++ return; +++ ++ { ++ CLockObject lock(m_mutex); ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN) ++@@ -995,6 +1010,10 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */) ++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; ++ m_initialButtontime = 0; ++ m_updateButtontime = 0; +++ m_repeatButtontime = 0; +++ m_releaseButtontime = 0; +++ m_pressedButtoncount = 0; +++ m_releasedButtoncount = 0; ++ } ++ } ++ } ++@@ -1012,6 +1031,7 @@ void CCECClient::AddKey(const cec_keypress &key) ++ key.keycode < CEC_USER_CONTROL_CODE_SELECT) ++ { ++ // send back the previous key if there is one +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Unexpected key %s (%1x) D:%dms", ToString(key.keycode), key.keycode, key.duration); ++ AddKey(); ++ return; ++ } ++@@ -1035,7 +1055,10 @@ void CCECClient::AddKey(const cec_keypress &key) ++ transmitKey.keycode = CEC_USER_CONTROL_CODE_DOT; ++ // default, send back the previous key ++ else +++ { +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Combo key %s (%1x) D%dms:", ToString(key.keycode), key.keycode, key.duration); ++ AddKey(true); +++ } ++ } ++ ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x) current(%lx) duration(%d)", ToString(transmitKey.keycode), transmitKey.keycode, m_iCurrentButton, key.duration); ++@@ -1043,17 +1066,44 @@ void CCECClient::AddKey(const cec_keypress &key) ++ if (m_iCurrentButton == key.keycode) ++ { ++ m_updateButtontime = GetTimeMs(); ++- isrepeat = true; +++ m_releaseButtontime = m_updateButtontime + (m_configuration.iButtonReleaseDelayMs ? m_configuration.iButtonReleaseDelayMs : CEC_BUTTON_TIMEOUT); +++ // want to have seen some updated before considering a repeat +++ if (m_configuration.iButtonRepeatRateMs) +++ { +++ if (!m_repeatButtontime && m_pressedButtoncount > 1) +++ m_repeatButtontime = m_initialButtontime + DoubleTapTimeoutMS(); +++ isrepeat = true; +++ } +++ m_pressedButtoncount++; ++ } ++ else ++ { ++ if (m_iCurrentButton != transmitKey.keycode) +++ { +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Changed key %s (%1x) D:%dms cur:%lx", ToString(transmitKey.keycode), transmitKey.keycode, transmitKey.duration, m_iCurrentButton); ++ AddKey(); +++ } ++ if (key.duration == 0) ++ { ++ m_iCurrentButton = transmitKey.keycode; ++- m_initialButtontime = m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN || key.duration > 0 ? 0 : GetTimeMs(); ++- m_updateButtontime = m_initialButtontime; +++ if (m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN) +++ { +++ m_initialButtontime = 0; +++ m_updateButtontime = 0; +++ m_repeatButtontime = 0; +++ m_releaseButtontime = 0; +++ m_pressedButtoncount = 0; +++ m_releasedButtoncount = 0; +++ } +++ else +++ { +++ m_initialButtontime = GetTimeMs(); +++ m_updateButtontime = m_initialButtontime; +++ m_repeatButtontime = 0; // set this on next update +++ m_releaseButtontime = m_initialButtontime + (m_configuration.iButtonReleaseDelayMs ? m_configuration.iButtonReleaseDelayMs : CEC_BUTTON_TIMEOUT); +++ m_pressedButtoncount = 1; +++ m_releasedButtoncount = 0; +++ } ++ } ++ } ++ } ++@@ -1072,12 +1122,16 @@ void CCECClient::SetCurrentButton(const cec_user_control_code iButtonCode) ++ key.duration = 0; ++ key.keycode = iButtonCode; ++ +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "SetCurrentButton %s (%1x) D:%dms cur:%lx", ToString(key.keycode), key.keycode, key.duration); ++ AddKey(key); ++ } ++ ++ uint16_t CCECClient::CheckKeypressTimeout(void) ++ { +++ // time when we'd like to be called again +++ unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ cec_keypress key; +++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++ ++ { ++ CLockObject lock(m_mutex); ++@@ -1089,8 +1143,8 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); ++ ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++- ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime > iTimeoutMs) || ++- (m_iCurrentButton != comboKey && iNow - m_updateButtontime > CEC_BUTTON_TIMEOUT))) +++ ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) || +++ (m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime))) ++ { ++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = m_iCurrentButton; ++@@ -1098,27 +1152,41 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; ++ m_initialButtontime = 0; ++ m_updateButtontime = 0; +++ m_repeatButtontime = 0; +++ m_releaseButtontime = 0; +++ m_pressedButtoncount = 0; +++ m_releasedButtoncount = 0; +++ } +++ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && +++ (m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime)) +++ { +++ key.duration = 0; +++ key.keycode = m_iCurrentButton; +++ m_repeatButtontime = iNow + m_configuration.iButtonRepeatRateMs; +++ timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); ++ } ++ else ++ { ++- // time when this keypress will be released and we'd like to be called again ++- unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) ++- timeout = iTimeoutMs - (iNow - m_updateButtontime) + 1; ++- else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey) ++- timeout = CEC_BUTTON_TIMEOUT - (iNow - m_updateButtontime) + 1; +++ timeout = std::min((uint64_t)timeout, m_updateButtontime - iNow + iTimeoutMs); +++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey && m_releaseButtontime) +++ timeout = std::min((uint64_t)timeout, m_releaseButtontime - iNow); +++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey && m_repeatButtontime) +++ timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); ++ if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) ++ { ++- LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_updateButtontime*1e-3, CEC_BUTTON_TIMEOUT*1e-3, m_iCurrentButton); +++ LIB_CEC->AddLog(CEC_LOG_ERROR, "Unexpected timeout: %d (%.3f %.3f %.3f) k:%02x", timeout, iNow*1e-3, m_updateButtontime*1e-3, m_releaseButtontime*1e-3, m_iCurrentButton); ++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ } ++- return timeout; ++ } +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key %s: %s (%1x) timeout:%dms (rel:%d,rep:%d,prs:%d,rel:%d)", key.keycode == CEC_USER_CONTROL_CODE_UNKNOWN ? "idle" : key.duration ? "released" : "repeated", +++ ToString(m_iCurrentButton), m_iCurrentButton, timeout, (int)(m_releaseButtontime ? m_releaseButtontime - iNow : 0), (int)(m_repeatButtontime ? m_repeatButtontime - iNow : 0), m_pressedButtoncount, m_releasedButtoncount); ++ } ++ ++- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key auto-released: %s (%1x)", ToString(key.keycode), key.keycode); ++- QueueAddKey(key); ++- return CEC_PROCESSOR_SIGNAL_WAIT_TIME; +++ if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) +++ QueueAddKey(key); +++ +++ return timeout; ++ } ++ ++ bool CCECClient::EnableCallbacks(void *cbParam, ICECCallbacks *callbacks) ++diff --git a/src/libcec/CECClient.h b/src/libcec/CECClient.h ++index 611c68b..adeb5af 100644 ++--- a/src/libcec/CECClient.h +++++ b/src/libcec/CECClient.h ++@@ -269,7 +269,7 @@ namespace CEC ++ // callbacks ++ virtual void Alert(const libcec_alert type, const libcec_parameter ¶m) { QueueAlert(type, param); } ++ virtual void AddLog(const cec_log_message &message) { QueueAddLog(message); } ++- virtual void AddKey(bool bSendComboKey = false); +++ virtual void AddKey(bool bSendComboKey = false, bool bButtonRelease = false); ++ virtual void AddKey(const cec_keypress &key); ++ virtual void SetCurrentButton(const cec_user_control_code iButtonCode); ++ virtual uint16_t CheckKeypressTimeout(void); ++@@ -406,6 +406,10 @@ namespace CEC ++ cec_user_control_code m_iCurrentButton; /**< the control code of the button that's currently held down (if any) */ ++ int64_t m_initialButtontime; /**< the timestamp when the button was initially pressed (in seconds since epoch), or 0 if none was pressed. */ ++ int64_t m_updateButtontime; /**< the timestamp when the button was updated (in seconds since epoch), or 0 if none was pressed. */ +++ int64_t m_repeatButtontime; /**< the timestamp when the button will next repeat (in seconds since epoch), or 0 if repeat is disabled. */ +++ int64_t m_releaseButtontime; /**< the timestamp when the button will be released (in seconds since epoch), or 0 if none was pressed. */ +++ int32_t m_pressedButtoncount; /**< the number of times a button released message has been seen for this press. */ +++ int32_t m_releasedButtoncount; /**< the number of times a button pressed message has been seen for this press. */ ++ int64_t m_iPreventForwardingPowerOffCommand; /**< prevent forwarding standby commands until this time */ ++ int64_t m_iLastKeypressTime; /**< last time a key press was sent to the client */ ++ cec_keypress m_lastKeypress; /**< the last key press that was sent to the client */ ++diff --git a/src/libcec/implementations/CECCommandHandler.cpp b/src/libcec/implementations/CECCommandHandler.cpp ++index 6d6244e..d64186f 100644 ++--- a/src/libcec/implementations/CECCommandHandler.cpp +++++ b/src/libcec/implementations/CECCommandHandler.cpp ++@@ -770,7 +770,7 @@ int CCECCommandHandler::HandleUserControlRelease(const cec_command &command) ++ ++ CECClientPtr client = m_processor->GetClient(command.destination); ++ if (client) ++- client->AddKey(); +++ client->AddKey(false, true); ++ ++ return COMMAND_HANDLED; ++ } ++-- ++1.9.1 ++ ++ ++From 3336d0827f7fd159430f3431642b07090c06c869 Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Tue, 28 Oct 2014 01:21:35 +0000 ++Subject: [PATCH 4/6] Skip double press removal. It is handled through other ++ means. ++ ++--- ++ src/libcec/CECClient.cpp | 18 +----------------- ++ src/libcec/CECClient.h | 2 -- ++ 2 files changed, 1 insertion(+), 19 deletions(-) ++ ++diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp ++index 598628d..dccd874 100644 ++--- a/src/libcec/CECClient.cpp +++++ b/src/libcec/CECClient.cpp ++@@ -60,11 +60,8 @@ CCECClient::CCECClient(CCECProcessor *processor, const libcec_configuration &con ++ m_releaseButtontime(0), ++ m_pressedButtoncount(0), ++ m_releasedButtoncount(0), ++- m_iPreventForwardingPowerOffCommand(0), ++- m_iLastKeypressTime(0) +++ m_iPreventForwardingPowerOffCommand(0) ++ { ++- m_lastKeypress.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++- m_lastKeypress.duration = 0; ++ m_configuration.Clear(); ++ // set the initial configuration ++ SetConfiguration(configuration); ++@@ -1647,20 +1644,7 @@ void CCECClient::CallbackAddKey(const cec_keypress &key) ++ { ++ CLockObject lock(m_cbMutex); ++ if (m_configuration.callbacks && m_configuration.callbacks->CBCecKeyPress) ++- { ++- // prevent double taps ++- int64_t now = GetTimeMs(); ++- if (m_lastKeypress.keycode != key.keycode || ++- key.duration > 0 || ++- now - m_iLastKeypressTime >= DoubleTapTimeoutMS()) ++- { ++- // no double tap ++- if (key.duration == 0) ++- m_iLastKeypressTime = now; ++- m_lastKeypress = key; ++ m_configuration.callbacks->CBCecKeyPress(m_configuration.callbackParam, key); ++- } ++- } ++ } ++ ++ void CCECClient::CallbackAddLog(const cec_log_message &message) ++diff --git a/src/libcec/CECClient.h b/src/libcec/CECClient.h ++index adeb5af..43a713b 100644 ++--- a/src/libcec/CECClient.h +++++ b/src/libcec/CECClient.h ++@@ -411,8 +411,6 @@ namespace CEC ++ int32_t m_pressedButtoncount; /**< the number of times a button released message has been seen for this press. */ ++ int32_t m_releasedButtoncount; /**< the number of times a button pressed message has been seen for this press. */ ++ int64_t m_iPreventForwardingPowerOffCommand; /**< prevent forwarding standby commands until this time */ ++- int64_t m_iLastKeypressTime; /**< last time a key press was sent to the client */ ++- cec_keypress m_lastKeypress; /**< the last key press that was sent to the client */ ++ PLATFORM::SyncedBuffer m_callbackCalls; ++ }; ++ } ++-- ++1.9.1 ++ ++ ++From 0dd0234f620a546bfa843172648383f83d88088c Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Mon, 3 Nov 2014 23:28:04 +0000 ++Subject: [PATCH 5/6] Pass through duration on all button repeats ++ ++--- ++ src/libcec/CECClient.cpp | 34 ++++++++++++++++++++++++---------- ++ 1 file changed, 24 insertions(+), 10 deletions(-) ++ ++diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp ++index dccd874..1946148 100644 ++--- a/src/libcec/CECClient.cpp +++++ b/src/libcec/CECClient.cpp ++@@ -986,10 +986,6 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */, bool bButtonRelease /* ++ cec_keypress key; ++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++ ++- // we ignore button releases when supporting repeating keys ++- if (bButtonRelease && m_configuration.iButtonRepeatRateMs && m_configuration.iButtonReleaseDelayMs) ++- return; ++- ++ { ++ CLockObject lock(m_mutex); ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN) ++@@ -1015,6 +1011,10 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */, bool bButtonRelease /* ++ } ++ } ++ +++ // we don't forward releases when supporting repeating keys +++ if (bButtonRelease && m_configuration.iButtonRepeatRateMs) +++ return; +++ ++ if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) ++ { ++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key released: %s (%1x) D:%dms", ToString(key.keycode), key.keycode, key.duration); ++@@ -1107,7 +1107,7 @@ void CCECClient::AddKey(const cec_keypress &key) ++ ++ if (!isrepeat && (key.keycode != comboKey || key.duration > 0)) ++ { ++- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x)", ToString(transmitKey.keycode), transmitKey.keycode); +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x, %d)", ToString(transmitKey.keycode), transmitKey.keycode, transmitKey.duration); ++ QueueAddKey(transmitKey); ++ } ++ } ++@@ -1129,6 +1129,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ unsigned int timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ cec_keypress key; ++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; +++ key.duration = 0; ++ ++ { ++ CLockObject lock(m_mutex); ++@@ -1140,8 +1141,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); ++ ++ if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++- ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) || ++- (m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime))) +++ m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) ++ { ++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = m_iCurrentButton; ++@@ -1155,9 +1155,23 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ m_releasedButtoncount = 0; ++ } ++ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && +++ m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime) +++ { +++ key.duration = (unsigned int) (iNow - m_initialButtontime); +++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; +++ +++ m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN; +++ m_initialButtontime = 0; +++ m_updateButtontime = 0; +++ m_repeatButtontime = 0; +++ m_releaseButtontime = 0; +++ m_pressedButtoncount = 0; +++ m_releasedButtoncount = 0; +++ } +++ else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++ (m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime)) ++ { ++- key.duration = 0; +++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = m_iCurrentButton; ++ m_repeatButtontime = iNow + m_configuration.iButtonRepeatRateMs; ++ timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); ++@@ -1176,8 +1190,8 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME; ++ } ++ } ++- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key %s: %s (%1x) timeout:%dms (rel:%d,rep:%d,prs:%d,rel:%d)", key.keycode == CEC_USER_CONTROL_CODE_UNKNOWN ? "idle" : key.duration ? "released" : "repeated", ++- ToString(m_iCurrentButton), m_iCurrentButton, timeout, (int)(m_releaseButtontime ? m_releaseButtontime - iNow : 0), (int)(m_repeatButtontime ? m_repeatButtontime - iNow : 0), m_pressedButtoncount, m_releasedButtoncount); +++ LIB_CEC->AddLog(CEC_LOG_DEBUG, "Key %s: %s (duration:%d) (%1x) timeout:%dms (rel:%d,rep:%d,prs:%d,rel:%d)", ToString(m_iCurrentButton), key.keycode == CEC_USER_CONTROL_CODE_UNKNOWN ? "idle" : m_repeatButtontime ? "repeated" : "released", key.duration, +++ m_iCurrentButton, timeout, (int)(m_releaseButtontime ? m_releaseButtontime - iNow : 0), (int)(m_repeatButtontime ? m_repeatButtontime - iNow : 0), m_pressedButtoncount, m_releasedButtoncount); ++ } ++ ++ if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN) ++-- ++1.9.1 ++ ++ ++From 1ea01f59d8186d4d53af41961aaccbbc11651115 Mon Sep 17 00:00:00 2001 ++From: popcornmix ++Date: Wed, 5 Nov 2014 21:04:25 +0000 ++Subject: [PATCH 6/6] squash: Fix for stop needing to be pressed twice ++ ++--- ++ src/libcec/CECClient.cpp | 17 ++++++++--------- ++ 1 file changed, 8 insertions(+), 9 deletions(-) ++ ++diff --git a/src/libcec/CECClient.cpp b/src/libcec/CECClient.cpp ++index 1946148..f4f114b 100644 ++--- a/src/libcec/CECClient.cpp +++++ b/src/libcec/CECClient.cpp ++@@ -1131,6 +1131,8 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++ key.duration = 0; ++ +++ if (m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN) +++ return timeout; ++ { ++ CLockObject lock(m_mutex); ++ uint64_t iNow = GetTimeMs(); ++@@ -1140,8 +1142,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ uint32_t iTimeoutMs(m_configuration.clientVersion >= LIBCEC_VERSION_TO_UINT(2, 0, 5) ? ++ m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); ++ ++- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++- m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) +++ if (m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_updateButtontime >= iTimeoutMs) ++ { ++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = m_iCurrentButton; ++@@ -1154,8 +1155,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ m_pressedButtoncount = 0; ++ m_releasedButtoncount = 0; ++ } ++- else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++- m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime) +++ else if (m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime) ++ { ++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN; ++@@ -1168,8 +1168,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ m_pressedButtoncount = 0; ++ m_releasedButtoncount = 0; ++ } ++- else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && ++- (m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime)) +++ else if (m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime) ++ { ++ key.duration = (unsigned int) (iNow - m_initialButtontime); ++ key.keycode = m_iCurrentButton; ++@@ -1178,11 +1177,11 @@ uint16_t CCECClient::CheckKeypressTimeout(void) ++ } ++ else ++ { ++- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton == comboKey && iTimeoutMs > 0) +++ if (m_iCurrentButton == comboKey && iTimeoutMs > 0) ++ timeout = std::min((uint64_t)timeout, m_updateButtontime - iNow + iTimeoutMs); ++- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey && m_releaseButtontime) +++ if (m_iCurrentButton != comboKey && m_releaseButtontime) ++ timeout = std::min((uint64_t)timeout, m_releaseButtontime - iNow); ++- if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && m_iCurrentButton != comboKey && m_repeatButtontime) +++ if (m_iCurrentButton != comboKey && m_repeatButtontime) ++ timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow); ++ if (timeout > CEC_PROCESSOR_SIGNAL_WAIT_TIME) ++ { ++-- ++1.9.1 ++ + +From b55caa265c7481aaf12c99eaa3e051197492a16b Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 28 Oct 2014 00:19:40 +0000 +Subject: [PATCH 16/87] [cec] Add settings for configuring button repeats + +--- + addons/resource.language.en_gb/resources/strings.po | 15 +++++++++++++++ + system/peripherals.xml | 4 +++- + xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 16 ++++++++++++++++ + 3 files changed, 34 insertions(+), 1 deletion(-) + +diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po +index bedbd87..6db61ed 100644 +--- a/addons/resource.language.en_gb/resources/strings.po ++++ b/addons/resource.language.en_gb/resources/strings.po +@@ -16687,3 +16687,18 @@ msgstr "" + msgctxt "#38009" + msgid "%i dB" + msgstr "" ++ ++#: system/peripherals.xml ++msgctxt "#38050" ++msgid "Remote button press delay before repeating (ms)" ++msgstr "" ++ ++#: system/peripherals.xml ++msgctxt "#38051" ++msgid "Remote button press repeat rate (ms)" ++msgstr "" ++ ++#: system/peripherals.xml ++msgctxt "#38052" ++msgid "Remote button press release time (ms)" ++msgstr "" +diff --git a/system/peripherals.xml b/system/peripherals.xml +index a67dc2f..6841bda 100644 +--- a/system/peripherals.xml ++++ b/system/peripherals.xml +@@ -30,7 +30,9 @@ + + + +- ++ ++ ++ + + + +diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +index ea702e5..b5ff693 100644 +--- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp ++++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +@@ -1267,6 +1267,20 @@ void CPeripheralCecAdapter::SetConfigurationFromLibCEC(const CEC::libcec_configu + m_configuration.bSendInactiveSource = config.bSendInactiveSource; + bChanged |= SetSetting("send_inactive_source", m_configuration.bSendInactiveSource == 1); + ++#if defined(CEC_DOUBLE_TAP_TIMEOUT_MS_OLD) ++ m_configuration.iDoubleTapTimeout50Ms = config.iDoubleTapTimeout50Ms; ++ bChanged |= SetSetting("double_tap_timeout_ms", (int)m_configuration.iDoubleTapTimeout50Ms * 50); ++#else ++ m_configuration.iDoubleTapTimeoutMs = config.iDoubleTapTimeoutMs; ++ bChanged |= SetSetting("double_tap_timeout_ms", (int)m_configuration.iDoubleTapTimeoutMs; ++#endif ++ ++ m_configuration.iButtonRepeatRateMs = config.iButtonRepeatRateMs; ++ bChanged |= SetSetting("button_repeat_rate_ms", (int)m_configuration.iButtonRepeatRateMs); ++ ++ m_configuration.iButtonReleaseDelayMs = config.iButtonReleaseDelayMs; ++ bChanged |= SetSetting("button_release_delay_ms", (int)m_configuration.iButtonReleaseDelayMs); ++ + m_configuration.iFirmwareVersion = config.iFirmwareVersion; + m_configuration.bShutdownOnStandby = config.bShutdownOnStandby; + +@@ -1371,6 +1385,8 @@ void CPeripheralCecAdapter::SetConfigurationFromSettings(void) + // backwards compatibility. will be removed once the next major release of libCEC is out + m_configuration.iDoubleTapTimeoutMs = GetSettingInt("double_tap_timeout_ms"); + #endif ++ m_configuration.iButtonRepeatRateMs = GetSettingInt("button_repeat_rate_ms"); ++ m_configuration.iButtonReleaseDelayMs = GetSettingInt("button_release_delay_ms"); + } + + void CPeripheralCecAdapter::ReadLogicalAddresses(const std::string &strString, cec_logical_addresses &addresses) + +From f8b7ec7f762de88902378187148e437589c09e8c Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 3 Nov 2014 23:17:46 +0000 +Subject: [PATCH 17/87] [cec] Don't discard buttons when repeat mode is enabled + +--- + xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +index b5ff693..6086bf5 100644 +--- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp ++++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +@@ -767,7 +767,10 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) + CLog::Log(LOGDEBUG, "%s - received key %2x duration %d", __FUNCTION__, key.iButton, key.iDuration); + + CSingleLock lock(m_critSection); +- if (key.iDuration > 0) ++ // avoid the queue getting too long ++ if (m_configuration.iButtonRepeatRateMs && m_buttonQueue.size() > 5) ++ return; ++ if (m_configuration.iButtonRepeatRateMs == 0 && key.iDuration > 0) + { + if (m_currentButton.iButton == key.iButton && m_currentButton.iDuration == 0) + { + +From d36c6702a3f695ba90ab7bc60498a57f32c6eff2 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 4 Nov 2014 18:50:00 +0000 +Subject: [PATCH 18/87] [cec] Temp - more logging + +--- + xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +index 6086bf5..417b0d8 100644 +--- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp ++++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +@@ -764,12 +764,15 @@ void CPeripheralCecAdapter::GetNextKey(void) + + void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) + { +- CLog::Log(LOGDEBUG, "%s - received key %2x duration %d", __FUNCTION__, key.iButton, key.iDuration); ++ CLog::Log(LOGDEBUG, "%s - received key %2x duration %d (rep:%d size:%d)", __FUNCTION__, key.iButton, key.iDuration, m_configuration.iButtonRepeatRateMs, m_buttonQueue.size()); + + CSingleLock lock(m_critSection); + // avoid the queue getting too long + if (m_configuration.iButtonRepeatRateMs && m_buttonQueue.size() > 5) ++ { ++ CLog::Log(LOGDEBUG, "%s - discarded key %2x", __FUNCTION__, key.iButton); + return; ++ } + if (m_configuration.iButtonRepeatRateMs == 0 && key.iDuration > 0) + { + if (m_currentButton.iButton == key.iButton && m_currentButton.iDuration == 0) +@@ -778,6 +781,7 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) + if (m_bHasButton) + m_currentButton.iDuration = key.iDuration; + // ignore this one, since it's already been handled by xbmc ++ CLog::Log(LOGDEBUG, "%s - ignored key %2x", __FUNCTION__, key.iButton); + return; + } + // if we received a keypress with a duration set, try to find the same one without a duration set, and replace it +@@ -788,6 +792,7 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) + if ((*it).iDuration == 0) + { + // replace this entry ++ CLog::Log(LOGDEBUG, "%s - replaced key %2x", __FUNCTION__, key.iButton); + (*it).iDuration = key.iDuration; + return; + } +@@ -797,6 +802,7 @@ void CPeripheralCecAdapter::PushCecKeypress(const CecButtonPress &key) + } + } + ++ CLog::Log(LOGDEBUG, "%s - added key %2x", __FUNCTION__, key.iButton); + m_buttonQueue.push_back(key); + } + + +From f4d93cf45c5ad5666ce31589c879ae2c3bfbfa0c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 15 Nov 2014 12:03:34 +0000 -Subject: [PATCH 19/58] [dvdplayer] Add lock for player creation +Subject: [PATCH 19/87] [dvdplayer] Add lock for player creation --- xbmc/cores/dvdplayer/DVDPlayer.cpp | 3 +++ @@ -850,7 +1906,7 @@ Subject: [PATCH 19/58] [dvdplayer] Add lock for player creation 2 files changed, 4 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index 70b1ac3..b41c8f0 100644 +index 87463a7..0ceae20 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp @@ -517,6 +517,7 @@ int CSelectionStreams::CountSource(StreamType type, StreamSource source) const @@ -869,7 +1925,7 @@ index 70b1ac3..b41c8f0 100644 if (!m_players_created) return; delete m_dvdPlayerVideo; -@@ -4255,6 +4257,7 @@ double CDVDPlayer::GetQueueTime() +@@ -4251,6 +4253,7 @@ double CDVDPlayer::GetQueueTime() void CDVDPlayer::GetVideoStreamInfo(SPlayerVideoStreamInfo &info) { @@ -888,10 +1944,10 @@ index ab6a228..32e76c1 100644 + CCriticalSection m_players_lock; }; -From 51e261109f6a8d1cb0e96bdaa56a01aa7077633f Mon Sep 17 00:00:00 2001 +From 1f158cf501be9af72c54013f6ba3d888028fd3d2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 24 Nov 2014 22:07:25 +0000 -Subject: [PATCH 20/58] [dvdplayervideo] Prod decoder when in stills mode +Subject: [PATCH 20/87] [dvdplayervideo] Prod decoder when in stills mode An asynchronous hardware decoder doesn't only produce output pictures when new packets arrive. In dvd stills mode give it a chance to return pictures that weren't ready when frame was decoded. @@ -900,7 +1956,7 @@ In dvd stills mode give it a chance to return pictures that weren't ready when f 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index f1a7e60..9be8aae 100644 +index 46fa635..03c876d 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp @@ -314,7 +314,8 @@ void CDVDPlayerVideo::Process() @@ -968,10 +2024,10 @@ index f1a7e60..9be8aae 100644 if (pMsg->IsType(CDVDMsg::GENERAL_SYNCHRONIZE)) -From deb376b5dad3cef8f86cef69aab9a4280bac9b21 Mon Sep 17 00:00:00 2001 +From 679035ea691e5269b7f5b26f6e5f4dd42f243da9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 27 Nov 2014 16:31:56 +0000 -Subject: [PATCH 21/58] [languageinvoker] Reduce priority of python threads +Subject: [PATCH 21/87] [languageinvoker] Reduce priority of python threads --- xbmc/interfaces/generic/LanguageInvokerThread.cpp | 5 +++++ @@ -994,10 +2050,10 @@ index fcdd063..16f0c89 100644 } -From 7351fa296cd1740f04c6c5a2047c11e3b607f700 Mon Sep 17 00:00:00 2001 +From 7c15df684d52221699e7056034efa4c6584caaeb Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 14 Dec 2013 16:55:05 +0000 -Subject: [PATCH 22/58] logging: Add microsecond timer to log messages +Subject: [PATCH 22/87] logging: Add microsecond timer to log messages --- xbmc/utils/log.cpp | 17 +++++++++++++++-- @@ -1050,10 +2106,10 @@ index 3443f12..31c4a99 100644 levelNames[logLevel]) + strData; -From c2bc1032b22f6214ffbbbecb29e3538f9790f016 Mon Sep 17 00:00:00 2001 +From 1a8b62644004d8e07141ce19bd439edc3415b7e1 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 29 Nov 2014 15:25:16 +0000 -Subject: [PATCH 23/58] [rbp] hack: wait for splash to complete before changing +Subject: [PATCH 23/87] [rbp] hack: wait for splash to complete before changing hdmi mode --- @@ -1127,10 +2183,10 @@ index 68fc647..c80114e 100644 if(!m_fixedMode && GETFLAGS_GROUP(res.dwFlags) && GETFLAGS_MODE(res.dwFlags)) -From 58ed12b2f7dd77fc57b3ddbff8fbaa04a0172716 Mon Sep 17 00:00:00 2001 +From 1c92686897b4c799e85aa878ec9f2d5b940533f6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 11 Dec 2014 17:00:57 +0000 -Subject: [PATCH 24/58] Fix for UI not showing both extractflags and +Subject: [PATCH 24/87] Fix for UI not showing both extractflags and extractthumb --- @@ -1139,7 +2195,7 @@ Subject: [PATCH 24/58] Fix for UI not showing both extractflags and 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 788a831..a794cd8 100644 +index 6db61ed..9f2eb3c 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -11015,7 +11015,7 @@ msgstr "" @@ -1151,7 +2207,7 @@ index 788a831..a794cd8 100644 msgstr "" #: xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp -@@ -14549,7 +14549,7 @@ msgstr "" +@@ -14572,7 +14572,7 @@ msgstr "" #. Description of setting "Videos -> File lists -> Extract thumbnails and video information" with label #20433 #: system/settings/settings.xml msgctxt "#36178" @@ -1160,7 +2216,7 @@ index 788a831..a794cd8 100644 msgstr "" #. Description of setting "Videos -> File lists -> Replace file names with library titles" with label #20419 -@@ -14561,7 +14561,7 @@ msgstr "" +@@ -14584,7 +14584,7 @@ msgstr "" #. Description of setting "Videos -> File lists -> Extract thumbnails and video information" with label #20433 #: system/settings/settings.xml msgctxt "#36180" @@ -1169,7 +2225,7 @@ index 788a831..a794cd8 100644 msgstr "" #: system/settings/settings.xml -@@ -16679,3 +16679,8 @@ msgstr "" +@@ -16702,3 +16702,8 @@ msgstr "" msgctxt "#38052" msgid "Remote button press release time (ms)" msgstr "" @@ -1179,7 +2235,7 @@ index 788a831..a794cd8 100644 +msgid "Extract thumbnails from video files" +msgstr "" diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 09c3d10..1059b09 100644 +index 4843ab8..f1cbefa 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -861,8 +861,8 @@ @@ -1194,10 +2250,10 @@ index 09c3d10..1059b09 100644 -From 6f0adae04039766326ebb5a735433dac07787a0f Mon Sep 17 00:00:00 2001 +From 6e4957a0b614a4e8db33849e52606052e8db9708 Mon Sep 17 00:00:00 2001 From: anaconda Date: Thu, 11 Sep 2014 21:30:43 +0200 -Subject: [PATCH 25/58] Disable autoscrolling while on screensaver and while +Subject: [PATCH 25/87] Disable autoscrolling while on screensaver and while opening streams. --- @@ -1210,10 +2266,10 @@ Subject: [PATCH 25/58] Disable autoscrolling while on screensaver and while 6 files changed, 24 insertions(+), 3 deletions(-) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index 697f278..a2a7fd2 100644 +index 36e3b97..136eade 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp -@@ -4996,3 +4996,13 @@ bool CApplication::NotifyActionListeners(const CAction &action) const +@@ -4988,3 +4988,13 @@ bool CApplication::NotifyActionListeners(const CAction &action) const return false; } @@ -1228,10 +2284,10 @@ index 697f278..a2a7fd2 100644 + return onBlackDimScreenSaver || openingStreams; +} diff --git a/xbmc/Application.h b/xbmc/Application.h -index 4b50ab2..07a5da2 100644 +index fe92b99..5e24c97 100644 --- a/xbmc/Application.h +++ b/xbmc/Application.h -@@ -389,6 +389,8 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs +@@ -385,6 +385,8 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs */ void UnregisterActionListener(IActionListener *listener); @@ -1307,7 +2363,7 @@ index 759ac09..bed6ad2 100644 else { diff --git a/xbmc/guilib/GUITextBox.cpp b/xbmc/guilib/GUITextBox.cpp -index 0d5b3f7..6d23024 100644 +index 2cdbf1c..42be75d 100644 --- a/xbmc/guilib/GUITextBox.cpp +++ b/xbmc/guilib/GUITextBox.cpp @@ -23,6 +23,7 @@ @@ -1328,10 +2384,10 @@ index 0d5b3f7..6d23024 100644 if (m_lastRenderTime) m_autoScrollDelayTime += currentTime - m_lastRenderTime; -From 9b85c054f66cb5efde618d34198bd533f16f26d5 Mon Sep 17 00:00:00 2001 +From 00ad89f5921ee884ddbf242897809e95a4291587 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 13 Dec 2014 18:35:20 +0000 -Subject: [PATCH 26/58] [demuxer] Avoid memcpy on every demuxer packet +Subject: [PATCH 26/87] [demuxer] Avoid memcpy on every demuxer packet Avoids an unnecessary memcpy on every demuxer packet which for high bitrate videos can be significant. @@ -1426,10 +2482,10 @@ index ab298b2..10c5ee0 100644 } catch(...) { -From cb5bcc331593fa2d2088c0a0f8f72aefce1030e2 Mon Sep 17 00:00:00 2001 +From 1a5db9af3595fed5b65c3557d6022cee3c254f1c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 15 Feb 2015 14:06:12 +0000 -Subject: [PATCH 27/58] [mmal] Allow mmal codec for dvd stills +Subject: [PATCH 27/87] [mmal] Allow mmal codec for dvd stills --- xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp | 7 +++++++ @@ -1461,10 +2517,10 @@ index 4c363cf..b90237b 100644 { // If dvd is an mpeg2 and hint.stills -From 3873604d5ef7443bdfc33603c979495fe8a0f17c Mon Sep 17 00:00:00 2001 +From bb4863764efb8eeb96dd788fd35ee901fe0a4d9a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 31 Mar 2015 17:31:47 +0100 -Subject: [PATCH 28/58] [mmalrenderer] Add SetCodecControl function and prefer +Subject: [PATCH 28/87] [mmalrenderer] Add SetCodecControl function and prefer to return pictures when renderer is low (disabled) --- @@ -1535,10 +2591,10 @@ index 51a64d1..bde8c06 100644 CCriticalSection m_sharedSection; MMAL_COMPONENT_T *m_dec; -From 8f077b7937e519bbe44a02c3559808672696903e Mon Sep 17 00:00:00 2001 +From 756be12cafa7d396065a961354ef6fd0911f6a24 Mon Sep 17 00:00:00 2001 From: anaconda Date: Wed, 25 Feb 2015 18:22:21 +0100 -Subject: [PATCH 29/58] Load OSD dialogs on startup. +Subject: [PATCH 29/87] Load OSD dialogs on startup. Fixes skipped frames the first time they're loaded in memory on less powered devices, like a Raspberry Pi, when using DVDPlayer. @@ -1553,10 +2609,10 @@ See http://forum.kodi.tv/showthread.php?tid=211501&pid=1938811#pid1938811 6 files changed, 10 insertions(+), 4 deletions(-) diff --git a/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp b/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp -index 1194d4c..82b980f 100644 +index 0aaeebc..200dc5f 100644 --- a/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp +++ b/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp -@@ -45,6 +45,7 @@ CGUIDialogPVRChannelsOSD::CGUIDialogPVRChannelsOSD() : +@@ -48,6 +48,7 @@ CGUIDialogPVRChannelsOSD::CGUIDialogPVRChannelsOSD() : CGUIDialog(WINDOW_DIALOG_PVR_OSD_CHANNELS, "DialogPVRChannelsOSD.xml"), Observer() { @@ -1633,10 +2689,10 @@ index 9f25fa5..3ece45b 100644 CGUIDialogVideoSettings::~CGUIDialogVideoSettings() { } -From 2c96de41d5df402113fb6f675c5c6766ad48b267 Mon Sep 17 00:00:00 2001 +From 8abb0782a608715a9d059e832f18587969bb4303 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 7 Mar 2015 22:46:21 +0000 -Subject: [PATCH 30/58] configure: Add raspberry-pi2 platform +Subject: [PATCH 30/87] configure: Add raspberry-pi2 platform --- configure.ac | 14 +++++++-- @@ -1648,7 +2704,7 @@ Subject: [PATCH 30/58] configure: Add raspberry-pi2 platform 6 files changed, 44 insertions(+), 22 deletions(-) diff --git a/configure.ac b/configure.ac -index 71883d2..6beec97 100644 +index cf945a0..ab4214f 100644 --- a/configure.ac +++ b/configure.ac @@ -744,8 +744,17 @@ case $use_platform in @@ -1810,10 +2866,10 @@ index cdc2fe4..379bd1d 100644 set(CMAKE_SYSTEM_NAME Linux) endif() -From ecf7d1b7364dd7cb121825168aa51a6b14946614 Mon Sep 17 00:00:00 2001 +From 54133f8d1b482256cad949b3cfd651e2732bf218 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 10 Mar 2015 17:05:18 +0000 -Subject: [PATCH 31/58] [players] Add settings option to enable MVC support +Subject: [PATCH 31/87] [players] Add settings option to enable MVC support --- addons/resource.language.en_gb/resources/strings.po | 10 ++++++++++ @@ -1823,10 +2879,10 @@ Subject: [PATCH 31/58] [players] Add settings option to enable MVC support 4 files changed, 27 insertions(+) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index a794cd8..acb6372 100644 +index 9f2eb3c..bf956f7 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16680,6 +16680,16 @@ msgctxt "#38052" +@@ -16703,6 +16703,16 @@ msgctxt "#38052" msgid "Remote button press release time (ms)" msgstr "" @@ -1894,10 +2950,10 @@ index e4f6d86..5d324f4 100644 case AV_CODEC_ID_MPEG4: // (role name) video_decoder.mpeg4 -From 7c831c1cf47b62ee6ea8d57457b4b5ee35f29882 Mon Sep 17 00:00:00 2001 +From 50a6e59c7f8e393d93f569ab53486c9d4fbf4308 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 14 Mar 2015 12:38:08 +0000 -Subject: [PATCH 32/58] [mmalrenderer] Switch to using transform flags for 3d +Subject: [PATCH 32/87] [mmalrenderer] Switch to using transform flags for 3d modes --- @@ -1911,10 +2967,10 @@ Subject: [PATCH 32/58] [mmalrenderer] Switch to using transform flags for 3d 7 files changed, 75 insertions(+), 130 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index acb6372..e1b691d 100644 +index bf956f7..530d882 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16690,6 +16690,16 @@ msgctxt "#38111" +@@ -16713,6 +16713,16 @@ msgctxt "#38111" msgid "This option decodes frames for both eyes of MVC video. Disabling may improve performance if you don't require 3D" msgstr "" @@ -2277,10 +3333,10 @@ index c80114e..3816b55 100644 m_width, m_height, dst_rect.width, dst_rect.height, res.fRefreshRate, GETFLAGS_GROUP(res.dwFlags), GETFLAGS_MODE(res.dwFlags), (int)res.dwFlags, res.fPixelRatio); -From 404462b4bf655a3dd1f50f619162839f47f6efaa Mon Sep 17 00:00:00 2001 +From 02ab1526a5e8a6e60d59bf5f3ad285110ff66d5d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 14 Apr 2015 20:51:14 +0100 -Subject: [PATCH 35/58] [gui] Also limit GUI updates when in non full-screen +Subject: [PATCH 35/87] [gui] Also limit GUI updates when in non full-screen video mode --- @@ -2288,10 +3344,10 @@ Subject: [PATCH 35/58] [gui] Also limit GUI updates when in non full-screen 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index a2a7fd2..95ec768 100644 +index 136eade..763c1c6 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp -@@ -2507,7 +2507,7 @@ void CApplication::FrameMove(bool processEvents, bool processGUI) +@@ -2499,7 +2499,7 @@ void CApplication::FrameMove(bool processEvents, bool processGUI) #if defined(TARGET_RASPBERRY_PI) || defined(HAS_IMXVPU) // This code reduces rendering fps of the GUI layer when playing videos in fullscreen mode // it makes only sense on architectures with multiple layers @@ -2300,7 +3356,7 @@ index a2a7fd2..95ec768 100644 fps = CSettings::Get().GetInt("videoplayer.limitguiupdate"); #endif -@@ -2520,6 +2520,8 @@ void CApplication::FrameMove(bool processEvents, bool processGUI) +@@ -2512,6 +2512,8 @@ void CApplication::FrameMove(bool processEvents, bool processGUI) { if (!m_skipGuiRender) g_windowManager.Process(CTimeUtils::GetFrameTime()); @@ -2310,10 +3366,10 @@ index a2a7fd2..95ec768 100644 g_windowManager.FrameMove(); } -From f83aef5f43795b2e08d87dc1ba8723bd7c7f09a2 Mon Sep 17 00:00:00 2001 +From 7d32b47b8d6f7f8238ad230de053b9ef74d9b169 Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 18:24:42 +0200 -Subject: [PATCH 36/58] Added some vc_tv_* functions that were missing in +Subject: [PATCH 36/87] Added some vc_tv_* functions that were missing in DllBCM. --- @@ -2348,10 +3404,10 @@ index b92fdb8..9c7e293 100644 HDMI_INTERLACED_T scan_mode, EDID_MODE_MATCH_FLAG_T match_flags) { return ::vc_tv_hdmi_power_on_best(width, height, frame_rate, scan_mode, match_flags); }; -From f72df42ab7b2987446c08230917f59391f58c1ef Mon Sep 17 00:00:00 2001 +From a87701ba7de5154a5ace636f12ad1d45899f3a5a Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 18:29:03 +0200 -Subject: [PATCH 37/58] Added private utility function to map a float display +Subject: [PATCH 37/87] Added private utility function to map a float display aspect, to the respective SDTV_ASPECT_* enum value. --- @@ -2400,10 +3456,10 @@ index 3816b55..520bf95 100644 bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector &resolutions) -From dbb24dacba5c40c0d536f4f71f5ac8b3b01fab41 Mon Sep 17 00:00:00 2001 +From c6d3ccebd34ae98f96ac2f6f28762cea9685e11a Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 19:50:58 +0200 -Subject: [PATCH 38/58] Changed SDTV resolutions to be treated similarly to +Subject: [PATCH 38/87] Changed SDTV resolutions to be treated similarly to HDMI resolutions in SetNativeResolution. This means that the SDTV interface is powered up and set to the right mode. @@ -2500,10 +3556,10 @@ index 59401f5..a0acb1a 100644 int m_width; int m_height; -From 06f189a4535e06b3d21f89e43b7caee7dedbe0d3 Mon Sep 17 00:00:00 2001 +From 45464218f3129a257aa9916b0bdb8967945da4ca Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 21 Jun 2015 17:11:09 +0100 -Subject: [PATCH 39/58] Revert "[3D] don't back out from 3D handling on +Subject: [PATCH 39/87] Revert "[3D] don't back out from 3D handling on resolution changes if we're switching to a different 3D mode" This reverts commit 3c4c236a799dab8369b4bb74ff9993bc58a61a72. @@ -2538,10 +3594,10 @@ index bd7dff9..fc4cc95 100644 if(stereo_mode != m_stereoMode) -From 445dce97603e36fadc97ee3d479abe6f581f6a07 Mon Sep 17 00:00:00 2001 +From fdefdbe58bbffe647f669616892257142aef76f6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 10 Jun 2015 20:42:03 +0100 -Subject: [PATCH 40/58] [rbp] Fix zoom modes with stereoscopic videos +Subject: [PATCH 40/87] [rbp] Fix zoom modes with stereoscopic videos --- xbmc/cores/VideoRenderers/MMALRenderer.cpp | 12 ++++++++++-- @@ -2597,10 +3653,10 @@ index ba17a46..298eaff 100644 if (gui != display) { -From 84bc87e546d79c342b8a7c169f81e8521611cdb3 Mon Sep 17 00:00:00 2001 +From 2a3b2eecd8bebb09419ce6606623e664a6caf1ea Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 21 Jun 2015 17:42:03 +0100 -Subject: [PATCH 41/58] [WinSystemEGL] Remove unused Support3D function +Subject: [PATCH 41/87] [WinSystemEGL] Remove unused Support3D function --- xbmc/windowing/egl/WinSystemEGL.cpp | 29 ----------------------------- @@ -2660,10 +3716,10 @@ index 9d4baf6..1ec4225 100644 EGLConfig GetEGLConfig(); -From 1597e6d82c667d55a763e965cb1e6448e0fbc01e Mon Sep 17 00:00:00 2001 +From d3bbcba17a08b06967098276a4e63fea1ad734c8 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 16 Apr 2014 21:18:06 +0100 -Subject: [PATCH 42/58] [omxplayer] Don't propagate 3d flags based on supported +Subject: [PATCH 42/87] [omxplayer] Don't propagate 3d flags based on supported 3d modes --- @@ -2719,10 +3775,10 @@ index 298eaff..3bf7c2e 100644 unsigned int iDisplayHeight = height; -From abadc22d9bed0fdf91c3a5be16dd07d8aa8d9f79 Mon Sep 17 00:00:00 2001 +From babe2ddd56be4bcc0653ab16010de7e5f5d3815f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 21 Jun 2015 18:52:28 +0100 -Subject: [PATCH 43/58] [3d] Avoid switching stereo mode based on current +Subject: [PATCH 43/87] [3d] Avoid switching stereo mode based on current display mode --- @@ -2762,10 +3818,10 @@ index fc4cc95..e18232e 100644 RESOLUTION_INFO info_mod = GetResInfo(res); -From ecb3cd064f5df496cbf685eec4c4d680c3c79704 Mon Sep 17 00:00:00 2001 +From 5a5c6740107de97d7cbce3303179c27e4f5e17b9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jun 2015 23:13:51 +0100 -Subject: [PATCH 44/58] [rpi] Always add desktop resolution to supported list +Subject: [PATCH 44/87] [rpi] Always add desktop resolution to supported list There was an assumption that the desktop resolution would be in the probed list, but that is sometimes not the case. We don't add interlaced resolutions to list, but they can be the preferred resolution read from edid. See: @@ -2834,10 +3890,10 @@ index a1f67fd..69ce9b7 100644 CLog::Log(LOGDEBUG, "EGL mode %d: %s (%.2f) %s%s:%x\n", i, res.strMode.c_str(), res.fPixelRatio, tv->native ? "N" : "", tv->scan_mode ? "I" : "", tv->code); -From 71f32189c08f3001e0a00f3d21d799eb7b0ac9ba Mon Sep 17 00:00:00 2001 +From 76f259d5791f4dd40cd6ff6ffb4251c25496cec6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 21 Jun 2015 18:53:29 +0100 -Subject: [PATCH 45/58] [rbp] Drop reporting 3D modes and just use current +Subject: [PATCH 45/87] [rbp] Drop reporting 3D modes and just use current rendering mode to request 3D signalling --- @@ -2994,10 +4050,10 @@ index 69ce9b7..25a97ad 100644 } if (supported_modes) -From 23e4fb99f6f4ad1cc969cc8361dc55338769419f Mon Sep 17 00:00:00 2001 +From 6b731b58c0cd53ba599eab0dab2e3011fbc43425 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 30 Jun 2015 14:08:24 +0100 -Subject: [PATCH 46/58] [rbp] Ignore video stereo mode when 3D display mode is +Subject: [PATCH 46/87] [rbp] Ignore video stereo mode when 3D display mode is disabled --- @@ -3036,10 +4092,10 @@ index 3bf7c2e..5f6b402 100644 if (m_hints.orientation == 90 || m_hints.orientation == 270) { -From 72e7fc2a4f0701ce47e624c5c73f457ae8db93fd Mon Sep 17 00:00:00 2001 +From 985940529cc7737ffa0475e4b9866fd9e4763826 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 22 Jun 2015 16:27:15 +0100 -Subject: [PATCH 47/58] [EGL] Don't skip out when HDMI mode is considered the +Subject: [PATCH 47/87] [EGL] Don't skip out when HDMI mode is considered the same It might have different 3D signalling. TODO: keep track of 3D signalling @@ -3061,10 +4117,10 @@ index c43c4d0..13b75b1 100644 m_bFullScreen = fullScreen; -From 9747f3d0ba4d3fabe46c35ceaeb74d2ee5daf547 Mon Sep 17 00:00:00 2001 +From 2ffd4421782229b8243b7c479a97c63a5e2cddde Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 21 Apr 2015 14:32:07 +0100 -Subject: [PATCH 48/58] [mmalrenderer] Add sharpness control +Subject: [PATCH 48/87] [mmalrenderer] Add sharpness control --- addons/resource.language.en_gb/resources/strings.po | 2 +- @@ -3073,7 +4129,7 @@ Subject: [PATCH 48/58] [mmalrenderer] Add sharpness control 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 6d861c1..c41b177 100644 +index 26ac2d7..f06ced6 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -7503,7 +7503,7 @@ msgstr "" @@ -3136,17 +4192,17 @@ index 1404fb3..9bced7e 100644 CCriticalSection m_sharedSection; MMAL_COMPONENT_T *m_vout; -From 7995698144c5b5c44dd9f4f80f17fa7803962586 Mon Sep 17 00:00:00 2001 +From 08d327c3400b158eae3395ca17335ea53d7127c2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 24 Apr 2015 13:49:51 +0100 -Subject: [PATCH 49/58] [dvdplayer] Add back required include +Subject: [PATCH 49/87] [dvdplayer] Add back required include --- xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index 9be8aae..ebec92d 100644 +index 03c876d..c1ef9d4 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp @@ -33,6 +33,7 @@ @@ -3158,10 +4214,10 @@ index 9be8aae..ebec92d 100644 #include "guilib/GraphicContext.h" #include -From 9cb45bcb661cf5de4814e304706d982352453f48 Mon Sep 17 00:00:00 2001 +From 5c54e70d72c67d2bf1fdb6bbc9ae94ea0a2e26bf Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 5 May 2015 23:58:06 +0100 -Subject: [PATCH 50/58] [screensaver] Leave GUI contents available for +Subject: [PATCH 50/87] [screensaver] Leave GUI contents available for screensaver --- @@ -3169,7 +4225,7 @@ Subject: [PATCH 50/58] [screensaver] Leave GUI contents available for 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/xbmc/guilib/GUIWindowManager.cpp b/xbmc/guilib/GUIWindowManager.cpp -index ba33908..17ea269 100644 +index 6030c4c..ccc2922 100644 --- a/xbmc/guilib/GUIWindowManager.cpp +++ b/xbmc/guilib/GUIWindowManager.cpp @@ -796,7 +796,16 @@ void CGUIWindowManager::ActivateWindow_Internal(int iWindowID, const vector Date: Fri, 15 May 2015 14:04:11 +0100 -Subject: [PATCH 52/58] [omxplayer] Make unsupported when ac3transcode is +Subject: [PATCH 52/87] [omxplayer] Make unsupported when ac3transcode is enabled --- @@ -3219,10 +4275,10 @@ index eff47e0..b954276 100644 { // find video stream -From 8294881aca9494a55c30f7347599779fe770c50d Mon Sep 17 00:00:00 2001 +From 912660eb2e987e8226f5e403545d5e8ea8bdbf9f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 1 Jun 2015 14:14:43 +0100 -Subject: [PATCH 53/58] [omximage] Don't report failed decode of progressive +Subject: [PATCH 53/87] [omximage] Don't report failed decode of progressive jpegs as as error --- @@ -3308,10 +4364,10 @@ index a43a446..890ca88 100644 } -From 61003a22eb36823420523a2d3df994e1222e0cea Mon Sep 17 00:00:00 2001 +From 47b92523f966479950a6f836a1a641752fdbc944 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 25 May 2015 19:01:00 +0100 -Subject: [PATCH 54/58] [rbp] Allow settings option for timestamp preference +Subject: [PATCH 54/87] [rbp] Allow settings option for timestamp preference We currently have some files that play better with pts timestamps and some that play better with dts timestamps Provide a gui setting to allow users to adjust this behaviour until we have a better solution @@ -3323,10 +4379,10 @@ Provide a gui setting to allow users to adjust this behaviour until we have a be 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po -index 0138e5f..2d043ec 100644 +index eb31d58..a631d80 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po -@@ -16714,3 +16714,13 @@ msgstr "" +@@ -16737,3 +16737,13 @@ msgstr "" msgctxt "#38121" msgid "This option supports 8 channel DTS HD decoding, but may use more CPU. It is only available when DTS and DTS-HD audio passthrough is disabled" msgstr "" @@ -3385,10 +4441,10 @@ index 5f6b402..ce23bec 100644 if (pts == DVD_NOPTS_VALUE) pts = dts; -From 9fc7a4289b865202e2b8d4ac9bc8174e1001e1ad Mon Sep 17 00:00:00 2001 +From 33cb5e8872ddb645f9a6cc9e7b79e337c6b44bab Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 6 Jun 2015 18:44:37 +0100 -Subject: [PATCH 55/58] [rbp] Ignore pts value when m_hints.ptsinvalid set +Subject: [PATCH 55/87] [rbp] Ignore pts value when m_hints.ptsinvalid set --- xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 2 +- @@ -3422,10 +4478,10 @@ index ce23bec..e17fdb8 100644 if (pts == DVD_NOPTS_VALUE) pts = dts; -From 08b2eeaffdfdd1dc124ee3eb2f5a21b664074eca Mon Sep 17 00:00:00 2001 +From f9f553c62aeb183dfd3e80b905cffed576673e10 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 6 Jun 2015 18:43:57 +0100 -Subject: [PATCH 56/58] ffmpeg: Automatic switch to software decode for GMC +Subject: [PATCH 56/87] ffmpeg: Automatic switch to software decode for GMC with more than one warp point --- @@ -3596,10 +4652,10 @@ index b954276..b5ee4b6 100644 else if ((hint.codec == AV_CODEC_ID_VC1 || hint.codec == AV_CODEC_ID_WMV3) && g_RBP.GetCodecWvc1()) supported = true; -From e51804ed122dd0a642104d102315787970fffb8d Mon Sep 17 00:00:00 2001 +From 7fef3d4b4ec074297b9122231677e6ca22477ce5 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 22 Jun 2015 21:46:57 +0100 -Subject: [PATCH 57/58] [rbp] Use default resampling setting on Pi2 +Subject: [PATCH 57/87] [rbp] Use default resampling setting on Pi2 --- system/settings/rbp2.xml | 5 +++++ @@ -3622,10 +4678,10 @@ index b29a428..1c8b116 100644
-From 175260bab79c330366834bd86512afc2902dba0a Mon Sep 17 00:00:00 2001 +From c1c3ee24908f125f0de27c538104fb941a97f70c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 25 Jun 2015 19:43:10 +0100 -Subject: [PATCH 58/58] [rbp] HW mouse pointer +Subject: [PATCH 58/87] [rbp] HW mouse pointer Updating the mouse point provokes a complete screen update which can make it feel laggy and results in high cpu. @@ -3644,7 +4700,7 @@ Requires recent firmware. create mode 100644 xbmc/linux/rpi_user_vcsm.h diff --git a/xbmc/guilib/GUIWindowManager.cpp b/xbmc/guilib/GUIWindowManager.cpp -index 17ea269..6965319 100644 +index ccc2922..7bcda5c 100644 --- a/xbmc/guilib/GUIWindowManager.cpp +++ b/xbmc/guilib/GUIWindowManager.cpp @@ -193,7 +193,9 @@ void CGUIWindowManager::CreateWindows() @@ -4662,3 +5718,1482 @@ index f6c8df0..5c2b583 100644 }; #endif + +From 8c2da945c14bf86a8110cadb8de8d905456bf115 Mon Sep 17 00:00:00 2001 +From: Roman Kraevskiy +Date: Fri, 10 Jul 2015 23:36:34 +0300 +Subject: [PATCH 59/87] Mouse wheel support for X11-less linux distros + (openelec) + +--- + xbmc/input/linux/LinuxInputDevices.cpp | 125 +++++++++++++++++++++------------ + xbmc/input/linux/LinuxInputDevices.h | 2 + + 2 files changed, 82 insertions(+), 45 deletions(-) + +diff --git a/xbmc/input/linux/LinuxInputDevices.cpp b/xbmc/input/linux/LinuxInputDevices.cpp +index 32a3b46..b028cd1 100644 +--- a/xbmc/input/linux/LinuxInputDevices.cpp ++++ b/xbmc/input/linux/LinuxInputDevices.cpp +@@ -558,22 +558,27 @@ bool CLinuxInputDevice::KeyEvent(const struct input_event& levt, XBMC_Event& dev + */ + bool CLinuxInputDevice::RelEvent(const struct input_event& levt, XBMC_Event& devt) + { ++ bool motion = false; ++ bool wheel = false; ++ + switch (levt.code) + { + case REL_X: + m_mouseX += levt.value; + devt.motion.xrel = levt.value; + devt.motion.yrel = 0; ++ motion = true; + break; +- + case REL_Y: + m_mouseY += levt.value; + devt.motion.xrel = 0; + devt.motion.yrel = levt.value; ++ motion = true; + break; +- +- case REL_Z: + case REL_WHEEL: ++ wheel = (levt.value != 0); // process wheel event only when there was some delta ++ break; ++ case REL_Z: + default: + CLog::Log(LOGWARNING, "CLinuxInputDevice::RelEvent: Unknown rel event code: %d\n", levt.code); + return false; +@@ -588,13 +593,35 @@ bool CLinuxInputDevice::RelEvent(const struct input_event& levt, XBMC_Event& dev + m_mouseY = std::max(0, m_mouseY); + + +- devt.type = XBMC_MOUSEMOTION; +- devt.motion.type = XBMC_MOUSEMOTION; +- devt.motion.x = m_mouseX; +- devt.motion.y = m_mouseY; +- devt.motion.state = 0; +- devt.motion.which = m_deviceIndex; +- ++ if (motion) ++ { ++ devt.type = XBMC_MOUSEMOTION; ++ devt.motion.type = XBMC_MOUSEMOTION; ++ devt.motion.x = m_mouseX; ++ devt.motion.y = m_mouseY; ++ devt.motion.state = 0; ++ devt.motion.which = m_deviceIndex; ++ } ++ else if (wheel) ++ { ++ devt.type = XBMC_MOUSEBUTTONUP; ++ devt.button.state = XBMC_RELEASED; ++ devt.button.type = devt.type; ++ devt.button.x = m_mouseX; ++ devt.button.y = m_mouseY; ++ devt.button.button = (levt.value<0) ? XBMC_BUTTON_WHEELDOWN:XBMC_BUTTON_WHEELUP; ++ ++ /* but WHEEL up enent to the queue */ ++ m_equeue.push_back(devt); ++ ++ /* prepare and return WHEEL down event */ ++ devt.button.state = XBMC_PRESSED; ++ devt.type = XBMC_MOUSEBUTTONDOWN; ++ } ++ else ++ { ++ return false; ++ } + + return true; + } +@@ -693,57 +720,65 @@ XBMC_Event CLinuxInputDevice::ReadEvent() + + XBMC_Event devt; + +- while (1) ++ if (m_equeue.empty()) + { +- bzero(&levt, sizeof(levt)); ++ while (1) ++ { ++ bzero(&levt, sizeof(levt)); + +- bzero(&devt, sizeof(devt)); +- devt.type = XBMC_NOEVENT; ++ bzero(&devt, sizeof(devt)); ++ devt.type = XBMC_NOEVENT; + +- if(m_devicePreferredId == LI_DEVICE_NONE) +- return devt; ++ if(m_devicePreferredId == LI_DEVICE_NONE) ++ return devt; + +- readlen = read(m_fd, &levt, sizeof(levt)); ++ readlen = read(m_fd, &levt, sizeof(levt)); + +- if (readlen <= 0) +- { +- if (errno == ENODEV) ++ if (readlen <= 0) + { +- CLog::Log(LOGINFO,"input device was unplugged %s",m_deviceName); +- m_bUnplugged = true; ++ if (errno == ENODEV) ++ { ++ CLog::Log(LOGINFO,"input device was unplugged %s",m_deviceName); ++ m_bUnplugged = true; ++ } ++ ++ break; + } + +- break; +- } ++ //printf("read event readlen = %d device name %s m_fileName %s\n", readlen, m_deviceName, m_fileName.c_str()); + +- //printf("read event readlen = %d device name %s m_fileName %s\n", readlen, m_deviceName, m_fileName.c_str()); ++ // sanity check if we realy read the event ++ if(readlen != sizeof(levt)) ++ { ++ printf("CLinuxInputDevice: read error : %s\n", strerror(errno)); ++ break; ++ } + +- // sanity check if we realy read the event +- if(readlen != sizeof(levt)) +- { +- printf("CLinuxInputDevice: read error : %s\n", strerror(errno)); +- break; +- } ++ if (!TranslateEvent(levt, devt)) ++ continue; + +- if (!TranslateEvent(levt, devt)) +- continue; ++ /* Flush previous event with DIEF_FOLLOW? */ ++ if (devt.type != XBMC_NOEVENT) ++ { ++ //printf("new event! type = %d\n", devt.type); ++ //printf("key: %d %d %d %c\n", devt.key.keysym.scancode, devt.key.keysym.sym, devt.key.keysym.mod, devt.key.keysym.unicode); + +- /* Flush previous event with DIEF_FOLLOW? */ +- if (devt.type != XBMC_NOEVENT) +- { +- //printf("new event! type = %d\n", devt.type); +- //printf("key: %d %d %d %c\n", devt.key.keysym.scancode, devt.key.keysym.sym, devt.key.keysym.mod, devt.key.keysym.unicode); ++ if (m_hasLeds && (m_keyMods != m_lastKeyMods)) ++ { ++ SetLed(LED_NUML, m_keyMods & XBMCKMOD_NUM); ++ SetLed(LED_CAPSL, m_keyMods & XBMCKMOD_CAPS); ++ m_lastKeyMods = m_keyMods; ++ } + +- if (m_hasLeds && (m_keyMods != m_lastKeyMods)) +- { +- SetLed(LED_NUML, m_keyMods & XBMCKMOD_NUM); +- SetLed(LED_CAPSL, m_keyMods & XBMCKMOD_CAPS); +- m_lastKeyMods = m_keyMods; ++ break; + } +- +- break; + } + } ++ else ++ { ++ devt = m_equeue.front(); ++ m_equeue.pop_front(); ++ } + + return devt; + } +diff --git a/xbmc/input/linux/LinuxInputDevices.h b/xbmc/input/linux/LinuxInputDevices.h +index cf1c5ce..954d823 100644 +--- a/xbmc/input/linux/LinuxInputDevices.h ++++ b/xbmc/input/linux/LinuxInputDevices.h +@@ -22,6 +22,7 @@ + + #include + #include ++#include + #include "windowing/XBMC_events.h" + #include "input/XBMC_keyboard.h" + #include "threads/SingleLock.h" +@@ -79,6 +80,7 @@ class CLinuxInputDevice + int m_deviceMaxAxis; + bool m_bSkipNonKeyEvents; + bool m_bUnplugged; ++ std::deque m_equeue; + }; + + class CLinuxInputDevices + +From f233a279790d3b1682972724c243c7ea48b56aa2 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 22 Jun 2015 22:06:53 +0100 +Subject: [PATCH 60/87] [rbp] Flip default of prefer pts timestamps + +--- + system/settings/rbp.xml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml +index 8c6e69d..f9528bc 100644 +--- a/system/settings/rbp.xml ++++ b/system/settings/rbp.xml +@@ -45,7 +45,7 @@ + + + 3 +- false ++ true + + + + +From 3265c0a4d65cd46fa7e6e40f2c06587325a8a53f Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 7 May 2015 14:28:37 +0100 +Subject: [PATCH 61/87] build: Add vcsm lib + +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 084c2cf..98a1b26 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1059,7 +1059,7 @@ if test "$use_gles" = "yes"; then + AC_DEFINE([HAVE_LIBEGL],[1],["Define to 1 if you have the `EGL' library (-lEGL)."]) + AC_DEFINE([HAVE_LIBGLESV2],[1],["Define to 1 if you have the `GLESv2' library (-lGLESv2)."]) + AC_MSG_RESULT(== WARNING: OpenGLES support is assumed.) +- LIBS="$LIBS -lEGL -lGLESv2 -lbcm_host -lvcos -lvchiq_arm -lmmal -lmmal_core -lmmal_util" ++ LIBS="$LIBS -lEGL -lGLESv2 -lbcm_host -lvcos -lvchiq_arm -lmmal -lmmal_core -lmmal_util -lvcsm" + else + AC_CHECK_LIB([EGL], [main],, AC_MSG_ERROR($missing_library)) + AC_CHECK_LIB([GLESv2],[main],, AC_MSG_ERROR($missing_library)) + +From 711768bf07ef5cea9c30e3543fa82b45017c508a Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 20 Jul 2015 16:11:37 +0100 +Subject: [PATCH 62/87] [mmalcodec] Populate the framerate of video decoder + +When timestamps are unknown, they may be interpolated based on the framerate. Without setting this, +a default of 30fps is used which may be incorrect and cause stutters +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 3e97f1d..5b064d2 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -629,6 +629,11 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) + m_dec_input->format->es->video.width = ALIGN_UP(m_hints.width, 32); + m_dec_input->format->es->video.height = ALIGN_UP(m_hints.height, 16); + } ++ if (hints.fpsrate > 0 && hints.fpsscale > 0) ++ { ++ m_dec_input->format->es->video.frame_rate.num = hints.fpsrate; ++ m_dec_input->format->es->video.frame_rate.den = hints.fpsscale; ++ } + m_dec_input->format->flags |= MMAL_ES_FORMAT_FLAG_FRAMED; + + error_concealment.hdr.id = MMAL_PARAMETER_VIDEO_DECODE_ERROR_CONCEALMENT; + +From 94b4c1a43ae53a123c5039ac94b47c5598db455b Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 22 Jul 2015 22:52:46 +0100 +Subject: [PATCH 63/87] [mmalcodec] Enable interpolate timestamps + +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 5b064d2..a202421 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -647,7 +647,7 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) + if (status != MMAL_SUCCESS) + CLog::Log(LOGERROR, "%s::%s Failed to enable extra buffers on %s (status=%x %s)", CLASSNAME, __func__, m_dec_input->name, status, mmal_status_to_string(status)); + +- status = mmal_port_parameter_set_uint32(m_dec_input, MMAL_PARAMETER_VIDEO_INTERPOLATE_TIMESTAMPS, 0); ++ status = mmal_port_parameter_set_uint32(m_dec_input, MMAL_PARAMETER_VIDEO_INTERPOLATE_TIMESTAMPS, 1); + if (status != MMAL_SUCCESS) + CLog::Log(LOGERROR, "%s::%s Failed to disable interpolate timestamps mode on %s (status=%x %s)", CLASSNAME, __func__, m_dec_input->name, status, mmal_status_to_string(status)); + + +From d65df791a54f90d38f6c905aef565c05cccb44d3 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 23 Jul 2015 00:55:47 +0100 +Subject: [PATCH 64/87] Revert "[rbp] Flip default of prefer pts timestamps" + +This reverts commit 34100dcdf830a0e957df585108066c48d6c5c38d. +--- + system/settings/rbp.xml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml +index f9528bc..8c6e69d 100644 +--- a/system/settings/rbp.xml ++++ b/system/settings/rbp.xml +@@ -45,7 +45,7 @@ + + + 3 +- true ++ false + + + + +From 2b3c2670323ee570e6f10164e2cc3fb78e2f31b9 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 23 Jul 2015 00:56:56 +0100 +Subject: [PATCH 65/87] Revert "[rbp] Allow settings option for timestamp + preference" + +This reverts commit c0eef926dd376cbf8a7857b2848e118ea3689b98. +--- + addons/resource.language.en_gb/resources/strings.po | 10 ---------- + system/settings/rbp.xml | 7 ------- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 2 +- + xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 2 +- + 4 files changed, 2 insertions(+), 19 deletions(-) + +diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po +index a631d80..eb31d58 100644 +--- a/addons/resource.language.en_gb/resources/strings.po ++++ b/addons/resource.language.en_gb/resources/strings.po +@@ -16737,13 +16737,3 @@ msgstr "" + msgctxt "#38121" + msgid "This option supports 8 channel DTS HD decoding, but may use more CPU. It is only available when DTS and DTS-HD audio passthrough is disabled" + msgstr "" +- +-#: system/settings/rbp.xml +-msgctxt "#38210" +-msgid "Prefer PTS timestamps" +-msgstr "" +- +-#: system/settings/rbp.xml +-msgctxt "#38211" +-msgid "Try enabling this if you have stutter with video files" +-msgstr "" +diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml +index 8c6e69d..b27d23f 100644 +--- a/system/settings/rbp.xml ++++ b/system/settings/rbp.xml +@@ -42,13 +42,6 @@ + + +
+- +- +- 3 +- false +- +- +- +
+ + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index a202421..5d054bb 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -804,7 +804,7 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + pts = 0; + buffer->pts = pts == DVD_NOPTS_VALUE ? MMAL_TIME_UNKNOWN : pts; + buffer->dts = dts == DVD_NOPTS_VALUE ? MMAL_TIME_UNKNOWN : dts; +- if (m_hints.ptsinvalid || (buffer->dts != MMAL_TIME_UNKNOWN && !CSettings::Get().GetBool("videoplayer.preferptstimestamps"))) buffer->pts = MMAL_TIME_UNKNOWN; ++ if (m_hints.ptsinvalid) buffer->pts = MMAL_TIME_UNKNOWN; + buffer->length = demuxer_bytes > buffer->alloc_size ? buffer->alloc_size : demuxer_bytes; + // set a flag so we can identify primary frames from generated frames (deinterlace) + buffer->flags = MMAL_BUFFER_HEADER_FLAG_USER0; +diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +index e17fdb8..f06ee9c 100644 +--- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp ++++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +@@ -495,7 +495,7 @@ void OMXPlayerVideo::Process() + if (pts != DVD_NOPTS_VALUE) + pts += m_iVideoDelay; + +- m_omxVideo.Decode(pPacket->pData, pPacket->iSize, dts, m_hints.ptsinvalid || (dts != DVD_NOPTS_VALUE && !CSettings::Get().GetBool("videoplayer.preferptstimestamps")) ? DVD_NOPTS_VALUE : pts); ++ m_omxVideo.Decode(pPacket->pData, pPacket->iSize, dts, m_hints.ptsinvalid ? DVD_NOPTS_VALUE : pts); + + if (pts == DVD_NOPTS_VALUE) + pts = dts; + +From b8058086f55b522b82ba15ad4d9f30bd8c1cd458 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 23 Jul 2015 15:52:39 +0100 +Subject: [PATCH 66/87] [omxhelper] Ignore embedded coverart image when looking + for supported video streams + +--- + xbmc/cores/omxplayer/OMXHelper.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/xbmc/cores/omxplayer/OMXHelper.cpp b/xbmc/cores/omxplayer/OMXHelper.cpp +index b5ee4b6..59479fe 100644 +--- a/xbmc/cores/omxplayer/OMXHelper.cpp ++++ b/xbmc/cores/omxplayer/OMXHelper.cpp +@@ -72,7 +72,7 @@ bool OMXPlayerUnsuitable(bool m_HasVideo, bool m_HasAudio, CDVDDemux* m_pDemuxer + { + int iStream = it->id; + CDemuxStream *stream = m_pDemuxer->GetStream(iStream); +- if(!stream || stream->disabled) ++ if(!stream || stream->disabled || stream->flags & AV_DISPOSITION_ATTACHED_PIC) + continue; + CDVDStreamInfo hint(*stream, true); + + +From 142b98ac1813dc78695f763f51c1516f0cfe5d2e Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 24 Jul 2015 18:39:25 +0100 +Subject: [PATCH 68/87] [mmalcodec] Don't set initial unknown timestamps to + zero + +This used to be done to keep the firmware happy, but is no longer required and messes with timestamp statistics +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 8 -------- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 1 - + 2 files changed, 9 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 5d054bb..b2ac68f 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -106,7 +106,6 @@ CMMALVideo::CMMALVideo() + + m_interlace_mode = MMAL_InterlaceProgressive; + m_interlace_method = VS_INTERLACEMETHOD_NONE; +- m_startframe = false; + m_decoderPts = DVD_NOPTS_VALUE; + + m_dec = NULL; +@@ -713,7 +712,6 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) + return false; + + Prime(); +- m_startframe = false; + m_preroll = !m_hints.stills; + m_speed = DVD_PLAYSPEED_NORMAL; + +@@ -800,8 +798,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + + mmal_buffer_header_reset(buffer); + buffer->cmd = 0; +- if (!m_startframe && pts == DVD_NOPTS_VALUE) +- pts = 0; + buffer->pts = pts == DVD_NOPTS_VALUE ? MMAL_TIME_UNKNOWN : pts; + buffer->dts = dts == DVD_NOPTS_VALUE ? MMAL_TIME_UNKNOWN : dts; + if (m_hints.ptsinvalid) buffer->pts = MMAL_TIME_UNKNOWN; +@@ -829,9 +825,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + + if (demuxer_bytes == 0) + { +- pthread_mutex_lock(&m_output_mutex); +- m_startframe = true; +- pthread_mutex_unlock(&m_output_mutex); + EDEINTERLACEMODE deinterlace_request = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode; + EINTERLACEMETHOD interlace_method = g_renderManager.AutoInterlaceMethod(CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod); + +@@ -956,7 +949,6 @@ void CMMALVideo::Reset(void) + SendCodecConfigData(); + Prime(); + } +- m_startframe = false; + m_decoderPts = DVD_NOPTS_VALUE; + m_preroll = !m_hints.stills && (m_speed == DVD_PLAYSPEED_NORMAL || m_speed == DVD_PLAYSPEED_PAUSE); + m_codecControlFlags = 0; +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +index bde8c06..42d6a7b 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +@@ -127,7 +127,6 @@ class CMMALVideo : public CDVDVideoCodec + // Components + MMAL_INTERLACETYPE_T m_interlace_mode; + EINTERLACEMETHOD m_interlace_method; +- bool m_startframe; + double m_decoderPts; + int m_speed; + bool m_preroll; + +From 9e5e289b1384d78772920dbeffcee577d8aeb99e Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 24 Jul 2015 22:53:21 +0100 +Subject: [PATCH 69/87] [mmalcodec] Tidy up setting of timestamp flags + +--- + xbmc/cores/omxplayer/OMXVideo.cpp | 27 ++++++++++++++------------- + 1 file changed, 14 insertions(+), 13 deletions(-) + +diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp +index 832a9c9..1a08aa9 100644 +--- a/xbmc/cores/omxplayer/OMXVideo.cpp ++++ b/xbmc/cores/omxplayer/OMXVideo.cpp +@@ -754,6 +754,19 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double dts, double pts) + + if (demuxer_content && demuxer_bytes > 0) + { ++ OMX_U32 nFlags = 0; ++ ++ if(m_setStartTime) ++ { ++ nFlags |= OMX_BUFFERFLAG_STARTTIME; ++ CLog::Log(LOGDEBUG, "OMXVideo::Decode VDec : setStartTime %f\n", (pts == DVD_NOPTS_VALUE ? 0.0 : pts) / DVD_TIME_BASE); ++ m_setStartTime = false; ++ } ++ if (pts == DVD_NOPTS_VALUE && dts == DVD_NOPTS_VALUE) ++ nFlags |= OMX_BUFFERFLAG_TIME_UNKNOWN; ++ else if (pts == DVD_NOPTS_VALUE) ++ nFlags |= OMX_BUFFERFLAG_TIME_IS_DTS; ++ + while(demuxer_bytes) + { + // 500ms timeout +@@ -764,21 +777,9 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double dts, double pts) + return false; + } + +- omx_buffer->nFlags = 0; ++ omx_buffer->nFlags = nFlags; + omx_buffer->nOffset = 0; + omx_buffer->nTimeStamp = ToOMXTime((uint64_t)(pts != DVD_NOPTS_VALUE ? pts : dts != DVD_NOPTS_VALUE ? dts : 0)); +- +- if(m_setStartTime) +- { +- omx_buffer->nFlags |= OMX_BUFFERFLAG_STARTTIME; +- CLog::Log(LOGDEBUG, "OMXVideo::Decode VDec : setStartTime %f\n", (pts == DVD_NOPTS_VALUE ? 0.0 : pts) / DVD_TIME_BASE); +- m_setStartTime = false; +- } +- else if (pts == DVD_NOPTS_VALUE && dts == DVD_NOPTS_VALUE) +- omx_buffer->nFlags |= OMX_BUFFERFLAG_TIME_UNKNOWN; +- else if (pts == DVD_NOPTS_VALUE) +- omx_buffer->nFlags |= OMX_BUFFERFLAG_TIME_IS_DTS; +- + omx_buffer->nFilledLen = std::min((OMX_U32)demuxer_bytes, omx_buffer->nAllocLen); + memcpy(omx_buffer->pBuffer, demuxer_content, omx_buffer->nFilledLen); + + +From 4858d812237020f71205a6ab1e0af891099f3167 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Sat, 25 Jul 2015 15:32:35 +0100 +Subject: [PATCH 70/87] [rbp] Only send changes in hw cursor state + +--- + xbmc/linux/RBP.cpp | 9 ++++++++- + xbmc/linux/RBP.h | 5 ++++- + 2 files changed, 12 insertions(+), 2 deletions(-) + +diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp +index 2c8d09b..3953740 100644 +--- a/xbmc/linux/RBP.cpp ++++ b/xbmc/linux/RBP.cpp +@@ -61,6 +61,9 @@ CRBP::CRBP() + m_OMX = new COMXCore(); + m_display = DISPMANX_NO_HANDLE; + m_p = NULL; ++ m_x = 0; ++ m_y = 0; ++ m_enabled = 0; + m_mb = mbox_open(); + vcsm_init(); + } +@@ -482,7 +485,11 @@ void CRBP::update_cursor(int x, int y, bool enabled) + int y2 = y * display.Height() / gui.Height(); + + //printf("%s %d,%d (%d)\n", __func__, x, y, enabled); +- mailbox_set_cursor_position(m_mb, enabled, x2, y2); ++ if (m_x != x2 || m_y != y2 || m_enabled != enabled) ++ mailbox_set_cursor_position(m_mb, enabled, x2, y2); ++ m_x = x2; ++ m_y = y2; ++ m_enabled = enabled; + } + + void CRBP::uninit_cursor() +diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h +index f233a5e..be0cafc 100644 +--- a/xbmc/linux/RBP.h ++++ b/xbmc/linux/RBP.h +@@ -86,7 +86,10 @@ class CRBP + + struct gpu_mem_ptr_s *m_p; + int m_mb; +-public: ++ int m_x; ++ int m_y; ++ bool m_enabled; ++ public: + void init_cursor(); + void set_cursor(const void *pixels, int width, int height, int hotspot_x, int hotspot_y); + void update_cursor(int x, int y, bool enabled); + +From 68935db0771fe14373c061420ffbbca5596a3a74 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 28 Jul 2015 00:08:58 +0100 +Subject: [PATCH 71/87] [mmalcodec] Use both dts and pts for determining amount + of queued data + +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 10 ++++++++-- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h | 1 + + 2 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index b2ac68f..6cf4023 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -107,6 +107,7 @@ CMMALVideo::CMMALVideo() + m_interlace_mode = MMAL_InterlaceProgressive; + m_interlace_method = VS_INTERLACEMETHOD_NONE; + m_decoderPts = DVD_NOPTS_VALUE; ++ m_demuxerPts = DVD_NOPTS_VALUE; + + m_dec = NULL; + m_dec_input = NULL; +@@ -853,7 +854,11 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + break; + } + int ret = 0; +- double queued = m_decoderPts != DVD_NOPTS_VALUE && pts != DVD_NOPTS_VALUE ? pts - m_decoderPts : 0.0; ++ if (pts != DVD_NOPTS_VALUE) ++ m_demuxerPts = pts; ++ else if (dts != DVD_NOPTS_VALUE) ++ m_demuxerPts = dts; ++ double queued = m_decoderPts != DVD_NOPTS_VALUE && m_demuxerPts != DVD_NOPTS_VALUE ? m_demuxerPts - m_decoderPts : 0.0; + if (mmal_queue_length(m_dec_input_pool->queue) > 0 && !m_demux_queue_length && queued <= DVD_MSEC_TO_TIME(500)) + { + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +@@ -950,6 +955,7 @@ void CMMALVideo::Reset(void) + Prime(); + } + m_decoderPts = DVD_NOPTS_VALUE; ++ m_demuxerPts = DVD_NOPTS_VALUE; + m_preroll = !m_hints.stills && (m_speed == DVD_PLAYSPEED_NORMAL || m_speed == DVD_PLAYSPEED_PAUSE); + m_codecControlFlags = 0; + } +@@ -1043,7 +1049,7 @@ bool CMMALVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture) + if (pDvdVideoPicture->pts != DVD_NOPTS_VALUE) + m_decoderPts = pDvdVideoPicture->pts; + else +- m_decoderPts = pDvdVideoPicture->dts; // xxx is DVD_NOPTS_VALUE better? ++ m_decoderPts = pDvdVideoPicture->dts; + + return true; + } +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +index 42d6a7b..f8f5209 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.h +@@ -127,6 +127,7 @@ class CMMALVideo : public CDVDVideoCodec + // Components + MMAL_INTERLACETYPE_T m_interlace_mode; + EINTERLACEMETHOD m_interlace_method; ++ double m_demuxerPts; + double m_decoderPts; + int m_speed; + bool m_preroll; + +From ddd17d3dfb6c4b2043b024ff1ee33bc6b9a3bcf0 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 28 Jul 2015 17:47:33 +0100 +Subject: [PATCH 72/87] [rbp] Refactor the vsync handle to support multiple + callers + +--- + xbmc/linux/RBP.cpp | 68 ++++++++++++++++++++++++++++++------------------------ + xbmc/linux/RBP.h | 7 ++++-- + 2 files changed, 43 insertions(+), 32 deletions(-) + +diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp +index 3953740..901250e 100644 +--- a/xbmc/linux/RBP.cpp ++++ b/xbmc/linux/RBP.cpp +@@ -66,6 +66,7 @@ CRBP::CRBP() + m_enabled = 0; + m_mb = mbox_open(); + vcsm_init(); ++ m_vsync_count = 0; + } + + CRBP::~CRBP() +@@ -143,11 +144,45 @@ void CRBP::LogFirmwareVerison() + CLog::Log(LOGNOTICE, "Config:\n%s", response); + } + ++static void vsync_callback_static(DISPMANX_UPDATE_HANDLE_T u, void *arg) ++{ ++ CRBP *rbp = reinterpret_cast(arg); ++ rbp->VSyncCallback(); ++} ++ ++void CRBP::VSyncCallback() ++{ ++ CSingleLock lock(m_vsync_lock); ++ m_vsync_count++; ++ m_vsync_cond.notifyAll(); ++} ++ ++unsigned int CRBP::WaitVsync(unsigned int target) ++{ ++ CSingleLock lock(m_vsync_lock); ++ if (target == ~0U) ++ target = m_vsync_count+1; ++ ++ if (m_display == DISPMANX_NO_HANDLE) ++ { ++ CLog::Log(LOGDEBUG, "CRBP::%s skipping while display closed", __func__); ++ return m_vsync_count; ++ } ++ ++ while (m_vsync_count < target) ++ if (!m_vsync_cond.wait(lock, 100)) ++ break; ++ ++ return m_vsync_count; ++} ++ + DISPMANX_DISPLAY_HANDLE_T CRBP::OpenDisplay(uint32_t device) + { + if (m_display == DISPMANX_NO_HANDLE) + { + m_display = vc_dispmanx_display_open( 0 /*screen*/ ); ++ int s = vc_dispmanx_vsync_callback(m_display, vsync_callback_static, (void *)this); ++ assert(s == 0); + init_cursor(); + } + return m_display; +@@ -156,9 +191,11 @@ DISPMANX_DISPLAY_HANDLE_T CRBP::OpenDisplay(uint32_t device) + void CRBP::CloseDisplay(DISPMANX_DISPLAY_HANDLE_T display) + { + assert(display == m_display); ++ int s = vc_dispmanx_vsync_callback(m_display, NULL, NULL); ++ assert(s == 0); ++ uninit_cursor(); + vc_dispmanx_display_close(m_display); + m_display = DISPMANX_NO_HANDLE; +- uninit_cursor(); + } + + void CRBP::GetDisplaySize(int &width, int &height) +@@ -211,35 +248,6 @@ unsigned char *CRBP::CaptureDisplay(int width, int height, int *pstride, bool sw + return image; + } + +- +-static void vsync_callback(DISPMANX_UPDATE_HANDLE_T u, void *arg) +-{ +- CEvent *sync = (CEvent *)arg; +- sync->Set(); +-} +- +-void CRBP::WaitVsync() +-{ +- int s; +- DISPMANX_DISPLAY_HANDLE_T m_display = vc_dispmanx_display_open( 0 /*screen*/ ); +- if (m_display == DISPMANX_NO_HANDLE) +- { +- CLog::Log(LOGDEBUG, "CRBP::%s skipping while display closed", __func__); +- return; +- } +- m_vsync.Reset(); +- s = vc_dispmanx_vsync_callback(m_display, vsync_callback, (void *)&m_vsync); +- if (s == 0) +- { +- m_vsync.WaitMSec(1000); +- } +- else assert(0); +- s = vc_dispmanx_vsync_callback(m_display, NULL, NULL); +- assert(s == 0); +- vc_dispmanx_display_close( m_display ); +-} +- +- + void CRBP::Deinitialize() + { + if (m_omx_image_init) +diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h +index be0cafc..0572b47 100644 +--- a/xbmc/linux/RBP.h ++++ b/xbmc/linux/RBP.h +@@ -65,7 +65,8 @@ class CRBP + // stride can be null for packed output + unsigned char *CaptureDisplay(int width, int height, int *stride, bool swap_red_blue, bool video_only = true); + DllOMX *GetDllOMX() { return m_OMX ? m_OMX->GetDll() : NULL; } +- void WaitVsync(); ++ unsigned int WaitVsync(unsigned int target = ~0U); ++ void VSyncCallback(); + double AdjustHDMIClock(double adjust); + + private: +@@ -80,7 +81,9 @@ class CRBP + bool m_codec_wvc1_enabled; + COMXCore *m_OMX; + DISPMANX_DISPLAY_HANDLE_T m_display; +- CEvent m_vsync; ++ CCriticalSection m_vsync_lock; ++ XbmcThreads::ConditionVariable m_vsync_cond; ++ unsigned int m_vsync_count; + class DllLibOMXCore; + CCriticalSection m_critSection; + + +From 6496fa447a357d146816badb32a4510be40fcfd3 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 29 Jul 2015 14:06:17 +0100 +Subject: [PATCH 73/87] [mmalrenderer] Wait for vsync before submitting to mmal + when display sync is disabled + +This avoids an issue where video occasionally goes stuttery after a seek, until the next pause/play or seek. +The issue is when display sync is disabled, and framerate of video matches display, and render times are coincident with vsync +you find that depending on timestamp/scheduling jitter, you may or may not get an update each vsync resulting in stuttery video. + +Some scheme to force render times to be dependent on vsync is required. We do this by blocking in RenderUpdate unto next vsync. +--- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 23 +++++++++++++++++++++-- + xbmc/cores/VideoRenderers/MMALRenderer.h | 2 ++ + 2 files changed, 23 insertions(+), 2 deletions(-) + +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index fb92079..2e2bc83 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -208,6 +208,7 @@ CMMALRenderer::CMMALRenderer() + m_bMMALConfigured = false; + m_iYV12RenderBuffer = 0; + m_sharpness = -2.0f; ++ m_vsyncCount = ~0; + } + + CMMALRenderer::~CMMALRenderer() +@@ -357,6 +358,24 @@ void CMMALRenderer::Update() + ManageDisplay(); + } + ++void CMMALRenderer::SubmitFrame(MMAL_BUFFER_HEADER_T *buffer) ++{ ++ if (!CSettings::Get().GetBool("videoplayer.usedisplayasclock")) ++ { ++ if (fabs(m_fps - g_graphicsContext.GetFPS()) < 1e-2) ++ { ++ #if defined(MMAL_DEBUG_VERBOSE) ++ CLog::Log(LOGDEBUG, "%s::%s - buffer:%p vfps:%.3f dfps:%.3f vsync:%d dsync:%d", CLASSNAME, __func__, buffer, m_fps, g_graphicsContext.GetFPS(), m_vsyncCount, CSettings::Get().GetBool("videoplayer.usedisplayasclock")); ++ #endif ++ m_vsyncCount = g_RBP.WaitVsync(m_vsyncCount) + 1; ++ #if defined(MMAL_DEBUG_VERBOSE) ++ CLog::Log(LOGDEBUG, "%s::%s - done vsync:%d", CLASSNAME, __func__, m_vsyncCount); ++ #endif ++ } ++ } ++ mmal_port_send_buffer(m_vout_input, buffer); ++} ++ + void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + { + CSingleLock lock(m_sharedSection); +@@ -402,7 +421,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + return; + omvb->Acquire(); + omvb->mmal_buffer->flags |= MMAL_BUFFER_HEADER_FLAG_USER1 | MMAL_BUFFER_HEADER_FLAG_USER2; +- mmal_port_send_buffer(m_vout_input, omvb->mmal_buffer); ++ SubmitFrame(omvb->mmal_buffer); + } + else + CLog::Log(LOGDEBUG, "%s::%s - No buffer to update", CLASSNAME, __func__); +@@ -417,7 +436,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + return; + // sanity check it is not on display + buffer->mmal_buffer->flags |= MMAL_BUFFER_HEADER_FLAG_USER1 | MMAL_BUFFER_HEADER_FLAG_USER2; +- mmal_port_send_buffer(m_vout_input, buffer->mmal_buffer); ++ SubmitFrame(buffer->mmal_buffer); + } + else + CLog::Log(LOGDEBUG, "%s::%s - No buffer to update", CLASSNAME, __func__); +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.h b/xbmc/cores/VideoRenderers/MMALRenderer.h +index 9bced7e..ec279ed 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.h ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.h +@@ -99,6 +99,7 @@ class CMMALRenderer : public CBaseRenderer + unsigned int m_destWidth; + unsigned int m_destHeight; + int m_neededBuffers; ++ int m_vsyncCount; + + CRect m_src_rect; + CRect m_dst_rect; +@@ -115,4 +116,5 @@ class CMMALRenderer : public CBaseRenderer + bool init_vout(ERenderFormat format); + void ReleaseBuffers(); + void UnInitMMAL(); ++ void SubmitFrame(MMAL_BUFFER_HEADER_T *buffer); + }; + +From ad9373bf960c6c7c6e5cc00c59c9dfe856a7e07f Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 29 Jul 2015 15:07:22 +0100 +Subject: [PATCH 74/87] [omxplayer] Support per refresh rate display latency + settings + +--- + xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +index f06ee9c..4ad66a8 100644 +--- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp ++++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +@@ -490,10 +490,10 @@ void OMXPlayerVideo::Process() + double pts = pPacket->pts; + + if (dts != DVD_NOPTS_VALUE) +- dts += m_iVideoDelay; ++ dts += m_iVideoDelay - DVD_SEC_TO_TIME(g_renderManager.GetDisplayLatency()); + + if (pts != DVD_NOPTS_VALUE) +- pts += m_iVideoDelay; ++ pts += m_iVideoDelay - DVD_SEC_TO_TIME(g_renderManager.GetDisplayLatency()); + + m_omxVideo.Decode(pPacket->pData, pPacket->iSize, dts, m_hints.ptsinvalid ? DVD_NOPTS_VALUE : pts); + + +From 3da5401ecbe5206fcaafaf44fa6a2b6e6ee01700 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 29 Jul 2015 15:46:18 +0100 +Subject: [PATCH 75/87] squash: release gfx lock when blocking + +--- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index 2e2bc83..c80a8a6 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -367,6 +367,7 @@ void CMMALRenderer::SubmitFrame(MMAL_BUFFER_HEADER_T *buffer) + #if defined(MMAL_DEBUG_VERBOSE) + CLog::Log(LOGDEBUG, "%s::%s - buffer:%p vfps:%.3f dfps:%.3f vsync:%d dsync:%d", CLASSNAME, __func__, buffer, m_fps, g_graphicsContext.GetFPS(), m_vsyncCount, CSettings::Get().GetBool("videoplayer.usedisplayasclock")); + #endif ++ CSingleExit lock(g_graphicsContext); + m_vsyncCount = g_RBP.WaitVsync(m_vsyncCount) + 1; + #if defined(MMAL_DEBUG_VERBOSE) + CLog::Log(LOGDEBUG, "%s::%s - done vsync:%d", CLASSNAME, __func__, m_vsyncCount); + +From d0c1c12d6dfd9b3294fbaffcb22f2a63ea83c059 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 29 Jul 2015 17:34:11 +0100 +Subject: [PATCH 76/87] [rbp] Leave 3D framepacking output disabled by default + +--- + system/settings/rbp.xml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml +index b27d23f..bf3b05f 100644 +--- a/system/settings/rbp.xml ++++ b/system/settings/rbp.xml +@@ -38,7 +38,7 @@ + true + + 2 +- true ++ false + + + + +From 1bc742744c2910add974ae145b4d72a8133f45ea Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 29 Jul 2015 17:26:30 +0100 +Subject: [PATCH 77/87] [omxplayer] Allow automatic switching back to omxplayer + after it has been disabled + +Omxplayer gets disabled when it is unsuitable (e.g. software decoder required, or ALSA audio or AC3 transcode). +However if you play another file without quitting dvdplayer, it doesn't reconsider. + +E.g. play divx3 file and omxplayer is disabled. If you then launch a h.264 file while first file is still playing it doesn't switch +back to omxplayer as you might expect. + +This patch allows a switch back to omxplayer mode +--- + xbmc/cores/dvdplayer/DVDPlayer.cpp | 5 +++-- + xbmc/cores/omxplayer/OMXHelper.cpp | 3 +++ + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp +index 0ceae20..3fea73f 100644 +--- a/xbmc/cores/dvdplayer/DVDPlayer.cpp ++++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp +@@ -519,10 +519,11 @@ void CDVDPlayer::CreatePlayers() + { + CSingleLock lock(m_players_lock); + #ifdef HAS_OMXPLAYER +- if (m_omxplayer_mode && OMXPlayerUnsuitable(m_HasVideo, m_HasAudio, m_pDemuxer, m_pInputStream, m_SelectionStreams)) ++ bool omx_suitable = !OMXPlayerUnsuitable(m_HasVideo, m_HasAudio, m_pDemuxer, m_pInputStream, m_SelectionStreams); ++ if (m_omxplayer_mode != omx_suitable) + { + DestroyPlayers(); +- m_omxplayer_mode = false; ++ m_omxplayer_mode = omx_suitable; + } + #endif + if (m_players_created) +diff --git a/xbmc/cores/omxplayer/OMXHelper.cpp b/xbmc/cores/omxplayer/OMXHelper.cpp +index 59479fe..014eaf1 100644 +--- a/xbmc/cores/omxplayer/OMXHelper.cpp ++++ b/xbmc/cores/omxplayer/OMXHelper.cpp +@@ -44,6 +44,9 @@ static bool PredicateVideoPriority(const SelectionStream& lh, const SelectionStr + + bool OMXPlayerUnsuitable(bool m_HasVideo, bool m_HasAudio, CDVDDemux* m_pDemuxer, CDVDInputStream* m_pInputStream, CSelectionStreams &m_SelectionStreams) + { ++ // if no OMXPlayer acceleration then it is not suitable ++ if (!CSettings::Get().GetBool("videoplayer.useomxplayer")) ++ return true; + // if no MMAL acceleration stick with omxplayer regardless + if (!CSettings::Get().GetBool("videoplayer.usemmal")) + return false; + +From 32d171107d2184315f18e8eb7b23a78d218f2723 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 29 Jul 2015 21:05:41 +0100 +Subject: [PATCH 78/87] [omxplayer] Set audio properties for passthrough + +We weren't setting the stream_channels property for passthrough for omxplayer (we do with Pi Sink) +That means we were using 2 in number of channels of the AudioInfoFrame packet, rather then 0 +which is 'refer to stream header' which is correct for passthrough +--- + xbmc/cores/omxplayer/OMXAudio.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp +index 1911189..4072f7d 100644 +--- a/xbmc/cores/omxplayer/OMXAudio.cpp ++++ b/xbmc/cores/omxplayer/OMXAudio.cpp +@@ -731,6 +731,8 @@ bool COMXAudio::Initialize(AEAudioFormat format, OMXClock *clock, CDVDStreamInfo + + m_wave_header.dwChannelMask = m_src_chan_layout; + } ++ else ++ SetAudioProps(m_Passthrough, 0); + + m_SampleRate = m_format.m_sampleRate; + m_BitsPerSample = CAEUtil::DataFormatToBits(m_format.m_dataFormat); + +From d0279d2a4dade7122fa5a82b8a5c78faa95c35cb Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 31 Jul 2015 16:38:06 +0100 +Subject: [PATCH 79/87] squash: mmal: increase queue limit to 1 second to avoid + stalls + +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 6cf4023..7fea172 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -859,7 +859,7 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + else if (dts != DVD_NOPTS_VALUE) + m_demuxerPts = dts; + double queued = m_decoderPts != DVD_NOPTS_VALUE && m_demuxerPts != DVD_NOPTS_VALUE ? m_demuxerPts - m_decoderPts : 0.0; +- if (mmal_queue_length(m_dec_input_pool->queue) > 0 && !m_demux_queue_length && queued <= DVD_MSEC_TO_TIME(500)) ++ if (mmal_queue_length(m_dec_input_pool->queue) > 0 && !m_demux_queue_length && queued <= DVD_MSEC_TO_TIME(1000)) + { + if (g_advancedSettings.CanLogComponent(LOGVIDEO)) + CLog::Log(LOGDEBUG, "%s::%s - got space for output: demux_queue(%d) space(%d) queued(%.2f)", CLASSNAME, __func__, m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size, queued*1e-6); + +From c46855572563da98e026cb088a98ca70e7fd06fb Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 6 Aug 2015 11:25:08 +0100 +Subject: [PATCH 80/87] Revert "squash: release gfx lock when blocking" + +This reverts commit f10f0af15d0b57d148f5b3556fd9f94bb2f44509. +--- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index c80a8a6..2e2bc83 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -367,7 +367,6 @@ void CMMALRenderer::SubmitFrame(MMAL_BUFFER_HEADER_T *buffer) + #if defined(MMAL_DEBUG_VERBOSE) + CLog::Log(LOGDEBUG, "%s::%s - buffer:%p vfps:%.3f dfps:%.3f vsync:%d dsync:%d", CLASSNAME, __func__, buffer, m_fps, g_graphicsContext.GetFPS(), m_vsyncCount, CSettings::Get().GetBool("videoplayer.usedisplayasclock")); + #endif +- CSingleExit lock(g_graphicsContext); + m_vsyncCount = g_RBP.WaitVsync(m_vsyncCount) + 1; + #if defined(MMAL_DEBUG_VERBOSE) + CLog::Log(LOGDEBUG, "%s::%s - done vsync:%d", CLASSNAME, __func__, m_vsyncCount); + +From 6b04f338107be6c497f6b0632bfd77cf4b44eb93 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 6 Aug 2015 11:25:21 +0100 +Subject: [PATCH 81/87] Revert "[mmalrenderer] Wait for vsync before submitting + to mmal when display sync is disabled" + +This reverts commit f1a4416194f75f75e2145ec3fe64aee1177d3ccc. +--- + xbmc/cores/VideoRenderers/MMALRenderer.cpp | 23 ++--------------------- + xbmc/cores/VideoRenderers/MMALRenderer.h | 2 -- + 2 files changed, 2 insertions(+), 23 deletions(-) + +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.cpp b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +index 2e2bc83..fb92079 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.cpp ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.cpp +@@ -208,7 +208,6 @@ CMMALRenderer::CMMALRenderer() + m_bMMALConfigured = false; + m_iYV12RenderBuffer = 0; + m_sharpness = -2.0f; +- m_vsyncCount = ~0; + } + + CMMALRenderer::~CMMALRenderer() +@@ -358,24 +357,6 @@ void CMMALRenderer::Update() + ManageDisplay(); + } + +-void CMMALRenderer::SubmitFrame(MMAL_BUFFER_HEADER_T *buffer) +-{ +- if (!CSettings::Get().GetBool("videoplayer.usedisplayasclock")) +- { +- if (fabs(m_fps - g_graphicsContext.GetFPS()) < 1e-2) +- { +- #if defined(MMAL_DEBUG_VERBOSE) +- CLog::Log(LOGDEBUG, "%s::%s - buffer:%p vfps:%.3f dfps:%.3f vsync:%d dsync:%d", CLASSNAME, __func__, buffer, m_fps, g_graphicsContext.GetFPS(), m_vsyncCount, CSettings::Get().GetBool("videoplayer.usedisplayasclock")); +- #endif +- m_vsyncCount = g_RBP.WaitVsync(m_vsyncCount) + 1; +- #if defined(MMAL_DEBUG_VERBOSE) +- CLog::Log(LOGDEBUG, "%s::%s - done vsync:%d", CLASSNAME, __func__, m_vsyncCount); +- #endif +- } +- } +- mmal_port_send_buffer(m_vout_input, buffer); +-} +- + void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + { + CSingleLock lock(m_sharedSection); +@@ -421,7 +402,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + return; + omvb->Acquire(); + omvb->mmal_buffer->flags |= MMAL_BUFFER_HEADER_FLAG_USER1 | MMAL_BUFFER_HEADER_FLAG_USER2; +- SubmitFrame(omvb->mmal_buffer); ++ mmal_port_send_buffer(m_vout_input, omvb->mmal_buffer); + } + else + CLog::Log(LOGDEBUG, "%s::%s - No buffer to update", CLASSNAME, __func__); +@@ -436,7 +417,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) + return; + // sanity check it is not on display + buffer->mmal_buffer->flags |= MMAL_BUFFER_HEADER_FLAG_USER1 | MMAL_BUFFER_HEADER_FLAG_USER2; +- SubmitFrame(buffer->mmal_buffer); ++ mmal_port_send_buffer(m_vout_input, buffer->mmal_buffer); + } + else + CLog::Log(LOGDEBUG, "%s::%s - No buffer to update", CLASSNAME, __func__); +diff --git a/xbmc/cores/VideoRenderers/MMALRenderer.h b/xbmc/cores/VideoRenderers/MMALRenderer.h +index ec279ed..9bced7e 100644 +--- a/xbmc/cores/VideoRenderers/MMALRenderer.h ++++ b/xbmc/cores/VideoRenderers/MMALRenderer.h +@@ -99,7 +99,6 @@ class CMMALRenderer : public CBaseRenderer + unsigned int m_destWidth; + unsigned int m_destHeight; + int m_neededBuffers; +- int m_vsyncCount; + + CRect m_src_rect; + CRect m_dst_rect; +@@ -116,5 +115,4 @@ class CMMALRenderer : public CBaseRenderer + bool init_vout(ERenderFormat format); + void ReleaseBuffers(); + void UnInitMMAL(); +- void SubmitFrame(MMAL_BUFFER_HEADER_T *buffer); + }; + +From 58caaea7ca2dd3fc49aa9a1eb0ddbb59b5a8d047 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 6 Aug 2015 11:25:30 +0100 +Subject: [PATCH 82/87] Revert "[rbp] Refactor the vsync handle to support + multiple callers" + +This reverts commit 68bd91282359a9da4645af4eeead7b2842f835eb. +--- + xbmc/linux/RBP.cpp | 68 ++++++++++++++++++++++++------------------------------ + xbmc/linux/RBP.h | 7 ++---- + 2 files changed, 32 insertions(+), 43 deletions(-) + +diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp +index 901250e..3953740 100644 +--- a/xbmc/linux/RBP.cpp ++++ b/xbmc/linux/RBP.cpp +@@ -66,7 +66,6 @@ CRBP::CRBP() + m_enabled = 0; + m_mb = mbox_open(); + vcsm_init(); +- m_vsync_count = 0; + } + + CRBP::~CRBP() +@@ -144,45 +143,11 @@ void CRBP::LogFirmwareVerison() + CLog::Log(LOGNOTICE, "Config:\n%s", response); + } + +-static void vsync_callback_static(DISPMANX_UPDATE_HANDLE_T u, void *arg) +-{ +- CRBP *rbp = reinterpret_cast(arg); +- rbp->VSyncCallback(); +-} +- +-void CRBP::VSyncCallback() +-{ +- CSingleLock lock(m_vsync_lock); +- m_vsync_count++; +- m_vsync_cond.notifyAll(); +-} +- +-unsigned int CRBP::WaitVsync(unsigned int target) +-{ +- CSingleLock lock(m_vsync_lock); +- if (target == ~0U) +- target = m_vsync_count+1; +- +- if (m_display == DISPMANX_NO_HANDLE) +- { +- CLog::Log(LOGDEBUG, "CRBP::%s skipping while display closed", __func__); +- return m_vsync_count; +- } +- +- while (m_vsync_count < target) +- if (!m_vsync_cond.wait(lock, 100)) +- break; +- +- return m_vsync_count; +-} +- + DISPMANX_DISPLAY_HANDLE_T CRBP::OpenDisplay(uint32_t device) + { + if (m_display == DISPMANX_NO_HANDLE) + { + m_display = vc_dispmanx_display_open( 0 /*screen*/ ); +- int s = vc_dispmanx_vsync_callback(m_display, vsync_callback_static, (void *)this); +- assert(s == 0); + init_cursor(); + } + return m_display; +@@ -191,11 +156,9 @@ DISPMANX_DISPLAY_HANDLE_T CRBP::OpenDisplay(uint32_t device) + void CRBP::CloseDisplay(DISPMANX_DISPLAY_HANDLE_T display) + { + assert(display == m_display); +- int s = vc_dispmanx_vsync_callback(m_display, NULL, NULL); +- assert(s == 0); +- uninit_cursor(); + vc_dispmanx_display_close(m_display); + m_display = DISPMANX_NO_HANDLE; ++ uninit_cursor(); + } + + void CRBP::GetDisplaySize(int &width, int &height) +@@ -248,6 +211,35 @@ unsigned char *CRBP::CaptureDisplay(int width, int height, int *pstride, bool sw + return image; + } + ++ ++static void vsync_callback(DISPMANX_UPDATE_HANDLE_T u, void *arg) ++{ ++ CEvent *sync = (CEvent *)arg; ++ sync->Set(); ++} ++ ++void CRBP::WaitVsync() ++{ ++ int s; ++ DISPMANX_DISPLAY_HANDLE_T m_display = vc_dispmanx_display_open( 0 /*screen*/ ); ++ if (m_display == DISPMANX_NO_HANDLE) ++ { ++ CLog::Log(LOGDEBUG, "CRBP::%s skipping while display closed", __func__); ++ return; ++ } ++ m_vsync.Reset(); ++ s = vc_dispmanx_vsync_callback(m_display, vsync_callback, (void *)&m_vsync); ++ if (s == 0) ++ { ++ m_vsync.WaitMSec(1000); ++ } ++ else assert(0); ++ s = vc_dispmanx_vsync_callback(m_display, NULL, NULL); ++ assert(s == 0); ++ vc_dispmanx_display_close( m_display ); ++} ++ ++ + void CRBP::Deinitialize() + { + if (m_omx_image_init) +diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h +index 0572b47..be0cafc 100644 +--- a/xbmc/linux/RBP.h ++++ b/xbmc/linux/RBP.h +@@ -65,8 +65,7 @@ class CRBP + // stride can be null for packed output + unsigned char *CaptureDisplay(int width, int height, int *stride, bool swap_red_blue, bool video_only = true); + DllOMX *GetDllOMX() { return m_OMX ? m_OMX->GetDll() : NULL; } +- unsigned int WaitVsync(unsigned int target = ~0U); +- void VSyncCallback(); ++ void WaitVsync(); + double AdjustHDMIClock(double adjust); + + private: +@@ -81,9 +80,7 @@ class CRBP + bool m_codec_wvc1_enabled; + COMXCore *m_OMX; + DISPMANX_DISPLAY_HANDLE_T m_display; +- CCriticalSection m_vsync_lock; +- XbmcThreads::ConditionVariable m_vsync_cond; +- unsigned int m_vsync_count; ++ CEvent m_vsync; + class DllLibOMXCore; + CCriticalSection m_critSection; + + +From af0aa61f6d78364f9b65c413b87d2e09953aa449 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 6 Aug 2015 11:23:05 +0100 +Subject: [PATCH 83/87] [rbp] Make sync playback to display the default option + +--- + system/settings/rbp.xml | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml +index bf3b05f..0743176 100644 +--- a/system/settings/rbp.xml ++++ b/system/settings/rbp.xml +@@ -1,6 +1,13 @@ + + +
++ ++ ++ ++ true ++ ++ ++ + + + false + +From 7470bc8ba9710bd15e180d96ee72ee58a545c766 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 31 Jul 2015 18:39:31 +0100 +Subject: [PATCH 84/87] [mmalcodec] Tidy up debug logging for decode + +--- + xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp | 16 ++++------------ + 1 file changed, 4 insertions(+), 12 deletions(-) + +diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +index 7fea172..756b845 100644 +--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp ++++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/MMALCodec.cpp +@@ -860,11 +860,7 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + m_demuxerPts = dts; + double queued = m_decoderPts != DVD_NOPTS_VALUE && m_demuxerPts != DVD_NOPTS_VALUE ? m_demuxerPts - m_decoderPts : 0.0; + if (mmal_queue_length(m_dec_input_pool->queue) > 0 && !m_demux_queue_length && queued <= DVD_MSEC_TO_TIME(1000)) +- { +- if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +- CLog::Log(LOGDEBUG, "%s::%s - got space for output: demux_queue(%d) space(%d) queued(%.2f)", CLASSNAME, __func__, m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size, queued*1e-6); + ret |= VC_BUFFER; +- } + else + m_preroll = false; + +@@ -873,21 +869,17 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts) + + if (!m_output_ready.empty() && !m_preroll) + { +- if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +- CLog::Log(LOGDEBUG, "%s::%s - got output picture:%d", CLASSNAME, __func__, m_output_ready.size()); + ret |= VC_PICTURE; + // renderer is low - give priority to returning pictures + if (0 && m_codecControlFlags & DVD_CODEC_CTRL_DRAIN) + ret &= ~VC_BUFFER; + } + if (!ret) +- { +- if (g_advancedSettings.CanLogComponent(LOGVIDEO)) +- CLog::Log(LOGDEBUG, "%s::%s - Nothing to do: ready_queue(%d) demux_queue(%d) space(%d) preroll(%d)", +- CLASSNAME, __func__, m_output_ready.size(), m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size, m_preroll); +- lock.Leave(); + Sleep(10); // otherwise we busy spin +- } ++ ++ if (g_advancedSettings.CanLogComponent(LOGVIDEO)) ++ CLog::Log(LOGDEBUG, "%s::%s - ret(%x) pics(%d) demux_queue(%d) space(%d) queued(%.2f) preroll(%d) flags(%x)", CLASSNAME, __func__, ret, m_output_ready.size(), m_demux_queue_length, mmal_queue_length(m_dec_input_pool->queue) * m_dec_input->buffer_size, queued*1e-6, m_preroll, m_codecControlFlags); ++ + return ret; + } + + +From 4848cab3632652bfaa89f0e822a1b224015f2427 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 6 Aug 2015 13:25:32 +0100 +Subject: [PATCH 85/87] [rbp] Don't enable DTS-HD by default on Pi2 + +Reports of no audio with omxplayer and this enabled +that are not yet understood +--- + system/settings/rbp2.xml | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/system/settings/rbp2.xml b/system/settings/rbp2.xml +index 1c8b116..52778ecd 100644 +--- a/system/settings/rbp2.xml ++++ b/system/settings/rbp2.xml +@@ -19,11 +19,6 @@ + + + +- +- +- true +- +- + + + + +From 4a133a4a6c64f9c4811f10e8cecd4036080d15b8 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 7 Aug 2015 18:09:09 +0100 +Subject: [PATCH 86/87] Revert "[rbp] Don't enable DTS-HD by default on Pi2" + +This reverts commit 8166e8990b8cf599cc4eb1641c58fad1f1f0821f. +--- + system/settings/rbp2.xml | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/system/settings/rbp2.xml b/system/settings/rbp2.xml +index 52778ecd..1c8b116 100644 +--- a/system/settings/rbp2.xml ++++ b/system/settings/rbp2.xml +@@ -19,6 +19,11 @@ + + + ++ ++ ++ true ++ ++ + + + diff --git a/projects/RPi2/patches/linux/linux-01-RPi_support.patch b/projects/RPi2/patches/linux/linux-01-RPi_support.patch index 9da370c113..d6377736e5 100644 --- a/projects/RPi2/patches/linux/linux-01-RPi_support.patch +++ b/projects/RPi2/patches/linux/linux-01-RPi_support.patch @@ -1,7 +1,7 @@ -From f12410478cffff991f5e3c3d3fd68bab0bd33c2c Mon Sep 17 00:00:00 2001 +From 0e8bd84a8406e37307c00a246c5a0f62aac6b8d3 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 12 May 2013 12:24:19 +0100 -Subject: [PATCH 001/105] Main bcm2708/bcm2709 linux port +Subject: [PATCH 001/149] Main bcm2708/bcm2709 linux port MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -7002,370 +7002,10 @@ index b5bedae..b0258e8 100644 mmc_pm_flag_t pm_caps; /* supported pm features */ -From e3d3c97f9f253df42f218071e9f9bb7fd8f602f0 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 16 Jun 2015 23:48:09 +0100 -Subject: [PATCH 002/105] power: Add power driver -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: popcornmix - -BCM270x: power: Change initcall level to subsys - -Load ordering of modules are determined by the initcall used. -If it's the same initcall level, makefile ordering decides. -Now that the mailbox driver is being moved, it's no longer -placed before the power driver by the linker. -So use a later initcall level to let the mailbox driver -load first. - -Signed-off-by: Noralf Trønnes - -BCM270x: Move power module - -Make the power module available on ARCH_BCM2835 by moving it. -The module turns on USB power making it possible to boot -ARCH_BCM2835 directly with the VC bootloader. - -Signed-off-by: Noralf Trønnes ---- - drivers/soc/Kconfig | 1 + - drivers/soc/Makefile | 1 + - drivers/soc/bcm2835/Kconfig | 9 ++ - drivers/soc/bcm2835/Makefile | 1 + - drivers/soc/bcm2835/bcm2708-power.c | 200 ++++++++++++++++++++++++++++++++++++ - include/soc/bcm2835/power.h | 61 +++++++++++ - 6 files changed, 273 insertions(+) - create mode 100644 drivers/soc/bcm2835/Kconfig - create mode 100644 drivers/soc/bcm2835/Makefile - create mode 100644 drivers/soc/bcm2835/bcm2708-power.c - create mode 100644 include/soc/bcm2835/power.h - -diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig -index d8bde82..595c9cd 100644 ---- a/drivers/soc/Kconfig -+++ b/drivers/soc/Kconfig -@@ -1,5 +1,6 @@ - menu "SOC (System On Chip) specific Drivers" - -+source "drivers/soc/bcm2835/Kconfig" - source "drivers/soc/mediatek/Kconfig" - source "drivers/soc/qcom/Kconfig" - source "drivers/soc/ti/Kconfig" -diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile -index 70042b2..9ad449c 100644 ---- a/drivers/soc/Makefile -+++ b/drivers/soc/Makefile -@@ -2,6 +2,7 @@ - # Makefile for the Linux Kernel SOC specific device drivers. - # - -+obj-y += bcm2835/ - obj-$(CONFIG_ARCH_MEDIATEK) += mediatek/ - obj-$(CONFIG_ARCH_QCOM) += qcom/ - obj-$(CONFIG_ARCH_TEGRA) += tegra/ -diff --git a/drivers/soc/bcm2835/Kconfig b/drivers/soc/bcm2835/Kconfig -new file mode 100644 -index 0000000..c2980f3 ---- /dev/null -+++ b/drivers/soc/bcm2835/Kconfig -@@ -0,0 +1,9 @@ -+# -+# BCM2835 Soc drivers -+# -+config BCM2708_POWER -+ tristate "BCM2708 legacy power driver" -+ depends on (ARCH_BCM2708 || ARCH_BCM2709 || ARCH_BCM2835) && BCM2708_MBOX -+ default y -+ help -+ Turns on USB power and provides an API for controlling power. -diff --git a/drivers/soc/bcm2835/Makefile b/drivers/soc/bcm2835/Makefile -new file mode 100644 -index 0000000..3614ad9 ---- /dev/null -+++ b/drivers/soc/bcm2835/Makefile -@@ -0,0 +1 @@ -+obj-$(CONFIG_BCM2708_POWER) += bcm2708-power.o -diff --git a/drivers/soc/bcm2835/bcm2708-power.c b/drivers/soc/bcm2835/bcm2708-power.c -new file mode 100644 -index 0000000..e7931a9 ---- /dev/null -+++ b/drivers/soc/bcm2835/bcm2708-power.c -@@ -0,0 +1,200 @@ -+/* -+ * linux/arch/arm/mach-bcm2708/power.c -+ * -+ * Copyright (C) 2010 Broadcom -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ * This device provides a shared mechanism for controlling the power to -+ * VideoCore subsystems. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#define DRIVER_NAME "bcm2708_power" -+ -+#define BCM_POWER_MAXCLIENTS 4 -+#define BCM_POWER_NOCLIENT (1<<31) -+ -+/* Some drivers expect there devices to be permanently powered */ -+ -+#ifdef CONFIG_USB -+#define BCM_POWER_ALWAYS_ON (BCM_POWER_USB) -+#endif -+ -+#if 1 -+#define DPRINTK printk -+#else -+#define DPRINTK if (0) printk -+#endif -+ -+struct state_struct { -+ uint32_t global_request; -+ uint32_t client_request[BCM_POWER_MAXCLIENTS]; -+ struct semaphore client_mutex; -+ struct semaphore mutex; -+} g_state; -+ -+int bcm_power_open(BCM_POWER_HANDLE_T *handle) -+{ -+ BCM_POWER_HANDLE_T i; -+ int ret = -EBUSY; -+ -+ down(&g_state.client_mutex); -+ -+ for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) { -+ if (g_state.client_request[i] == BCM_POWER_NOCLIENT) { -+ g_state.client_request[i] = BCM_POWER_NONE; -+ *handle = i; -+ ret = 0; -+ break; -+ } -+ } -+ -+ up(&g_state.client_mutex); -+ -+ DPRINTK("bcm_power_open() -> %d\n", *handle); -+ -+ return ret; -+} -+EXPORT_SYMBOL_GPL(bcm_power_open); -+ -+int bcm_power_request(BCM_POWER_HANDLE_T handle, uint32_t request) -+{ -+ int rc = 0; -+ -+ DPRINTK("bcm_power_request(%d, %x)\n", handle, request); -+ -+ if ((handle < BCM_POWER_MAXCLIENTS) && -+ (g_state.client_request[handle] != BCM_POWER_NOCLIENT)) { -+ if (down_interruptible(&g_state.mutex) != 0) { -+ DPRINTK("bcm_power_request -> interrupted\n"); -+ return -EINTR; -+ } -+ -+ if (request != g_state.client_request[handle]) { -+ uint32_t others_request = 0; -+ uint32_t global_request; -+ BCM_POWER_HANDLE_T i; -+ -+ for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) { -+ if (i != handle) -+ others_request |= -+ g_state.client_request[i]; -+ } -+ others_request &= ~BCM_POWER_NOCLIENT; -+ -+ global_request = request | others_request; -+ if (global_request != g_state.global_request) { -+ uint32_t actual; -+ -+ /* Send a request to VideoCore */ -+ bcm_mailbox_write(MBOX_CHAN_POWER, -+ global_request << 4); -+ -+ /* Wait for a response during power-up */ -+ if (global_request & ~g_state.global_request) { -+ rc = bcm_mailbox_read(MBOX_CHAN_POWER, -+ &actual); -+ DPRINTK -+ ("bcm_mailbox_read -> %08x, %d\n", -+ actual, rc); -+ actual >>= 4; -+ } else { -+ rc = 0; -+ actual = global_request; -+ } -+ -+ if (rc == 0) { -+ if (actual != global_request) { -+ printk(KERN_ERR -+ "%s: prev global %x, new global %x, actual %x, request %x, others_request %x\n", -+ __func__, -+ g_state.global_request, -+ global_request, actual, request, others_request); -+ /* A failure */ -+ BUG_ON((others_request & actual) -+ != others_request); -+ request &= actual; -+ rc = -EIO; -+ } -+ -+ g_state.global_request = actual; -+ g_state.client_request[handle] = -+ request; -+ } -+ } -+ } -+ up(&g_state.mutex); -+ } else { -+ rc = -EINVAL; -+ } -+ DPRINTK("bcm_power_request -> %d\n", rc); -+ return rc; -+} -+EXPORT_SYMBOL_GPL(bcm_power_request); -+ -+int bcm_power_close(BCM_POWER_HANDLE_T handle) -+{ -+ int rc; -+ -+ DPRINTK("bcm_power_close(%d)\n", handle); -+ -+ rc = bcm_power_request(handle, BCM_POWER_NONE); -+ if (rc == 0) -+ g_state.client_request[handle] = BCM_POWER_NOCLIENT; -+ -+ return rc; -+} -+EXPORT_SYMBOL_GPL(bcm_power_close); -+ -+static int __init bcm_power_init(void) -+{ -+#if defined(BCM_POWER_ALWAYS_ON) -+ BCM_POWER_HANDLE_T always_on_handle; -+#endif -+ int rc = 0; -+ int i; -+ -+ printk(KERN_INFO "bcm_power: Broadcom power driver\n"); -+ bcm_mailbox_write(MBOX_CHAN_POWER, 0); -+ -+ for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) -+ g_state.client_request[i] = BCM_POWER_NOCLIENT; -+ -+ sema_init(&g_state.client_mutex, 1); -+ sema_init(&g_state.mutex, 1); -+ -+ g_state.global_request = 0; -+ -+#if defined(BCM_POWER_ALWAYS_ON) -+ if (BCM_POWER_ALWAYS_ON) { -+ bcm_power_open(&always_on_handle); -+ bcm_power_request(always_on_handle, BCM_POWER_ALWAYS_ON); -+ } -+#endif -+ -+ return rc; -+} -+ -+static void __exit bcm_power_exit(void) -+{ -+ bcm_mailbox_write(MBOX_CHAN_POWER, 0); -+} -+ -+/* -+ * Load after the mailbox driver is initialized (arch_initcall), -+ * but before depending drivers (module_init). -+ */ -+subsys_initcall(bcm_power_init); -+module_exit(bcm_power_exit); -+ -+MODULE_AUTHOR("Phil Elwell"); -+MODULE_DESCRIPTION("Interface to BCM2708 power management"); -+MODULE_LICENSE("GPL"); -diff --git a/include/soc/bcm2835/power.h b/include/soc/bcm2835/power.h -new file mode 100644 -index 0000000..bf22b26 ---- /dev/null -+++ b/include/soc/bcm2835/power.h -@@ -0,0 +1,61 @@ -+/* -+ * Copyright (C) 2010 Broadcom -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ * This device provides a shared mechanism for controlling the power to -+ * VideoCore subsystems. -+ */ -+ -+#ifndef _BCM2708_POWER_H -+#define _BCM2708_POWER_H -+ -+#include -+ -+/* Use meaningful names on each side */ -+#ifdef __VIDEOCORE__ -+#define PREFIX(x) ARM_##x -+#else -+#define PREFIX(x) BCM_##x -+#endif -+ -+enum { -+ PREFIX(POWER_SDCARD_BIT), -+ PREFIX(POWER_UART_BIT), -+ PREFIX(POWER_MINIUART_BIT), -+ PREFIX(POWER_USB_BIT), -+ PREFIX(POWER_I2C0_BIT), -+ PREFIX(POWER_I2C1_BIT), -+ PREFIX(POWER_I2C2_BIT), -+ PREFIX(POWER_SPI_BIT), -+ PREFIX(POWER_CCP2TX_BIT), -+ PREFIX(POWER_DSI_BIT), -+ -+ PREFIX(POWER_MAX) -+}; -+ -+enum { -+ PREFIX(POWER_SDCARD) = (1 << PREFIX(POWER_SDCARD_BIT)), -+ PREFIX(POWER_UART) = (1 << PREFIX(POWER_UART_BIT)), -+ PREFIX(POWER_MINIUART) = (1 << PREFIX(POWER_MINIUART_BIT)), -+ PREFIX(POWER_USB) = (1 << PREFIX(POWER_USB_BIT)), -+ PREFIX(POWER_I2C0) = (1 << PREFIX(POWER_I2C0_BIT)), -+ PREFIX(POWER_I2C1_MASK) = (1 << PREFIX(POWER_I2C1_BIT)), -+ PREFIX(POWER_I2C2_MASK) = (1 << PREFIX(POWER_I2C2_BIT)), -+ PREFIX(POWER_SPI_MASK) = (1 << PREFIX(POWER_SPI_BIT)), -+ PREFIX(POWER_CCP2TX_MASK) = (1 << PREFIX(POWER_CCP2TX_BIT)), -+ PREFIX(POWER_DSI) = (1 << PREFIX(POWER_DSI_BIT)), -+ -+ PREFIX(POWER_MASK) = (1 << PREFIX(POWER_MAX)) - 1, -+ PREFIX(POWER_NONE) = 0 -+}; -+ -+typedef unsigned int BCM_POWER_HANDLE_T; -+ -+extern int bcm_power_open(BCM_POWER_HANDLE_T *handle); -+extern int bcm_power_request(BCM_POWER_HANDLE_T handle, uint32_t request); -+extern int bcm_power_close(BCM_POWER_HANDLE_T handle); -+ -+#endif - -From 6f7a17a848b57ac66f13d9ee9f09f4be89e74824 Mon Sep 17 00:00:00 2001 +From 347ffd7de4bb0ccd64731fb76814dd9e626bf1c5 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 8 Oct 2014 18:50:05 +0100 -Subject: [PATCH 003/105] Add bcm2708_gpio driver +Subject: [PATCH 002/149] Add bcm2708_gpio driver Signed-off-by: popcornmix @@ -7995,10 +7635,10 @@ index 0000000..fb69624 + +#endif -From e1fa284edd01b1a623096845dbe54c8d936aaaaf Mon Sep 17 00:00:00 2001 +From eb3917f2c39b485511607da826cd9dbba16751b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 1 May 2015 19:11:03 +0200 -Subject: [PATCH 004/105] mailbox: bcm2708: Add bcm2708-vcio +Subject: [PATCH 003/149] mailbox: bcm2708: Add bcm2708-vcio MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -8629,10 +8269,10 @@ index 0000000..cc284ed + +#endif -From 495cfff15f23f9b3ee26b0b92673ad77fc3e8d22 Mon Sep 17 00:00:00 2001 +From dac4f2f5791de43cb28c829c03b74b03187b7535 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 19:46:17 +0100 -Subject: [PATCH 005/105] Add dwc_otg driver +Subject: [PATCH 004/149] Add dwc_otg driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -9540,10 +9180,10 @@ index 358ca8d..abaac7c 100644 return i; } diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index 3b71516..8324c14 100644 +index 1e9a8c9..7e9f79f 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c -@@ -4922,7 +4922,7 @@ static void port_event(struct usb_hub *hub, int port1) +@@ -4906,7 +4906,7 @@ static void port_event(struct usb_hub *hub, int port1) if (portchange & USB_PORT_STAT_C_OVERCURRENT) { u16 status = 0, unused; @@ -69906,10 +69546,10 @@ index 0000000..cdc9963 +test_main(); +0; -From 2fee602715f8de08540132094fe160dd21978680 Mon Sep 17 00:00:00 2001 +From cb7293f71c4de308f8d2f1dda81889fa1ccc5f70 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 19:54:32 +0100 -Subject: [PATCH 006/105] bcm2708 watchdog driver +Subject: [PATCH 005/149] bcm2708 watchdog driver Signed-off-by: popcornmix --- @@ -70346,10 +69986,10 @@ index 0000000..8a27d68 +MODULE_ALIAS_MISCDEV(TEMP_MINOR); +MODULE_LICENSE("GPL"); -From 164b737c320aca85798130a904c964f748423937 Mon Sep 17 00:00:00 2001 +From 3f93f22131290ce805bd9fe0a2c23fc23e9d0d02 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 17:06:34 +0100 -Subject: [PATCH 007/105] bcm2708 framebuffer driver +Subject: [PATCH 006/149] bcm2708 framebuffer driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -73788,10 +73428,10 @@ index 3c14e43..7626beb6a 100644 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 -From b1c418d504c5c7b800fee387abf9a03af0e1b4a4 Mon Sep 17 00:00:00 2001 +From d7b8efef115448b4899c4d3327cbdfed06144d29 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:22:53 +0100 -Subject: [PATCH 008/105] dmaengine: Add support for BCM2708 +Subject: [PATCH 007/149] dmaengine: Add support for BCM2708 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -75559,10 +75199,10 @@ index 0000000..2310e34 + +#endif /* _PLAT_BCM2708_DMA_H */ -From 8500a8de635dc4ce251330dfe0950453689d7a65 Mon Sep 17 00:00:00 2001 +From c5a2f57f382bb863ec39be702d5c7dd1abf43a1e Mon Sep 17 00:00:00 2001 From: gellert Date: Fri, 15 Aug 2014 16:35:06 +0100 -Subject: [PATCH 009/105] MMC: added alternative MMC driver +Subject: [PATCH 008/149] MMC: added alternative MMC driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -77378,10 +77018,10 @@ index 0000000..b7c4883 +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Gellert Weisz"); -From 6a1f159f160fec9d7b8f10cc0b37c79c58be80c8 Mon Sep 17 00:00:00 2001 +From 42f6bf501dfd96a293a001811c66f81a599a7c0a Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 25 Mar 2015 17:49:47 +0000 -Subject: [PATCH 010/105] Adding bcm2835-sdhost driver, and an overlay to +Subject: [PATCH 009/149] Adding bcm2835-sdhost driver, and an overlay to enable it BCM2835 has two SD card interfaces. This driver uses the other one. @@ -79151,10 +78791,10 @@ index 0000000..eef8a24 +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Phil Elwell"); -From 8f5a0afb8bc65e48695b38a33dba8a17bb0c4218 Mon Sep 17 00:00:00 2001 +From 4e1d2a7a36c3a6a50b8e3e180840f5de3c59dab9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:31:47 +0100 -Subject: [PATCH 011/105] cma: Add vc_cma driver to enable use of CMA +Subject: [PATCH 010/149] cma: Add vc_cma driver to enable use of CMA Signed-off-by: popcornmix @@ -80479,10 +80119,10 @@ index 0000000..5325832 + +#endif /* VC_CMA_H */ -From 8af8b7d264e546ee29b28acca735bd4ce8dbdb71 Mon Sep 17 00:00:00 2001 +From 0e75dc8f6ada5d524b64787a3f6a1f7774c19ad1 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 26 Mar 2012 22:15:50 +0100 -Subject: [PATCH 012/105] bcm2708: alsa sound driver +Subject: [PATCH 011/149] bcm2708: alsa sound driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -83324,10 +82964,10 @@ index 0000000..af3e6eb + +#endif // _VC_AUDIO_DEFS_H_ -From d01fbc5cd5784094ffe247f269eaa1b31bb023d5 Mon Sep 17 00:00:00 2001 +From f99733b7c93f18f7bb2519462760a71817e2282c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 2 Jul 2013 23:42:01 +0100 -Subject: [PATCH 013/105] bcm2708 vchiq driver +Subject: [PATCH 012/149] bcm2708 vchiq driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -96581,10 +96221,10 @@ index 0000000..b6bfa21 + return vchiq_build_time; +} -From efc783d883c14618d52d0d804a856ee31a152fcb Mon Sep 17 00:00:00 2001 +From bb99de1085903aae1acd33f9333636668a2d0940 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 16:07:06 +0100 -Subject: [PATCH 014/105] vc_mem: Add vc_mem driver +Subject: [PATCH 013/149] vc_mem: Add vc_mem driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -97590,10 +97230,10 @@ index 0000000..20a4753 + +#endif /* _VC_MEM_H */ -From 72c49d81f0dd002228b6cb26db9e5428eef39d41 Mon Sep 17 00:00:00 2001 +From 2835e674ab3568be62a2cd50e060f4172c6d7760 Mon Sep 17 00:00:00 2001 From: Tim Gover Date: Tue, 22 Jul 2014 15:41:04 +0100 -Subject: [PATCH 015/105] vcsm: VideoCore shared memory service for BCM2835 +Subject: [PATCH 014/149] vcsm: VideoCore shared memory service for BCM2835 Add experimental support for the VideoCore shared memory service. This allows user processes to allocate memory from VideoCore's @@ -102003,10 +101643,10 @@ index 0000000..0bfb42e +MODULE_DESCRIPTION("VideoCore SharedMemory Driver"); +MODULE_LICENSE("GPL v2"); -From 6b13df3a424914c3db0687d471236611c0cd6d60 Mon Sep 17 00:00:00 2001 +From d956b1bd6c339852f27e912d2e79ed1ae1f770d3 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:51:55 +0100 -Subject: [PATCH 016/105] Add hwrng (hardware random number generator) driver +Subject: [PATCH 015/149] Add hwrng (hardware random number generator) driver --- drivers/char/hw_random/Kconfig | 13 +++- @@ -102183,10 +101823,10 @@ index 0000000..340f004 +MODULE_DESCRIPTION("BCM2708 H/W Random Number Generator (RNG) driver"); +MODULE_LICENSE("GPL and additional rights"); -From 71858ccb0a96e022238c9644177fcbf891807ffd Mon Sep 17 00:00:00 2001 +From 0a234b968ca8409fdf24ee38b84144ea6df901c1 Mon Sep 17 00:00:00 2001 From: Aron Szabo Date: Sat, 16 Jun 2012 12:15:55 +0200 -Subject: [PATCH 017/105] lirc: added support for RaspberryPi GPIO +Subject: [PATCH 016/149] lirc: added support for RaspberryPi GPIO lirc_rpi: Use read_current_timer to determine transmitter delay. Thanks to jjmz and others See: https://github.com/raspberrypi/linux/issues/525 @@ -103039,10 +102679,10 @@ index 0000000..24563ec +module_param(debug, bool, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(debug, "Enable debugging messages"); -From 36fe69547259b45803b0cb11085d60374c92446a Mon Sep 17 00:00:00 2001 +From 8aa5df1654dc0d99e6edaee56960a62a759642f6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:49:20 +0100 -Subject: [PATCH 018/105] Add cpufreq driver +Subject: [PATCH 017/149] Add cpufreq driver Signed-off-by: popcornmix --- @@ -103315,10 +102955,10 @@ index 0000000..6735da9 +module_init(bcm2835_cpufreq_module_init); +module_exit(bcm2835_cpufreq_module_exit); -From 50d7170ec5cf300e239ab575de3e0917ec44b8a6 Mon Sep 17 00:00:00 2001 +From a78e95402f25318bb6049c253a586bdabf0e3934 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 19:24:24 +0000 -Subject: [PATCH 019/105] Added hwmon/thermal driver for reporting core +Subject: [PATCH 018/149] Added hwmon/thermal driver for reporting core temperature. Thanks Dorian MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -103615,10 +103255,10 @@ index 0000000..3bc80f1 + +module_platform_driver(bcm2835_thermal_driver); -From 4011c7c5c3c5a03af182dbed2e824a491d12e96c Mon Sep 17 00:00:00 2001 +From fe524efc70536aa67e3568f97bc373031e4de4ea Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 15:41:33 +0100 -Subject: [PATCH 020/105] Add Chris Boot's spi driver. +Subject: [PATCH 019/149] Add Chris Boot's spi driver. spi: bcm2708: add device tree support @@ -104530,10 +104170,10 @@ index 0000000..041b5e2 +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRV_NAME); -From 04e6956b7d15554967ca2620563efc31a63cd69e Mon Sep 17 00:00:00 2001 +From b42f499d093bb6ed2991c6f304338bff3a85b429 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 15:44:08 +0100 -Subject: [PATCH 021/105] Add Chris Boot's i2c driver +Subject: [PATCH 020/149] Add Chris Boot's i2c driver i2c-bcm2708: fixed baudrate @@ -105334,10 +104974,10 @@ index 0000000..8773203 +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRV_NAME); -From 9ed8236717339aab28673519a2300e6f0165d2da Mon Sep 17 00:00:00 2001 +From 8e40d3346d2607cee13a9eee8c2357b1c0cdb48a Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 30 Jan 2013 12:45:18 +0000 -Subject: [PATCH 022/105] bcm2835: add v4l2 camera device +Subject: [PATCH 021/149] bcm2835: add v4l2 camera device - Supports raw YUV capture, preview, JPEG and H264. - Uses videobuf2 for data transfer, using dma_buf. @@ -112664,10 +112304,10 @@ index 0000000..9d1d11e + +#endif /* MMAL_VCHIQ_H */ -From 8daf7f4a4f40fd1d6008fa8438d72ae3c9f2cd4f Mon Sep 17 00:00:00 2001 +From 7a4688d4481948917c7d09d4745c21c7f802da18 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 23 Jan 2015 14:48:55 +0000 -Subject: [PATCH 023/105] scripts/dtc: Update to upstream version with overlay +Subject: [PATCH 022/149] scripts/dtc: Update to upstream version with overlay patches --- @@ -117515,7 +117155,7 @@ index 665dad7..f439b40 100644 } diff --git a/scripts/dtc/fstree.c b/scripts/dtc/fstree.c -index e464727..6e5878a 100644 +index e464727c..6e5878a 100644 --- a/scripts/dtc/fstree.c +++ b/scripts/dtc/fstree.c @@ -37,26 +37,26 @@ static struct node *read_fstree(const char *dirname) @@ -117880,10 +117520,10 @@ index 54d4e904..d644002 100644 -#define DTC_VERSION "DTC 1.4.0-dirty" +#define DTC_VERSION "DTC 1.4.1-g36c70742" -From 0d794d8e6cccfbefeb6320acf871913dcd94d2ff Mon Sep 17 00:00:00 2001 +From e9e0f3cef41db19f29ab37a403feabe9f55f83fc Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 11 May 2015 09:00:42 +0100 -Subject: [PATCH 024/105] scripts: Add mkknlimg and knlinfo scripts from tools +Subject: [PATCH 023/149] scripts: Add mkknlimg and knlinfo scripts from tools repo The Raspberry Pi firmware looks for a trailer on the kernel image to @@ -118368,10 +118008,10 @@ index 0000000..3dff948 + return (($val eq 'y') || ($val eq '1')); +} -From 79ae5c40586808d01368549b13b3c7a4709c9564 Mon Sep 17 00:00:00 2001 +From 996a96ca5045f3ea6e39192d242062441c3c797b Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 5 Dec 2014 17:26:26 +0000 -Subject: [PATCH 025/105] fdt: Add support for the CONFIG_CMDLINE_EXTEND option +Subject: [PATCH 024/149] fdt: Add support for the CONFIG_CMDLINE_EXTEND option --- drivers/of/fdt.c | 29 ++++++++++++++++++++++++----- @@ -118426,10 +118066,10 @@ index cde35c5d01..dd7fbfe 100644 pr_debug("Command line is: %s\n", (char*)data); -From 01a18bea60e6b60a6fcb0a58faaf34f1b5cc0281 Mon Sep 17 00:00:00 2001 +From 25f3e064afc8b7be40bc92af946b59bce9ed6c58 Mon Sep 17 00:00:00 2001 From: notro Date: Wed, 9 Jul 2014 14:46:08 +0200 -Subject: [PATCH 026/105] BCM2708: Add core Device Tree support +Subject: [PATCH 025/149] BCM2708: Add core Device Tree support Add the bare minimum needed to boot BCM2708 from a Device Tree. @@ -122306,10 +121946,10 @@ index 0000000..66a98f6 + }; +}; -From 7c5cfbcdfa96680f63b0e82202ab509ef78bc023 Mon Sep 17 00:00:00 2001 +From d4f6c4010632825e49b58d95db228b4ab394f3f0 Mon Sep 17 00:00:00 2001 From: Siarhei Siamashka Date: Mon, 17 Jun 2013 13:32:11 +0300 -Subject: [PATCH 027/105] fbdev: add FBIOCOPYAREA ioctl +Subject: [PATCH 026/149] fbdev: add FBIOCOPYAREA ioctl Based on the patch authored by Ali Gholami Rudi at https://lkml.org/lkml/2009/7/13/153 @@ -122402,10 +122042,10 @@ index fb795c3..fa72af0 100644 #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ #define FB_TYPE_PLANES 1 /* Non interleaved planes */ -From b16b65cdb4064e32b321e4d3801bc1990ee258f7 Mon Sep 17 00:00:00 2001 +From 5539b4d21d0d0485e548a1bd0bc259abc7403767 Mon Sep 17 00:00:00 2001 From: Harm Hanemaaijer Date: Thu, 20 Jun 2013 20:21:39 +0200 -Subject: [PATCH 030/105] Speed up console framebuffer imageblit function +Subject: [PATCH 029/149] Speed up console framebuffer imageblit function Especially on platforms with a slower CPU but a relatively high framebuffer fill bandwidth, like current ARM devices, the existing @@ -122614,10 +122254,10 @@ index a2bb276..436494f 100644 start_index, pitch_index); } else -From bda0a510175903069a6e36ee03df8bb58da535fc Mon Sep 17 00:00:00 2001 +From 683a06a250e735c94ec3640d9288528ee50ddf16 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 17:26:38 +0000 -Subject: [PATCH 031/105] Allow mac address to be set in smsc95xx +Subject: [PATCH 030/149] Allow mac address to be set in smsc95xx Signed-off-by: popcornmix --- @@ -122708,10 +122348,10 @@ index 26423ad..e29a323 100644 if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN, dev->net->dev_addr) == 0) { -From cc2b2db4dd1eea70daf6a7b2122bc2cc4fff16b5 Mon Sep 17 00:00:00 2001 +From 4f3ab22c324a811dda12f53cd9e77d3a32c3a113 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 8 May 2013 11:46:50 +0100 -Subject: [PATCH 032/105] enabling the realtime clock 1-wire chip DS1307 and +Subject: [PATCH 031/149] enabling the realtime clock 1-wire chip DS1307 and 1-wire on GPIO4 (as a module) 1-wire: Add support for configuring pin for w1-gpio kernel module @@ -123109,10 +122749,10 @@ index d58594a..feae942 100644 unsigned int ext_pullup_enable_pin; unsigned int pullup_duration; -From f0f58bbd87e81fe4ff162b11faedbacc6b0c8f38 Mon Sep 17 00:00:00 2001 +From 853fe067aeff8a0be4027b63f50dd0478103f723 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 18 Dec 2013 22:16:19 +0000 -Subject: [PATCH 034/105] config: Enable CONFIG_MEMCG, but leave it disabled +Subject: [PATCH 033/149] config: Enable CONFIG_MEMCG, but leave it disabled (due to memory cost). Enable with cgroup_enable=memory. --- @@ -123121,10 +122761,10 @@ Subject: [PATCH 034/105] config: Enable CONFIG_MEMCG, but leave it disabled 2 files changed, 24 insertions(+) diff --git a/kernel/cgroup.c b/kernel/cgroup.c -index 469dd54..c9684da 100644 +index e8a5491..2428355 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c -@@ -5395,6 +5395,29 @@ static int __init cgroup_disable(char *str) +@@ -5393,6 +5393,29 @@ static int __init cgroup_disable(char *str) } __setup("cgroup_disable=", cgroup_disable); @@ -123167,10 +122807,10 @@ index a04225d..a2ef8af 100644 /** -From c475efe6fd77dc1288117ba41451f11c7e46c74c Mon Sep 17 00:00:00 2001 +From 02f4298dead0071add7bb58678d7451bf06d4b7f Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:33:38 +0100 -Subject: [PATCH 035/105] ASoC: Add support for BCM2708 +Subject: [PATCH 034/149] ASoC: Add support for BCM2708 This driver adds support for digital audio (I2S) for the BCM2708 SoC that is used by the @@ -124313,10 +123953,10 @@ index 0000000..6fdcbc1 + +#endif -From ea9da38e0ab7aae107b1b2cb86f9e6728c54f72d Mon Sep 17 00:00:00 2001 +From 9dca125b0468d40894de4138982400ba5b833e4d Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:59:51 +0100 -Subject: [PATCH 036/105] ASoC: Add support for PCM5102A codec +Subject: [PATCH 035/149] ASoC: Add support for PCM5102A codec Some definitions to support the PCM5102A codec by Texas Instruments. @@ -124441,10 +124081,10 @@ index 0000000..126f1e9 +MODULE_AUTHOR("Florian Meier "); +MODULE_LICENSE("GPL v2"); -From 3843c763a49f690052a369c75a4b91e63e65ccd3 Mon Sep 17 00:00:00 2001 +From 45a02391f0fa3d34235ff795c299638fbf3f5773 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:04:54 +0100 -Subject: [PATCH 037/105] BCM2708: Add I2S support to board file +Subject: [PATCH 036/149] BCM2708: Add I2S support to board file Adds the required initializations for I2S to the board file of mach-bcm2708. @@ -124533,10 +124173,10 @@ index a3b65dc..a515992 100644 for (i = 0; i <= 1; i++) { void __iomem *base; -From 9305f38947159f8027408f9caf57ff11d3a14e5d Mon Sep 17 00:00:00 2001 +From 19cea6e827bb706afe8bb57e43ee5f3fa7cd1731 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:19:08 +0100 -Subject: [PATCH 038/105] ASoC: Add support for HifiBerry DAC +Subject: [PATCH 037/149] ASoC: Add support for HifiBerry DAC This adds a machine driver for the HifiBerry DAC. It is a sound card that can @@ -124685,10 +124325,10 @@ index 0000000..4b70b45 +MODULE_DESCRIPTION("ASoC Driver for HifiBerry DAC"); +MODULE_LICENSE("GPL v2"); -From d48fc2d392448b821b9ff95e26cf859f2efe4794 Mon Sep 17 00:00:00 2001 +From 7528f3f5f51e0f304d5726a82dd9178f87b1ca41 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:21:34 +0100 -Subject: [PATCH 039/105] BCM2708: Add HifiBerry DAC to board file +Subject: [PATCH 038/149] BCM2708: Add HifiBerry DAC to board file This adds the initalization of the HifiBerry DAC to the mach-bcm2708 board file. @@ -124736,10 +124376,10 @@ index 01f2de7..1d9b788 100644 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { struct amba_device *d = amba_devs[i]; -From 1d90a3734460be00e20106847f347ff0bd4c322b Mon Sep 17 00:00:00 2001 +From 48355b1b1b0ae407d17524fb836fa61f2341d579 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 6 Dec 2013 20:50:28 +0100 -Subject: [PATCH 040/105] ASoC: BCM2708: Add support for RPi-DAC +Subject: [PATCH 039/149] ASoC: BCM2708: Add support for RPi-DAC This adds a machine driver for the RPi-DAC. @@ -125034,10 +124674,10 @@ index 0000000..b4eaa44 +MODULE_AUTHOR("Florian Meier "); +MODULE_LICENSE("GPL v2"); -From 54b60a8b83358d2fedc3e401908d96e9053033fb Mon Sep 17 00:00:00 2001 +From ee415b9db413a155e99d81537a776b7becf60227 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 15 Jan 2014 21:41:23 +0100 -Subject: [PATCH 041/105] ASoC: wm8804: Implement MCLK configuration options, +Subject: [PATCH 040/149] ASoC: wm8804: Implement MCLK configuration options, add 32bit support WM8804 can run with PLL frequencies of 256xfs and 128xfs for most sample rates. At 192kHz only 128xfs is supported. The existing driver selects 128xfs automatically for some lower samples rates. By using an @@ -125077,10 +124717,10 @@ index 1e403f6..d4efa85 100644 #define WM8804_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \ -From bda0438e5d2450329f79c9c203eb7700ea94bcdc Mon Sep 17 00:00:00 2001 +From 4e0d1e894adb9184eb45a7c343907df881e3a523 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 15 Jan 2014 21:42:08 +0100 -Subject: [PATCH 042/105] ASoC: BCM:Add support for HiFiBerry Digi. Driver is +Subject: [PATCH 041/149] ASoC: BCM:Add support for HiFiBerry Digi. Driver is based on the patched WM8804 driver. Signed-off-by: Daniel Matuschek @@ -125345,10 +124985,10 @@ index 0000000..92e9e46 +MODULE_DESCRIPTION("ASoC Driver for HifiBerry Digi"); +MODULE_LICENSE("GPL v2"); -From f0b7e3863c1025b7318dfe2672828fc1186f5f0c Mon Sep 17 00:00:00 2001 +From 5c4656d103da802e6d0412eb55c8dc9164935867 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Thu, 16 Jan 2014 07:26:08 +0100 -Subject: [PATCH 043/105] BCM2708: Added support for HiFiBerry Digi board Board +Subject: [PATCH 042/149] BCM2708: Added support for HiFiBerry Digi board Board initalization by I2C Signed-off-by: Daniel Matuschek @@ -125395,10 +125035,10 @@ index 6d53beb..a062d7f 100644 bcm_register_device_dt(&snd_rpi_dac_device); bcm_register_device_dt(&snd_pcm1794a_codec_device); -From f1d5146257a0181f53a76aa7c1eab75d8cde3722 Mon Sep 17 00:00:00 2001 +From 87f8afdc7be60f059356680542fa556055434a0b Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Thu, 16 Jan 2014 07:36:35 +0100 -Subject: [PATCH 044/105] ASoC: wm8804: Set idle_bias_off to false Idle bias +Subject: [PATCH 043/149] ASoC: wm8804: Set idle_bias_off to false Idle bias has been change to remove warning on driver startup Signed-off-by: Daniel Matuschek @@ -125420,10 +125060,10 @@ index d4efa85..f3f26a2 100644 .dapm_widgets = wm8804_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(wm8804_dapm_widgets), -From e2bd270cae6b71e799cd32309da2efb131bfc0f7 Mon Sep 17 00:00:00 2001 +From 02e362cf47d55e3e6e075d14a6f5eda064e832a9 Mon Sep 17 00:00:00 2001 From: Gordon Garrity Date: Sat, 8 Mar 2014 16:56:57 +0000 -Subject: [PATCH 045/105] Add IQaudIO Sound Card support for Raspberry Pi +Subject: [PATCH 044/149] Add IQaudIO Sound Card support for Raspberry Pi Set a limit of 0dB on Digital Volume Control @@ -125631,10 +125271,10 @@ index 0000000..aff7377 +MODULE_DESCRIPTION("ASoC Driver for IQAudio DAC"); +MODULE_LICENSE("GPL v2"); -From 3722358310334b175672d037724974a827219c91 Mon Sep 17 00:00:00 2001 +From 6ccb62cc7e401082561c12ed6258dc3382264875 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 18 Jun 2014 13:42:01 +0100 -Subject: [PATCH 046/105] vmstat: Workaround for issue where dirty page count +Subject: [PATCH 045/149] vmstat: Workaround for issue where dirty page count goes negative See: @@ -125661,10 +125301,10 @@ index 82e7db7..f87d16d 100644 static inline void __inc_zone_page_state(struct page *page, -From d0561fb6028c8eb1c26f3ad2f59d21d70eb778f4 Mon Sep 17 00:00:00 2001 +From 7db38451aa2a58b2f7e9e9cd60842e5167732ba0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 14 Jul 2014 22:02:09 +0100 -Subject: [PATCH 047/105] hid: Reduce default mouse polling interval to 60Hz +Subject: [PATCH 046/149] hid: Reduce default mouse polling interval to 60Hz Reduces overhead when using X --- @@ -125700,10 +125340,10 @@ index bfbe1be..a738b25 100644 ret = -ENOMEM; if (usb_endpoint_dir_in(endpoint)) { -From efa286e84267224fb05bfe8615489d50932ed5b8 Mon Sep 17 00:00:00 2001 +From ede6ae920d5614aeaca3793cab45e68d7a5667f4 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Mon, 4 Aug 2014 10:06:56 +0200 -Subject: [PATCH 048/105] Added support for HiFiBerry DAC+ +Subject: [PATCH 047/149] Added support for HiFiBerry DAC+ The driver is based on the HiFiBerry DAC driver. However HiFiBerry DAC+ uses a different codec chip (PCM5122), therefore a new driver is necessary. @@ -125914,10 +125554,10 @@ index 0000000..c63387b +MODULE_DESCRIPTION("ASoC Driver for HiFiBerry DAC+"); +MODULE_LICENSE("GPL v2"); -From f0b1de75a01f88b6250c208157a3a2f4a5c6b52d Mon Sep 17 00:00:00 2001 +From 7f32b28e3ecbddf73a8a2b849fe1950d1d3d6441 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Mon, 4 Aug 2014 11:09:58 +0200 -Subject: [PATCH 049/105] Added driver for HiFiBerry Amp amplifier add-on board +Subject: [PATCH 048/149] Added driver for HiFiBerry Amp amplifier add-on board The driver contains a low-level hardware driver for the TAS5713 and the drivers for the Raspberry Pi I2S subsystem. @@ -126786,10 +126426,10 @@ index 0000000..8f019e0 + +#endif /* _TAS5713_H */ -From 354cb37f33bee3d72e5a514999323689b00ca275 Mon Sep 17 00:00:00 2001 +From 5342cc918f42da5b299e861b708d0986f42f4c81 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 13 Apr 2015 19:14:18 +0100 -Subject: [PATCH 050/105] bcm2708: Allow option card devices to be configured +Subject: [PATCH 049/149] bcm2708: Allow option card devices to be configured via DT If the kernel is built with Device Tree support, and if a DT blob @@ -126814,10 +126454,10 @@ index 03fa1cb..c816526 100644 static struct platform_driver bcm2835_i2s_driver = { .probe = bcm2835_i2s_probe, -From f5a17a7715495cd47e7c4eef2655346833b71139 Mon Sep 17 00:00:00 2001 +From c2db87de57679d93a7b54ded9f2ad2c29b449c58 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 13 Apr 2015 18:45:39 +0100 -Subject: [PATCH 051/105] Adding Device Tree support for some RPi audio cards +Subject: [PATCH 050/149] Adding Device Tree support for some RPi audio cards --- arch/arm/mach-bcm2709/bcm2709.c | 143 ++++++++++++++++++++++++++++++++++++++ @@ -127180,10 +126820,10 @@ index 126f1e9..7c6598e 100644 }; -From 83c934f5afe83dab78859dbdcb6bc2fbcd24904a Mon Sep 17 00:00:00 2001 +From decbd54190fce2736e5f8614c974f6d236eebd15 Mon Sep 17 00:00:00 2001 From: Timo Kokkonen Date: Wed, 29 Oct 2014 23:30:30 -0700 -Subject: [PATCH 052/105] Added support to reserve/enable a GPIO pin to be used +Subject: [PATCH 051/149] Added support to reserve/enable a GPIO pin to be used from pps-gpio module (LinuxPPS). Enable PPS modules in default config for RPi. @@ -127319,10 +126959,10 @@ index 57e1f3d..721559b 100644 +module_param(pps_gpio_pin, int, 0644); +MODULE_PARM_DESC(pps_gpio_pin, "Set GPIO pin to reserve for PPS"); -From 98235f2a450b2f029e0bba2b566b5c86df9a6fef Mon Sep 17 00:00:00 2001 +From 128bbd307de47c1a0748dcf84e5d948c2df3db38 Mon Sep 17 00:00:00 2001 From: Ryan Coe Date: Sat, 31 Jan 2015 18:25:49 -0700 -Subject: [PATCH 053/105] Update ds1307 driver for device-tree support +Subject: [PATCH 052/149] Update ds1307 driver for device-tree support Signed-off-by: Ryan Coe --- @@ -127349,10 +126989,10 @@ index 4ffabb3..c6789a7 100644 .driver = { .name = "rtc-ds1307", -From d25a65991d2262ee56bf481b47a9980edf5e1ff0 Mon Sep 17 00:00:00 2001 +From 0fcc1245d4ba1391e0bcc754e2c521cecbb10179 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 6 Feb 2015 13:50:57 +0000 -Subject: [PATCH 054/105] BCM270x_DT: Add pwr_led, and the required "input" +Subject: [PATCH 053/149] BCM270x_DT: Add pwr_led, and the required "input" trigger The "input" trigger makes the associated GPIO an input. This is to support @@ -127463,10 +127103,10 @@ index 0000000..2ca2b98 +MODULE_DESCRIPTION("Set LED GPIO to Input \"trigger\""); +MODULE_LICENSE("GPL"); -From b478a1224ddadc079a085b1a9fd2f921f3492543 Mon Sep 17 00:00:00 2001 +From 2b9a2491e2554f5dc92a62be523ef8932a5eb85e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 20 Jun 2014 17:19:27 +0100 -Subject: [PATCH 055/105] bcm2709: Simplify and strip down IRQ handler +Subject: [PATCH 054/149] bcm2709: Simplify and strip down IRQ handler --- arch/arm/include/asm/entry-macro-multi.S | 2 + @@ -127685,10 +127325,10 @@ index d08591b..08d184c 100644 +1: get_irqnr_and_base r0, r2, r6, lr + .endm -From a149f4195cb6283d974f29f6853bc73666252e28 Mon Sep 17 00:00:00 2001 +From 145d538784f1fb1a938a6f037df9d85898ea1ba4 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 12 Feb 2015 11:17:53 +0000 -Subject: [PATCH 056/105] Fix LED "input" trigger implementation for 3.19 +Subject: [PATCH 055/149] Fix LED "input" trigger implementation for 3.19 --- drivers/leds/leds-gpio.c | 10 +++++++++- @@ -127775,10 +127415,10 @@ index 9a2b000..60accc5 100644 /* Set LED brightness level */ /* Must not sleep, use a workqueue if needed */ -From 63f720f1e358012fdb2631c18c794c32beb1c53f Mon Sep 17 00:00:00 2001 +From 20a42859d52cff889adbec5697ba61870b22c423 Mon Sep 17 00:00:00 2001 From: notro Date: Thu, 10 Jul 2014 13:59:47 +0200 -Subject: [PATCH 057/105] pinctrl-bcm2835: Set base to 0 give expected gpio +Subject: [PATCH 056/149] pinctrl-bcm2835: Set base to 0 give expected gpio numbering Signed-off-by: Noralf Tronnes @@ -127800,10 +127440,10 @@ index 8d908e3..7a1900d 100644 .can_sleep = false, }; -From 344a03d0bd987220640f4dd4ba4d083d2fdbb449 Mon Sep 17 00:00:00 2001 +From 812a64aaa5d3dec21864e49c612b38ee65273b17 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 4 Feb 2015 10:02:24 +0000 -Subject: [PATCH 058/105] pinctrl-bcm2835: bcm2835_gpio_direction_output must +Subject: [PATCH 057/149] pinctrl-bcm2835: bcm2835_gpio_direction_output must set the value --- @@ -127831,10 +127471,10 @@ index 7a1900d..62f85aa 100644 static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value) -From 1c683d296c9424f0cf7dac30d8992258c28cbeb1 Mon Sep 17 00:00:00 2001 +From 09041f7ccbd1cde792edae91c41266886d5d1382 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 24 Feb 2015 13:40:50 +0000 -Subject: [PATCH 059/105] pinctrl-bcm2835: Fix interrupt handling for GPIOs +Subject: [PATCH 058/149] pinctrl-bcm2835: Fix interrupt handling for GPIOs 28-31 and 46-53 Contrary to the documentation, the BCM2835 GPIO controller actually has @@ -127980,10 +127620,10 @@ index 62f85aa..c7cf266 100644 }, }; -From e1a45c7cf40f11598c7faed4a1d1b594bcc05796 Mon Sep 17 00:00:00 2001 +From 523ce9c5aa97607b0847833b93a8d34965808132 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 26 Feb 2015 09:58:22 +0000 -Subject: [PATCH 060/105] pinctrl-bcm2835: Only request the interrupts listed +Subject: [PATCH 059/149] pinctrl-bcm2835: Only request the interrupts listed in the DTB Although the GPIO controller can generate three interrupts (four counting @@ -128010,10 +127650,10 @@ index c7cf266..986779a 100644 pc->irq_data[i].irqgroup = i; -From 0fff72fcb15c962d0723f9cea13eb2c3fc31d465 Mon Sep 17 00:00:00 2001 +From ee9c77a3cc5d83e87e52f3424f7a29d605d562ba Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 27 Feb 2015 15:10:24 +0000 -Subject: [PATCH 061/105] enc28j60: Add device tree compatible string and an +Subject: [PATCH 060/149] enc28j60: Add device tree compatible string and an overlay --- @@ -128047,10 +127687,10 @@ index b1b5f66..c6b6e1a 100644 .probe = enc28j60_probe, .remove = enc28j60_remove, -From 74c1893348470c0ec98d83ea63ab8e22e3da8c13 Mon Sep 17 00:00:00 2001 +From 0c87fa341259d332ce8402d1a3703f2b69af5219 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Wed, 25 Mar 2015 09:26:17 +0100 -Subject: [PATCH 062/105] Add driver for rpi-proto +Subject: [PATCH 061/149] Add driver for rpi-proto Forward port of 3.10.x driver from https://github.com/koalo We are using a custom board and would like to use rpi 3.18.x @@ -128265,10 +127905,10 @@ index 0000000..c6e45a0 +MODULE_DESCRIPTION("ASoC Driver for Raspberry Pi connected to PROTO board (WM8731)"); +MODULE_LICENSE("GPL"); -From 607ebcbdf67cb576a652c505a367e614014547dd Mon Sep 17 00:00:00 2001 +From 458dc19741c5295b62ff78882b94a4d6dc8aaac2 Mon Sep 17 00:00:00 2001 From: Clive Messer Date: Thu, 2 Apr 2015 12:22:55 +0100 -Subject: [PATCH 063/105] Add Device Tree support for RPi-DAC. +Subject: [PATCH 062/149] Add Device Tree support for RPi-DAC. --- sound/soc/bcm/rpi-dac.c | 21 +++++++++++++++++++++ @@ -128343,10 +127983,10 @@ index b4eaa44..afe1b41 100644 }; -From 1fa756b7cbc29e7ce003ed6f6b269faf8f114467 Mon Sep 17 00:00:00 2001 +From 4c33cf46121a5662ebfb84ad34a5a632c2c679f6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 13 Apr 2015 17:16:29 +0100 -Subject: [PATCH 064/105] config: Add default configs +Subject: [PATCH 063/149] config: Add default configs --- arch/arm/configs/bcm2709_defconfig | 1204 ++++++++++++++++++++++++++++++++++++ @@ -130771,10 +130411,10 @@ index 0000000..6a41231 +CONFIG_CRC_ITU_T=y +CONFIG_LIBCRC32C=y -From 7d987bad7109b37ffac673a9975718ee4e9ea9ae Mon Sep 17 00:00:00 2001 +From f8b20b1317fd46d23a2a9944a53df547904a238f Mon Sep 17 00:00:00 2001 From: Steve Glendinning Date: Thu, 19 Feb 2015 18:47:12 +0000 -Subject: [PATCH 065/105] smsx95xx: fix crimes against truesize +Subject: [PATCH 064/149] smsx95xx: fix crimes against truesize smsc95xx is adjusting truesize when it shouldn't, and following a recent patch from Eric this is now triggering warnings. @@ -130809,10 +130449,10 @@ index e29a323..aff63dc usbnet_skb_return(dev, ax_skb); } -From 888ea57ee7c57e7f43b3be9d7f9c70ea92e3ef2e Mon Sep 17 00:00:00 2001 +From 7b168915af2a8d731046afeed5cdf939cd9c4323 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 17 Apr 2015 16:58:45 +0100 -Subject: [PATCH 066/105] smsc95xx: Disable turbo mode by default +Subject: [PATCH 065/149] smsc95xx: Disable turbo mode by default --- drivers/net/usb/smsc95xx.c | 2 +- @@ -130832,10 +130472,10 @@ index aff63dc..08a8a8c 100755 MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); -From 43e2441e42ce3e68910e50a862e82cefff1491a8 Mon Sep 17 00:00:00 2001 +From aab95f9b10e8c3d32de2bf163b86f220c88214fe Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 17 Apr 2015 19:30:22 +0100 -Subject: [PATCH 067/105] Add blk_pos parameter to mmc multi_io_quirk callback +Subject: [PATCH 066/149] Add blk_pos parameter to mmc multi_io_quirk callback --- drivers/mmc/card/block.c | 1 + @@ -130846,10 +130486,10 @@ Subject: [PATCH 067/105] Add blk_pos parameter to mmc multi_io_quirk callback 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c -index 60f7141..1f15cb5 100644 +index 31d2627..8484ec9 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c -@@ -1413,6 +1413,7 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, +@@ -1415,6 +1415,7 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, brq->data.blocks = card->host->ops->multi_io_quirk(card, (rq_data_dir(req) == READ) ? MMC_DATA_READ : MMC_DATA_WRITE, @@ -130918,10 +130558,10 @@ index b0258e8..d3cdad9 100644 struct mmc_card; -From 3c38adf40dd65f96d317f60295ee47ddd5412d11 Mon Sep 17 00:00:00 2001 +From 9a092ad62309aecb8c27cde5fb5f863a7447b90e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Wed, 29 Apr 2015 17:24:02 +0200 -Subject: [PATCH 068/105] bcm2835: bcm2835_defconfig +Subject: [PATCH 067/149] bcm2835: bcm2835_defconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -132251,10 +131891,10 @@ index 31cb073..2e8a95a 100644 # CONFIG_XZ_DEC_ARM is not set # CONFIG_XZ_DEC_ARMTHUMB is not set -From 219d0cd5afbcfc1d8d1bffc63c535c323ae8bf2e Mon Sep 17 00:00:00 2001 +From 4ab42e0f9eab22619622ea5f13195280aebc0d64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 1 May 2015 23:00:15 +0200 -Subject: [PATCH 069/105] BCM270x_DT: Add mailbox bcm2708-vcio +Subject: [PATCH 068/149] BCM270x_DT: Add mailbox bcm2708-vcio MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -132295,10 +131935,10 @@ index 721559b..4a00561 100644 #ifdef CONFIG_BCM2708_GPIO bcm_register_device_dt(&bcm2708_gpio_device); -From 3c10332d5214199b7df6d5d220eeef023706cbaf Mon Sep 17 00:00:00 2001 +From fa2b33b614fead97a2eb8b950fb1c77e73f0eb28 Mon Sep 17 00:00:00 2001 From: Gordon Hollingworth Date: Tue, 12 May 2015 14:47:56 +0100 -Subject: [PATCH 070/105] rpi-ft5406: Add touchscreen driver for pi LCD display +Subject: [PATCH 069/149] rpi-ft5406: Add touchscreen driver for pi LCD display --- drivers/input/touchscreen/Kconfig | 7 + @@ -132615,10 +132255,10 @@ index cc284ed..d3ea839 100644 VCMSG_SET_CURSOR_STATE = 0x00008011, }; -From 10fe6a8ff8d397d392f84f71bccef590007c1035 Mon Sep 17 00:00:00 2001 +From 5cbcb76ee23807632fcd5db19ebcc2d913011f17 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 13 Oct 2014 11:47:53 +0100 -Subject: [PATCH 071/105] Improve __copy_to_user and __copy_from_user +Subject: [PATCH 070/149] Improve __copy_to_user and __copy_from_user performance Provide a __copy_from_user that uses memcpy. On BCM2708, use @@ -134143,10 +133783,10 @@ index 3e58d71..0622891 100644 static unsigned long noinline __clear_user_memset(void __user *addr, unsigned long n) -From 55e619a1d22f898210f4d5df7056de9ca22262ef Mon Sep 17 00:00:00 2001 +From b196781e4110a44416cf5926cf1ff350a1533c94 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 27 May 2015 17:22:15 +0100 -Subject: [PATCH 072/105] bcm2835-audio: Create the platform device if the DT +Subject: [PATCH 071/149] bcm2835-audio: Create the platform device if the DT node is disabled For backwards compatibility, allow the built-in ALSA driver to be enabled @@ -134200,10 +133840,10 @@ index 4a00561..dec8043 100644 bcm_register_device_dt(&bcm2708_spi_device); -From 3a23003af149876e9459bf65f14eff38ddb57778 Mon Sep 17 00:00:00 2001 +From 35fb850719835a0029eb91480b214fbaf2a99dc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Wed, 3 Jun 2015 12:26:13 +0200 -Subject: [PATCH 073/105] ARM: bcm2835: Set Serial number and Revision +Subject: [PATCH 072/149] ARM: bcm2835: Set Serial number and Revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -134262,10 +133902,10 @@ index 70f2f39..f7fdacd 100644 static const char * const bcm2835_compat[] = { -From a16205df7ca3759a05bf56e126d17fb496c12775 Mon Sep 17 00:00:00 2001 +From fb9bb42b9875d61716503c9eb330e73d720f5a64 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 16 Jun 2015 17:47:27 +0100 -Subject: [PATCH 074/105] platform: Add force_core command line setting to boot +Subject: [PATCH 073/149] platform: Add force_core command line setting to boot from a different core number --- @@ -134336,10 +133976,10 @@ index dec8043..fe71c50 100644 module_param(serial, uint, 0644); module_param(uart_clock, uint, 0644); -From d4fe01b4f1f6d84fb12a04e228edc19aea23865a Mon Sep 17 00:00:00 2001 +From 63a651b12cbd98ba14d2ac6f038f230a4b3ce336 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 18 Jun 2015 17:46:17 +0100 -Subject: [PATCH 075/105] mach-bcm270x: Enable the building of pinctrl-bcm2835 +Subject: [PATCH 074/149] mach-bcm270x: Enable the building of pinctrl-bcm2835 --- drivers/pinctrl/Makefile | 1 + @@ -134358,10 +133998,10 @@ index 6eadf04..9119513 100644 obj-$(CONFIG_ARCH_BERLIN) += berlin/ obj-y += freescale/ -From cd146348cbf2ff432f0cb3b05b0e0cf117dbba74 Mon Sep 17 00:00:00 2001 +From 30e79675077f83c35b77f74ae833212cbff42b6f Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 19 Jun 2015 16:41:39 +0100 -Subject: [PATCH 076/105] BCM270X_DT: Document the i2s-mmap overlay +Subject: [PATCH 075/149] BCM270X_DT: Document the i2s-mmap overlay --- arch/arm/boot/dts/overlays/README | 6 ++++++ @@ -134385,10 +134025,10 @@ index 3e08f98..7fa6d33 100644 Info: Configures the IQaudio DAC audio card Load: dtoverlay=iqaudio-dac -From 88ffec3ff5b4505e53ee2fdcbc564fe734145ae6 Mon Sep 17 00:00:00 2001 +From 1dd7bc29051074b4aedba9ed05bbc920ed67a654 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 17 Jun 2015 11:36:53 +0100 -Subject: [PATCH 077/105] bcm2835-sdhost: Improve error handling and recovery +Subject: [PATCH 076/149] bcm2835-sdhost: Improve error handling and recovery 1) Expose the hw_reset method to the MMC framework, removing many internal calls by the driver. @@ -135480,10 +135120,10 @@ index eef8a24..6277e43 100644 if (host->allow_dma) { -From afd5ae68ceec9ee73fb979c32ed1fd19ab6a1038 Mon Sep 17 00:00:00 2001 +From e6a1ebfa363797e35902c3d466af7c92ef05a62f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 4 Jun 2015 13:11:46 -0700 -Subject: [PATCH 078/105] ARM: bcm2835: Add the Raspberry Pi firmware driver +Subject: [PATCH 077/149] ARM: bcm2835: Add the Raspberry Pi firmware driver This gives us a function for making mailbox property channel requests of the firmware, which is most notable in that it will let us get and @@ -135917,10 +135557,10 @@ index 0000000..9d9efb7 + void *data, size_t tag_size); +struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node); -From c3629eb3fda93e5727602a1484daab7d08da61cb Mon Sep 17 00:00:00 2001 +From dce877ba363b979281f5781ec75a197875fd21a9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 22 Mar 2015 13:33:23 +0000 -Subject: [PATCH 079/105] config: Enable ZSMALLOC, ZRAM and PGTABLE_MAPPING +Subject: [PATCH 078/149] config: Enable ZSMALLOC, ZRAM and PGTABLE_MAPPING --- arch/arm/configs/bcm2709_defconfig | 4 ++++ @@ -135972,10 +135612,10 @@ index 6a41231..cacde14 100644 CONFIG_BLK_DEV_CRYPTOLOOP=m CONFIG_BLK_DEV_DRBD=m -From 667729cc2a536b1cc6241973276fad1e72909f3a Mon Sep 17 00:00:00 2001 +From 2f04df7aef19d4e087c80fa7371e3f5139233570 Mon Sep 17 00:00:00 2001 From: Gordon Hollingworth Date: Mon, 22 Jun 2015 16:27:07 +0100 -Subject: [PATCH 080/105] Add rpi-ft5406 overlay Add rpi-ft5406 driver as +Subject: [PATCH 079/149] Add rpi-ft5406 overlay Add rpi-ft5406 driver as module --- @@ -136062,10 +135702,10 @@ index cacde14..f952ff2 100644 CONFIG_TOUCHSCREEN_STMPE=m CONFIG_INPUT_MISC=y -From b2d8f6a978e70e941859cc4cfacaee8121f71b7c Mon Sep 17 00:00:00 2001 +From bf09fbb31f813db47e4b64fddbc1ea1d089133c2 Mon Sep 17 00:00:00 2001 From: Gordon Hollingworth Date: Tue, 23 Jun 2015 09:53:40 +0100 -Subject: [PATCH 081/105] Fix driver detection failure Check that the buffer +Subject: [PATCH 080/149] Fix driver detection failure Check that the buffer response is non-zero meaning the touchscreen was detected --- @@ -136086,10 +135726,10 @@ index f55151b..d41851d 100644 dev_dbg(&pdev->dev, "Got TS buffer 0x%x\n", request.tag.val); } -From 47e896b8d1e0614ae8dc7a01b037d3d30bd87bf1 Mon Sep 17 00:00:00 2001 +From e8fe55cc59f200121b845a93110d6c41e7daeb01 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 23 Jun 2015 13:24:01 +0100 -Subject: [PATCH 082/105] config: Enable 8250 serial port +Subject: [PATCH 081/149] config: Enable 8250 serial port --- arch/arm/configs/bcm2709_defconfig | 7 +++++++ @@ -136137,10 +135777,10 @@ index f952ff2..0c25d8b 100644 CONFIG_HW_RANDOM=y CONFIG_HW_RANDOM_BCM2835=m -From e6e9f242d287b3fa1008ef3bfdac211906587585 Mon Sep 17 00:00:00 2001 +From 02dfc389b34d52a0c97428a666d0314216c2cb34 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 23 Jun 2015 14:10:58 +0100 -Subject: [PATCH 083/105] config: Enable POWER_RESET_GPIO +Subject: [PATCH 082/149] config: Enable POWER_RESET_GPIO --- arch/arm/configs/bcm2709_defconfig | 2 ++ @@ -136174,10 +135814,10 @@ index 0c25d8b..e757db6 100644 CONFIG_THERMAL=y CONFIG_THERMAL_BCM2835=y -From acfa836e00324826a1aa3dc816d7dc5f4b5d5790 Mon Sep 17 00:00:00 2001 +From 83d5bd935a9a83db9e7bf89bb3cd123fc7a6999f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 26 Jun 2015 17:37:38 +0100 -Subject: [PATCH 084/105] bcm2708-vcio: Remove restriction of only a single +Subject: [PATCH 083/149] bcm2708-vcio: Remove restriction of only a single instance being open We need more than one process to be able to use mailbox interface (e.g. HW cursor in fbturbo and hello_fft). @@ -136222,10 +135862,10 @@ index d91672b..06fb2c2f 100644 return 0; -From 7f23eccb28dd764cf1af231fdc69bc9f93db4972 Mon Sep 17 00:00:00 2001 +From 08ab3b10ef3b9fee5c05f7c1463fefa3206e36eb Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 26 Jun 2015 08:39:19 +0100 -Subject: [PATCH 085/105] BCM270X_DT: Create a "core" clock, use it for SPI and +Subject: [PATCH 084/149] BCM270X_DT: Create a "core" clock, use it for SPI and sdhost --- @@ -136376,10 +136016,10 @@ index b408ab4..897204a 100644 }; }; -From f64348123913a79fd145c5208039c8f66c0c4252 Mon Sep 17 00:00:00 2001 +From a3c04e353a23787157f52097715422aed626198d Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 24 Jun 2015 09:24:31 +0100 -Subject: [PATCH 086/105] BCM270X_DT: Add MCP7941X to i2c-rtc overlay +Subject: [PATCH 085/149] BCM270X_DT: Add MCP7941X to i2c-rtc overlay --- arch/arm/boot/dts/overlays/README | 3 +++ @@ -136432,10 +136072,10 @@ index 6bccfdc..7052c71 100644 pcf8523 = <&pcf8523>,"status"; pcf8563 = <&pcf8563>,"status"; -From 57fd1fbaa2d9281f2b9d70c8d15dbaa201af2b71 Mon Sep 17 00:00:00 2001 +From 89ce29fd10942fcb3a8a72a88ed399d5bbac6f56 Mon Sep 17 00:00:00 2001 From: P33M Date: Wed, 24 Jun 2015 11:23:06 +0100 -Subject: [PATCH 087/105] dts/overlays: document DHT11 overlay +Subject: [PATCH 086/149] dts/overlays: document DHT11 overlay --- arch/arm/boot/dts/overlays/README | 8 ++++++++ @@ -136461,10 +136101,10 @@ index 425eb19..9406cf3 100644 -From e072d9e5801bb111be321dff6feadd5c12e8d2ad Mon Sep 17 00:00:00 2001 +From e5230cc9bbb441510c38faf9f0c82a839afbba71 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 25 Jun 2015 12:16:11 +0100 -Subject: [PATCH 088/105] gpio-poweroff: Allow it to work on Raspberry Pi +Subject: [PATCH 087/149] gpio-poweroff: Allow it to work on Raspberry Pi The Raspberry Pi firmware manages the power-down and reboot process. To do this it installs a pm_power_off handler, causing @@ -136579,10 +136219,10 @@ index e5332f1..6e3fec2 100644 "%s: pm_power_off function already registered", __func__); -From 45567cec8e8dc1be2d45fead5332258d3a49a088 Mon Sep 17 00:00:00 2001 +From c7c9f2995da703a41e6c70bce53d9eef408b1b46 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 17 Jun 2015 17:10:40 +0100 -Subject: [PATCH 089/105] BCM270x_DT: Default Compute Module i2c, i2s and spi +Subject: [PATCH 088/149] BCM270x_DT: Default Compute Module i2c, i2s and spi support --- @@ -136672,10 +136312,10 @@ index e82fcb2..af252bd 100755 }; }; -From 2c610cb4fa176ac54d4e32a4744761aa9c600f3c Mon Sep 17 00:00:00 2001 +From 44c63dcdaca924590d42106b99b5f4e30dcbfbe3 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 22 Jun 2015 14:21:55 +0100 -Subject: [PATCH 090/105] BCM270X_DT: Sort nodes by bus address, and +Subject: [PATCH 089/149] BCM270X_DT: Sort nodes by bus address, and consolidate aliases --- @@ -136917,10 +136557,10 @@ index 24fa849..ccb9c31 100644 &gpio { -From dab507d5936f3847a320b11be5a21b4c25c4601b Mon Sep 17 00:00:00 2001 +From 870b67c8c48467c19fbbccb90aeb8137ce5e9bea Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 22 Jun 2015 14:23:03 +0100 -Subject: [PATCH 091/105] i2c-bcm2708/BCM270X_DT: Add support for I2C2 +Subject: [PATCH 090/149] i2c-bcm2708/BCM270X_DT: Add support for I2C2 The third I2C bus (I2C2) is normally reserved for HDMI use. Careless use of this bus can break an attached display - use with caution. @@ -137093,10 +136733,10 @@ index 8773203..7a24fbe 100644 goto out_free_bi; } -From c887101553aed347b4e0e29422cd5a7315cce18a Mon Sep 17 00:00:00 2001 +From 207f6d593f3d6b5e5bbe5b12f8e915d7f6b85dd7 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 29 Jun 2015 12:14:02 +0100 -Subject: [PATCH 092/105] BCM270X_DT: Correct the lirc-rpi overlay +Subject: [PATCH 091/149] BCM270X_DT: Correct the lirc-rpi overlay documentation The polarity of the "sense" parameter was inverted with respect to reality. @@ -137122,10 +136762,10 @@ index 0ed7094..ec762d2 100644 (default "-1") -From b55c8ef4eab8f62f3087bcdf4eb9a603105d16fb Mon Sep 17 00:00:00 2001 +From 919c9342b5a5c83686dc932935276d621b5cccae Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 25 Jun 2015 08:47:09 +0100 -Subject: [PATCH 093/105] bcm2835-sdhost: Further improve overclock back-off +Subject: [PATCH 092/149] bcm2835-sdhost: Further improve overclock back-off --- drivers/mmc/host/bcm2835-sdhost.c | 144 +++++++++++++++++++++----------------- @@ -137417,10 +137057,10 @@ index 6277e43..a03db06 100644 iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); -From 3d5ba5c480137b87aaee59c14f8e486e747cd450 Mon Sep 17 00:00:00 2001 +From 23382239529f6cb7af467a9247e8e24e70a4aa06 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 30 Jun 2015 10:28:59 +0100 -Subject: [PATCH 094/105] i2c-bcm2708: Increase timeouts to allow larger +Subject: [PATCH 093/149] i2c-bcm2708: Increase timeouts to allow larger transfers Use the timeout value provided by the I2C_TIMEOUT ioctl when waiting @@ -137458,10 +137098,10 @@ index 7a24fbe..8b8762d 100644 dev_err(&adap->dev, "transfer timed out\n"); goto error_timeout; -From 31a5408b0734bc64969ab91be9cb3c1d898d655a Mon Sep 17 00:00:00 2001 +From f3d59521e6139a0e1cf79eaacffea5a576360185 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 30 Jun 2015 10:33:52 +0100 -Subject: [PATCH 095/105] spi-bcm2708: Increase timeout from 150ms to 1s +Subject: [PATCH 094/149] spi-bcm2708: Increase timeout from 150ms to 1s See: https://github.com/raspberrypi/linux/issues/260 --- @@ -137485,10 +137125,10 @@ index 041b5e2..5c0214e 100644 struct bcm2708_spi { spinlock_t lock; -From c66c0c2993daff0c44d7daae71421b1404f92233 Mon Sep 17 00:00:00 2001 +From ea8bb97ffa4e1f4bd832e7a9bed797551685625b Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 15 Jun 2015 09:59:38 +0100 -Subject: [PATCH 096/105] bcm2708-spi: Don't use static pin configuration with +Subject: [PATCH 095/149] bcm2708-spi: Don't use static pin configuration with DT Also remove superfluous error checking - the SPI framework ensures the @@ -137527,10 +137167,10 @@ index 5c0214e..781c747 100644 master = spi_alloc_master(&pdev->dev, sizeof(*bs)); if (!master) { -From fb8c469783f4521176bebb9de94b6b456b4c35bb Mon Sep 17 00:00:00 2001 +From a141cf018b63c08c9907aa0d7b1b2791ee9250d0 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 15 Jun 2015 10:10:59 +0100 -Subject: [PATCH 097/105] bcm2708-i2s: Don't use static pin configuration with +Subject: [PATCH 096/149] bcm2708-i2s: Don't use static pin configuration with DT --- @@ -137553,10 +137193,10 @@ index a515992..5e93cd6 100644 /* * Adjust the data length according to the format. -From 68df7b46c42bd73c44ae405adbd12be35e308a2b Mon Sep 17 00:00:00 2001 +From 9ac08a7ad7b65014eada794cf252828d10b6cb91 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 30 Jun 2015 14:12:42 +0100 -Subject: [PATCH 098/105] serial: 8250: Don't crash when nr_uarts is 0 +Subject: [PATCH 097/149] serial: 8250: Don't crash when nr_uarts is 0 --- drivers/tty/serial/8250/8250_core.c | 2 ++ @@ -137576,10 +137216,10 @@ index 4506e40..f03a19a 100644 for (i = 0; i < nr_uarts; i++) { struct uart_8250_port *up = &serial8250_ports[i]; -From 3ceec0b963f3001adaa523d65508cc54a6f93cd0 Mon Sep 17 00:00:00 2001 +From e3ee14936302400a2b6389b4062e4ce45046cb2e Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 26 Jun 2015 08:50:11 +0100 -Subject: [PATCH 099/105] BCM270X_DT: Add overlay to enable uart1 +Subject: [PATCH 098/149] BCM270X_DT: Add overlay to enable uart1 N.B. The UART1 clock is derived from the core clock. The firmware will update clock-frequency if core_freq is set, but be aware @@ -137748,10 +137388,10 @@ index e757db6..363c894 100644 CONFIG_SERIAL_AMBA_PL011_CONSOLE=y CONFIG_SERIAL_OF_PLATFORM=y -From 0365608651a901ee0b84351ed8ec9b7f0cdfd986 Mon Sep 17 00:00:00 2001 +From 6ee396162a3700157252585fd19ed67e22b8aa34 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 24 Jun 2015 14:10:44 +0100 -Subject: [PATCH 100/105] spi-bcm2835: Support pin groups other than 7-11 +Subject: [PATCH 099/149] spi-bcm2835: Support pin groups other than 7-11 The spi-bcm2835 driver automatically uses GPIO chip-selects due to some unreliability of the native ones. In doing so it chooses the @@ -137832,10 +137472,10 @@ index 37875cf..55e81c2 100644 /* and set up the "mode" and level */ dev_info(&spi->dev, "setting up native-CS%i as GPIO %i\n", -From 1674fcd926873998471f71ad88306d47bc99862b Mon Sep 17 00:00:00 2001 +From 2f890ad4ea68997c62f8d58af8c2800b7eeab056 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 30 Jun 2015 17:37:38 +0100 -Subject: [PATCH 101/105] BCM270X_DT: Change pio_limit of sdhost driver to 1 +Subject: [PATCH 100/149] BCM270X_DT: Change pio_limit of sdhost driver to 1 --- arch/arm/boot/dts/overlays/sdhost-overlay.dts | 2 +- @@ -137855,10 +137495,10 @@ index 897204a..2da14a4 100644 }; }; -From f72606ab1e40707a3dc9243e0d0b87b98654e02b Mon Sep 17 00:00:00 2001 +From a9ac939580e8cf0c43c4242bb458db7d27a6deea Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 1 Jul 2015 12:51:52 +0100 -Subject: [PATCH 102/105] bcm2835-sdhost: Clear HBLC for PIO mode +Subject: [PATCH 101/149] bcm2835-sdhost: Clear HBLC for PIO mode Also update pio_limit default in overlay README. --- @@ -137894,10 +137534,10 @@ index a03db06..d65870a 100644 BUG_ON(!host->data); } -From 93e9bd0c71d224db35cc8019a1ebc16bf77f0fa2 Mon Sep 17 00:00:00 2001 +From 7b05003d4f07188e83919e476ac48dc5c219f8ed Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 3 Jul 2015 12:21:01 +0100 -Subject: [PATCH 103/105] BCM270X_DT: I2S needs function Alt2 +Subject: [PATCH 102/149] BCM270X_DT: I2S needs function Alt2 --- arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 2 +- @@ -137959,10 +137599,10 @@ index f25f0a2..62d1c62 100644 }; -From 5edaac580d81f7edd48afd1e8c296cdedd94cc7a Mon Sep 17 00:00:00 2001 +From 7a39e0bdf178dd83ffca4766bfc0a2acc1b6c3a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 26 Jun 2015 14:16:15 +0200 -Subject: [PATCH 104/105] configs: Incorporate v4.1 dependency changes +Subject: [PATCH 103/149] configs: Incorporate v4.1 dependency changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -138125,10 +137765,10 @@ index 363c894..80f84d7 100644 CONFIG_CRC_ITU_T=y CONFIG_LIBCRC32C=y -From 18f4efa3ad700a4caf72f45ff95d7acfb40f3255 Mon Sep 17 00:00:00 2001 +From 01a50411ad1528451d53f69d5ad1c7370db0dbee Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 3 Jul 2015 15:47:33 +0100 -Subject: [PATCH 105/105] bcmrpi_defconfigs: Add SND_SOC_WM8804_I2C (for +Subject: [PATCH 104/149] bcmrpi_defconfigs: Add SND_SOC_WM8804_I2C (for HifiBerry Digi) 4.1 has split out support for the I2C and SPI variants, so it now @@ -138162,3 +137802,5984 @@ index 80f84d7..14b91fdf 100644 CONFIG_SND_SIMPLE_CARD=m CONFIG_SOUND_PRIME=m CONFIG_HIDRAW=y + +From c3934ab548244c7fd691ca2e78f9a950d8eff269 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Sat, 4 Jul 2015 19:55:23 +0100 +Subject: [PATCH 105/149] squash: BCM270X_DT: I2S only needs Alt2 on 28-31 + +See: https://github.com/raspberrypi/linux/issues/1046 +--- + arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 2 +- + arch/arm/boot/dts/bcm2708-rpi-cm.dts | 2 +- + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +index 562eb08..3ad2e0d 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -25,7 +25,7 @@ + + i2s_pins: i2s { + brcm,pins = <18 19 20 21>; +- brcm,function = <6>; /* alt2 */ ++ brcm,function = <4>; /* alt0 */ + }; + }; + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dts b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +index 5e3db01..96d8b97 100755 +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +@@ -28,7 +28,7 @@ + + i2s_pins: i2s { + brcm,pins = <18 19 20 21>; +- brcm,function = <6>; /* alt2 */ ++ brcm,function = <4>; /* alt0 */ + }; + }; + +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index 62d1c62..f25f0a2 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -25,7 +25,7 @@ + + i2s_pins: i2s { + brcm,pins = <18 19 20 21>; +- brcm,function = <6>; /* alt2 */ ++ brcm,function = <4>; /* alt0 */ + }; + }; + + +From acd32a30be3e6952f7486c9569429fce70fb8d9e Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 8 Jul 2015 14:48:57 +0100 +Subject: [PATCH 106/149] vchiq_arm: Two cacheing fixes + +1) Make fragment size vary with cache line size +Without this patch, non-cache-line-aligned transfers may corrupt +(or be corrupted by) adjacent data structures. + +Both ARM and VC need to be updated to enable this feature. This is +ensured by having the loader apply a new DT parameter - +cache-line-size. The existence of this parameter guarantees that the +kernel is capable, and the parameter will only be modified from the +safe default if the loader is capable. + +2) Flush/invalidate vmalloc'd memory, and invalidate after reads +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 5 + + .../interface/vchiq_arm/vchiq_2835_arm.c | 112 +++++++++++++-------- + 2 files changed, 77 insertions(+), 40 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index 8181a4e..abf3e5d 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -218,6 +218,7 @@ + compatible = "brcm,bcm2835-vchiq"; + reg = <0x7e00b840 0xf>; + interrupts = <0 2>; ++ cache-line-size = <32>; + }; + + thermal: thermal { +@@ -270,4 +271,8 @@ + clock-frequency = <126000000>; + }; + }; ++ ++ __overrides__ { ++ cache_line_size = <&vchiq>, "cache-line-size:0"; ++ }; + }; +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +index c739083..5edba23 100644 +--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +@@ -42,6 +42,7 @@ + #include + #include + #include ++#include + #include + + #define TOTAL_SLOTS (VCHIQ_SLOT_ZERO_SLOTS + 2 * 32) +@@ -64,8 +65,10 @@ typedef struct vchiq_2835_state_struct { + } VCHIQ_2835_ARM_STATE_T; + + static void __iomem *g_regs; +-static FRAGMENTS_T *g_fragments_base; +-static FRAGMENTS_T *g_free_fragments; ++static unsigned int g_cache_line_size = sizeof(CACHE_LINE_SIZE); ++static unsigned int g_fragments_size; ++static char *g_fragments_base; ++static char *g_free_fragments; + static struct semaphore g_free_fragments_sema; + static unsigned long g_virt_to_bus_offset; + +@@ -95,9 +98,13 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) + + g_virt_to_bus_offset = virt_to_dma(dev, (void *)0); + ++ (void)of_property_read_u32(dev->of_node, "cache-line-size", ++ &g_cache_line_size); ++ g_fragments_size = 2 * g_cache_line_size; ++ + /* Allocate space for the channels in coherent memory */ + slot_mem_size = PAGE_ALIGN(TOTAL_SLOTS * VCHIQ_SLOT_SIZE); +- frag_mem_size = PAGE_ALIGN(sizeof(FRAGMENTS_T) * MAX_FRAGMENTS); ++ frag_mem_size = PAGE_ALIGN(g_fragments_size * MAX_FRAGMENTS); + + slot_mem = dmam_alloc_coherent(dev, slot_mem_size + frag_mem_size, + &slot_phys, GFP_KERNEL); +@@ -117,15 +124,15 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) + vchiq_slot_zero->platform_data[VCHIQ_PLATFORM_FRAGMENTS_COUNT_IDX] = + MAX_FRAGMENTS; + +- g_fragments_base = (FRAGMENTS_T *)(slot_mem + slot_mem_size); ++ g_fragments_base = (char *)slot_mem + slot_mem_size; + slot_mem_size += frag_mem_size; + + g_free_fragments = g_fragments_base; + for (i = 0; i < (MAX_FRAGMENTS - 1); i++) { +- *(FRAGMENTS_T **)&g_fragments_base[i] = +- &g_fragments_base[i + 1]; ++ *(char **)&g_fragments_base[i*g_fragments_size] = ++ &g_fragments_base[(i + 1)*g_fragments_size]; + } +- *(FRAGMENTS_T **)&g_fragments_base[i] = NULL; ++ *(char **)&g_fragments_base[i * g_fragments_size] = NULL; + sema_init(&g_free_fragments_sema, MAX_FRAGMENTS); + + if (vchiq_init_state(state, vchiq_slot_zero, 0) != VCHIQ_SUCCESS) +@@ -344,7 +351,7 @@ vchiq_doorbell_irq(int irq, void *dev_id) + ** cached area. + + ** N.B. This implementation plays slightly fast and loose with the Linux +-** driver programming rules, e.g. its use of __virt_to_bus instead of ++** driver programming rules, e.g. its use of dmac_map_area instead of + ** dma_map_single, but it isn't a multi-platform driver and it benefits + ** from increased speed as a result. + */ +@@ -355,7 +362,6 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, + { + PAGELIST_T *pagelist; + struct page **pages; +- struct page *page; + unsigned long *addrs; + unsigned int num_pages, offset, i; + char *addr, *base_addr, *next_addr; +@@ -386,10 +392,25 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, + pages = (struct page **)(addrs + num_pages + 1); + + if (is_vmalloc_addr(buf)) { +- for (actual_pages = 0; actual_pages < num_pages; actual_pages++) { +- pages[actual_pages] = vmalloc_to_page(buf + (actual_pages * PAGE_SIZE)); ++ int dir = (type == PAGELIST_WRITE) ? ++ DMA_TO_DEVICE : DMA_FROM_DEVICE; ++ unsigned long length = pagelist->length; ++ unsigned int offset = pagelist->offset; ++ ++ for (actual_pages = 0; actual_pages < num_pages; ++ actual_pages++) { ++ struct page *pg = vmalloc_to_page(buf + (actual_pages * ++ PAGE_SIZE)); ++ size_t bytes = PAGE_SIZE - offset; ++ ++ if (bytes > length) ++ bytes = length; ++ pages[actual_pages] = pg; ++ dmac_map_area(page_address(pg) + offset, bytes, dir); ++ length -= bytes; ++ offset = 0; + } +- *need_release = 0; /* do not try and release vmalloc pages */ ++ *need_release = 0; /* do not try and release vmalloc pages */ + } else { + down_read(&task->mm->mmap_sem); + actual_pages = get_user_pages(task, task->mm, +@@ -418,7 +439,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, + actual_pages = -ENOMEM; + return actual_pages; + } +- *need_release = 1; /* release user pages */ ++ *need_release = 1; /* release user pages */ + } + + pagelist->length = count; +@@ -451,10 +472,10 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, + + /* Partial cache lines (fragments) require special measures */ + if ((type == PAGELIST_READ) && +- ((pagelist->offset & (CACHE_LINE_SIZE - 1)) || ++ ((pagelist->offset & (g_cache_line_size - 1)) || + ((pagelist->offset + pagelist->length) & +- (CACHE_LINE_SIZE - 1)))) { +- FRAGMENTS_T *fragments; ++ (g_cache_line_size - 1)))) { ++ char *fragments; + + if (down_interruptible(&g_free_fragments_sema) != 0) { + kfree(pagelist); +@@ -464,19 +485,15 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, + WARN_ON(g_free_fragments == NULL); + + down(&g_free_fragments_mutex); +- fragments = (FRAGMENTS_T *) g_free_fragments; ++ fragments = g_free_fragments; + WARN_ON(fragments == NULL); +- g_free_fragments = *(FRAGMENTS_T **) g_free_fragments; ++ g_free_fragments = *(char **) g_free_fragments; + up(&g_free_fragments_mutex); +- pagelist->type = +- PAGELIST_READ_WITH_FRAGMENTS + (fragments - +- g_fragments_base); ++ pagelist->type = PAGELIST_READ_WITH_FRAGMENTS + ++ (fragments - g_fragments_base) / g_fragments_size; + } + +- for (page = virt_to_page(pagelist); +- page <= virt_to_page(addrs + num_pages - 1); page++) { +- flush_dcache_page(page); +- } ++ dmac_flush_range(pagelist, addrs + num_pages); + + *ppagelist = pagelist; + +@@ -502,13 +519,14 @@ free_pagelist(PAGELIST_T *pagelist, int actual) + + /* Deal with any partial cache lines (fragments) */ + if (pagelist->type >= PAGELIST_READ_WITH_FRAGMENTS) { +- FRAGMENTS_T *fragments = g_fragments_base + +- (pagelist->type - PAGELIST_READ_WITH_FRAGMENTS); ++ char *fragments = g_fragments_base + ++ (pagelist->type - PAGELIST_READ_WITH_FRAGMENTS) * ++ g_fragments_size; + int head_bytes, tail_bytes; +- head_bytes = (CACHE_LINE_SIZE - pagelist->offset) & +- (CACHE_LINE_SIZE - 1); ++ head_bytes = (g_cache_line_size - pagelist->offset) & ++ (g_cache_line_size - 1); + tail_bytes = (pagelist->offset + actual) & +- (CACHE_LINE_SIZE - 1); ++ (g_cache_line_size - 1); + + if ((actual >= 0) && (head_bytes != 0)) { + if (head_bytes > actual) +@@ -516,32 +534,46 @@ free_pagelist(PAGELIST_T *pagelist, int actual) + + memcpy((char *)page_address(pages[0]) + + pagelist->offset, +- fragments->headbuf, ++ fragments, + head_bytes); + } + if ((actual >= 0) && (head_bytes < actual) && + (tail_bytes != 0)) { + memcpy((char *)page_address(pages[num_pages - 1]) + + ((pagelist->offset + actual) & +- (PAGE_SIZE - 1) & ~(CACHE_LINE_SIZE - 1)), +- fragments->tailbuf, tail_bytes); ++ (PAGE_SIZE - 1) & ~(g_cache_line_size - 1)), ++ fragments + g_cache_line_size, ++ tail_bytes); + } + + down(&g_free_fragments_mutex); +- *(FRAGMENTS_T **) fragments = g_free_fragments; ++ *(char **)fragments = g_free_fragments; + g_free_fragments = fragments; + up(&g_free_fragments_mutex); + up(&g_free_fragments_sema); + } + +- if (*need_release) { +- for (i = 0; i < num_pages; i++) { +- if (pagelist->type != PAGELIST_WRITE) +- set_page_dirty(pages[i]); ++ if (*need_release) { ++ unsigned int length = pagelist->length; ++ unsigned int offset = pagelist->offset; + +- page_cache_release(pages[i]); ++ for (i = 0; i < num_pages; i++) { ++ struct page *pg = pages[i]; ++ ++ if (pagelist->type != PAGELIST_WRITE) { ++ unsigned int bytes = PAGE_SIZE - offset; ++ ++ if (bytes > length) ++ bytes = length; ++ dmac_unmap_area(page_address(pg) + offset, ++ bytes, DMA_FROM_DEVICE); ++ length -= bytes; ++ offset = 0; ++ set_page_dirty(pg); ++ } ++ page_cache_release(pg); + } +- } ++ } + + kfree(pagelist); + } + +From d3f1bad2c2095c829d0111a41763ec4cf3fbdeb3 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 30 Jun 2015 09:10:36 +0100 +Subject: [PATCH 107/149] BCM270X_DT: Overlay for the Fen Logic VGA666 board + +The VGA666 board requires GPIOs 2-21 (so no I2C or UART). Using the +overlay (instead of a custom dt-blob.bin) has the advantage that it will +reserve those pins and stop other devices using them (except for GPIO), +but it does delay the point at which the output becomes valid until 2-3 +seconds after the kernel has started. +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 8 +++++++ + arch/arm/boot/dts/overlays/vga666-overlay.dts | 30 +++++++++++++++++++++++++++ + 3 files changed, 39 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/vga666-overlay.dts + +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +index e91548c..74ec825 100644 +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -43,6 +43,7 @@ dtb-$(RPI_DT_OVERLAYS) += spi-bcm2708-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += spi-bcm2835-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += tinylcd35-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += uart1-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += vga666-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += w1-gpio-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += w1-gpio-pullup-overlay.dtb + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 980d358..5e1f530 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -497,6 +497,14 @@ Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14) + rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15) + + ++Name: vga666 ++Info: Overlay for the Fen Logic VGA666 board ++ This uses GPIOs 2-21 (so no I2C), and activates the output 2-3 seconds ++ after the kernel has started. ++Load: dtoverlay=vga666 ++Params: ++ ++ + Name: w1-gpio + Info: Configures the w1-gpio Onewire interface module. + Use this overlay if you *don't* need a GPIO to drive an external pullup. +diff --git a/arch/arm/boot/dts/overlays/vga666-overlay.dts b/arch/arm/boot/dts/overlays/vga666-overlay.dts +new file mode 100644 +index 0000000..7fcab96 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/vga666-overlay.dts +@@ -0,0 +1,30 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ // There is no VGA driver module, but we need a platform device ++ // node (that doesn't already use pinctrl) to hang the pinctrl ++ // reference on - leds will do ++ ++ fragment@0 { ++ target = <&leds>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vga666_pins>; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ vga666_pins: vga666_pins { ++ brcm,pins = <2 3 4 5 6 7 8 9 10 11 12 ++ 13 14 15 16 17 18 19 20 21>; ++ brcm,function = <6>; /* alt2 */ ++ brcm,pull = <0>; /* no pull */ ++ }; ++ }; ++ }; ++}; + +From f92a566b5dcec58d56cc8e7e629601f449325b0c Mon Sep 17 00:00:00 2001 +From: petit-miner +Date: Fri, 10 Jul 2015 13:59:18 +0200 +Subject: [PATCH 108/149] Added support for 2 mcp2515 CAN Bus IC + +See: https://github.com/raspberrypi/linux/issues/1018 + https://github.com/raspberrypi/linux/pull/1049 + https://github.com/raspberrypi/linux/pull/1052 +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 12 +++- + .../arm/boot/dts/overlays/mcp2515-can1-overlay.dts | 69 ++++++++++++++++++++++ + 3 files changed, 81 insertions(+), 1 deletion(-) + create mode 100644 arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts + +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +index 74ec825..4ff9836 100644 +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -29,6 +29,7 @@ dtb-$(RPI_DT_OVERLAYS) += iqaudio-dac-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += lirc-rpi-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += mcp2515-can0-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += mcp2515-can1-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += mmc-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += mz61581-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += piscreen-overlay.dtb +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 5e1f530..88ed678 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -328,7 +328,7 @@ Params: gpio_out_pin GPIO for output (default "17") + + + Name: mcp2515-can0 +-Info: Configures the MCP2515 CAN controller ++Info: Configures the MCP2515 CAN controller on spi0.0 + Load: dtoverlay=mcp2515-can0,= + Params: oscillator Clock frequency for the CAN controller (Hz) + +@@ -337,6 +337,16 @@ Params: oscillator Clock frequency for the CAN controller (Hz) + interrupt GPIO for interrupt signal + + ++Name: mcp2515-can1 ++Info: Configures the MCP2515 CAN controller on spi0.1 ++Load: dtoverlay=mcp2515-can1,= ++Params: oscillator Clock frequency for the CAN controller (Hz) ++ ++ spimaxfrequency Maximum SPI frequence (Hz) ++ ++ interrupt GPIO for interrupt signal ++ ++ + Name: mmc + Info: Selects the bcm2835-mmc SD/MMC driver, optionally with overclock + Load: dtoverlay=mmc,= +diff --git a/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts b/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts +new file mode 100644 +index 0000000..6bef9ae +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts +@@ -0,0 +1,69 @@ ++/* ++ * Device tree overlay for mcp251x/can1 on spi0.1 edited by petit_miner ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ /* disable spi-dev for spi0.1 */ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ /* the interrupt pin of the can-controller */ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ can1_pins: can1_pins { ++ brcm,pins = <25>; ++ brcm,function = <0>; /* input */ ++ }; ++ }; ++ }; ++ ++ /* the clock/oscillator of the can-controller */ ++ fragment@2 { ++ target-path = "/clocks"; ++ __overlay__ { ++ /* external oscillator of mcp2515 on spi0.1 */ ++ can1_osc: can1_osc { ++ compatible = "fixed-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <16000000>; ++ }; ++ }; ++ }; ++ ++ /* the spi config of the can-controller itself binding everything together */ ++ fragment@3 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ can1: mcp2515@1 { ++ reg = <1>; ++ compatible = "microchip,mcp2515"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&can1_pins>; ++ spi-max-frequency = <10000000>; ++ interrupt-parent = <&gpio>; ++ interrupts = <25 0x2>; ++ clocks = <&can1_osc>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ oscillator = <&can1_osc>,"clock-frequency:0"; ++ spimaxfrequency = <&can1>,"spi-max-frequency:0"; ++ interrupt = <&can1_pins>,"brcm,pins:0",<&can1>,"interrupts:0"; ++ }; ++}; + +From 5d7fd1e72db3384293037ca586ed2936b45748d3 Mon Sep 17 00:00:00 2001 +From: Lubomir Rintel +Date: Tue, 5 May 2015 13:27:45 -0700 +Subject: [PATCH 109/149] mailbox: Enable BCM2835 mailbox support + +This mailbox driver provides a single mailbox channel to write 32-bit +values to the VPU and get a 32-bit response. The Raspberry Pi +firmware uses this mailbox channel to implement firmware calls, while +Roku 2 (despite being derived from the same firmware tree) doesn't. + +The driver was originally submitted by Lubomir, based on the +out-of-tree 2708 mailbox driver. Eric Anholt fixed it up for +upstreaming, with the major functional change being that it now has no +notion of multiple channels (since that is a firmware-dependent +concept) and instead the raspberrypi-firmware driver will do that +bit-twiddling in its own messages. +[Jassi: made the 'mbox_chan_ops' struct as const and removed a redundant +variable] + +Signed-off-by: Lubomir Rintel +Signed-off-by: Craig McGeachie +Signed-off-by: Eric Anholt +Acked-by: Stephen Warren +Signed-off-by: Jassi Brar +--- + drivers/mailbox/Kconfig | 9 ++ + drivers/mailbox/Makefile | 2 + + drivers/mailbox/bcm2835-mailbox.c | 216 ++++++++++++++++++++++++++++++++++++++ + 3 files changed, 227 insertions(+) + create mode 100644 drivers/mailbox/bcm2835-mailbox.c + +diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig +index 7f19cb4..dc64c93 100644 +--- a/drivers/mailbox/Kconfig ++++ b/drivers/mailbox/Kconfig +@@ -66,4 +66,13 @@ config ALTERA_MBOX + An implementation of the Altera Mailbox soft core. It is used + to send message between processors. Say Y here if you want to use the + Altera mailbox support. ++ ++config BCM2835_MBOX ++ tristate "BCM2835 Mailbox" ++ depends on ARCH_BCM2835 ++ help ++ An implementation of the BCM2385 Mailbox. It is used to invoke ++ the services of the Videocore. Say Y here if you want to use the ++ BCM2835 Mailbox. ++ + endif +diff --git a/drivers/mailbox/Makefile b/drivers/mailbox/Makefile +index cecfad3..c86bc91 100644 +--- a/drivers/mailbox/Makefile ++++ b/drivers/mailbox/Makefile +@@ -13,3 +13,5 @@ obj-$(CONFIG_OMAP2PLUS_MBOX) += omap-mailbox.o + obj-$(CONFIG_PCC) += pcc.o + + obj-$(CONFIG_ALTERA_MBOX) += mailbox-altera.o ++ ++obj-$(CONFIG_BCM2835_MBOX) += bcm2835-mailbox.o +diff --git a/drivers/mailbox/bcm2835-mailbox.c b/drivers/mailbox/bcm2835-mailbox.c +new file mode 100644 +index 0000000..4b13268 +--- /dev/null ++++ b/drivers/mailbox/bcm2835-mailbox.c +@@ -0,0 +1,216 @@ ++/* ++ * Copyright (C) 2010,2015 Broadcom ++ * Copyright (C) 2013-2014 Lubomir Rintel ++ * Copyright (C) 2013 Craig McGeachie ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ * This device provides a mechanism for writing to the mailboxes, ++ * that are shared between the ARM and the VideoCore processor ++ * ++ * Parts of the driver are based on: ++ * - arch/arm/mach-bcm2708/vcio.c file written by Gray Girling that was ++ * obtained from branch "rpi-3.6.y" of git://github.com/raspberrypi/ ++ * linux.git ++ * - drivers/mailbox/bcm2835-ipc.c by Lubomir Rintel at ++ * https://github.com/hackerspace/rpi-linux/blob/lr-raspberry-pi/drivers/ ++ * mailbox/bcm2835-ipc.c ++ * - documentation available on the following web site: ++ * https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* Mailboxes */ ++#define ARM_0_MAIL0 0x00 ++#define ARM_0_MAIL1 0x20 ++ ++/* ++ * Mailbox registers. We basically only support mailbox 0 & 1. We ++ * deliver to the VC in mailbox 1, it delivers to us in mailbox 0. See ++ * BCM2835-ARM-Peripherals.pdf section 1.3 for an explanation about ++ * the placement of memory barriers. ++ */ ++#define MAIL0_RD (ARM_0_MAIL0 + 0x00) ++#define MAIL0_POL (ARM_0_MAIL0 + 0x10) ++#define MAIL0_STA (ARM_0_MAIL0 + 0x18) ++#define MAIL0_CNF (ARM_0_MAIL0 + 0x1C) ++#define MAIL1_WRT (ARM_0_MAIL1 + 0x00) ++ ++/* Status register: FIFO state. */ ++#define ARM_MS_FULL BIT(31) ++#define ARM_MS_EMPTY BIT(30) ++ ++/* Configuration register: Enable interrupts. */ ++#define ARM_MC_IHAVEDATAIRQEN BIT(0) ++ ++struct bcm2835_mbox { ++ void __iomem *regs; ++ spinlock_t lock; ++ struct mbox_controller controller; ++}; ++ ++static struct bcm2835_mbox *bcm2835_link_mbox(struct mbox_chan *link) ++{ ++ return container_of(link->mbox, struct bcm2835_mbox, controller); ++} ++ ++static irqreturn_t bcm2835_mbox_irq(int irq, void *dev_id) ++{ ++ struct bcm2835_mbox *mbox = dev_id; ++ struct device *dev = mbox->controller.dev; ++ struct mbox_chan *link = &mbox->controller.chans[0]; ++ ++ while (!(readl(mbox->regs + MAIL0_STA) & ARM_MS_EMPTY)) { ++ u32 msg = readl(mbox->regs + MAIL0_RD); ++ dev_dbg(dev, "Reply 0x%08X\n", msg); ++ mbox_chan_received_data(link, &msg); ++ } ++ return IRQ_HANDLED; ++} ++ ++static int bcm2835_send_data(struct mbox_chan *link, void *data) ++{ ++ struct bcm2835_mbox *mbox = bcm2835_link_mbox(link); ++ u32 msg = *(u32 *)data; ++ ++ spin_lock(&mbox->lock); ++ writel(msg, mbox->regs + MAIL1_WRT); ++ dev_dbg(mbox->controller.dev, "Request 0x%08X\n", msg); ++ spin_unlock(&mbox->lock); ++ return 0; ++} ++ ++static int bcm2835_startup(struct mbox_chan *link) ++{ ++ struct bcm2835_mbox *mbox = bcm2835_link_mbox(link); ++ ++ /* Enable the interrupt on data reception */ ++ writel(ARM_MC_IHAVEDATAIRQEN, mbox->regs + MAIL0_CNF); ++ ++ return 0; ++} ++ ++static void bcm2835_shutdown(struct mbox_chan *link) ++{ ++ struct bcm2835_mbox *mbox = bcm2835_link_mbox(link); ++ ++ writel(0, mbox->regs + MAIL0_CNF); ++} ++ ++static bool bcm2835_last_tx_done(struct mbox_chan *link) ++{ ++ struct bcm2835_mbox *mbox = bcm2835_link_mbox(link); ++ bool ret; ++ ++ spin_lock(&mbox->lock); ++ ret = !(readl(mbox->regs + MAIL0_STA) & ARM_MS_FULL); ++ spin_unlock(&mbox->lock); ++ return ret; ++} ++ ++static const struct mbox_chan_ops bcm2835_mbox_chan_ops = { ++ .send_data = bcm2835_send_data, ++ .startup = bcm2835_startup, ++ .shutdown = bcm2835_shutdown, ++ .last_tx_done = bcm2835_last_tx_done ++}; ++ ++static struct mbox_chan *bcm2835_mbox_index_xlate(struct mbox_controller *mbox, ++ const struct of_phandle_args *sp) ++{ ++ if (sp->args_count != 0) ++ return NULL; ++ ++ return &mbox->chans[0]; ++} ++ ++static int bcm2835_mbox_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ int ret = 0; ++ struct resource *iomem; ++ struct bcm2835_mbox *mbox; ++ ++ mbox = devm_kzalloc(dev, sizeof(*mbox), GFP_KERNEL); ++ if (mbox == NULL) ++ return -ENOMEM; ++ spin_lock_init(&mbox->lock); ++ ++ ret = devm_request_irq(dev, irq_of_parse_and_map(dev->of_node, 0), ++ bcm2835_mbox_irq, 0, dev_name(dev), mbox); ++ if (ret) { ++ dev_err(dev, "Failed to register a mailbox IRQ handler: %d\n", ++ ret); ++ return -ENODEV; ++ } ++ ++ iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ mbox->regs = devm_ioremap_resource(&pdev->dev, iomem); ++ if (IS_ERR(mbox->regs)) { ++ ret = PTR_ERR(mbox->regs); ++ dev_err(&pdev->dev, "Failed to remap mailbox regs: %d\n", ret); ++ return ret; ++ } ++ ++ mbox->controller.txdone_poll = true; ++ mbox->controller.txpoll_period = 5; ++ mbox->controller.ops = &bcm2835_mbox_chan_ops; ++ mbox->controller.of_xlate = &bcm2835_mbox_index_xlate; ++ mbox->controller.dev = dev; ++ mbox->controller.num_chans = 1; ++ mbox->controller.chans = devm_kzalloc(dev, ++ sizeof(*mbox->controller.chans), GFP_KERNEL); ++ if (!mbox->controller.chans) ++ return -ENOMEM; ++ ++ ret = mbox_controller_register(&mbox->controller); ++ if (ret) ++ return ret; ++ ++ platform_set_drvdata(pdev, mbox); ++ dev_info(dev, "mailbox enabled\n"); ++ ++ return ret; ++} ++ ++static int bcm2835_mbox_remove(struct platform_device *pdev) ++{ ++ struct bcm2835_mbox *mbox = platform_get_drvdata(pdev); ++ mbox_controller_unregister(&mbox->controller); ++ return 0; ++} ++ ++static const struct of_device_id bcm2835_mbox_of_match[] = { ++ { .compatible = "brcm,bcm2835-mbox", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, bcm2835_mbox_of_match); ++ ++static struct platform_driver bcm2835_mbox_driver = { ++ .driver = { ++ .name = "bcm2835-mbox", ++ .owner = THIS_MODULE, ++ .of_match_table = bcm2835_mbox_of_match, ++ }, ++ .probe = bcm2835_mbox_probe, ++ .remove = bcm2835_mbox_remove, ++}; ++module_platform_driver(bcm2835_mbox_driver); ++ ++MODULE_AUTHOR("Lubomir Rintel "); ++MODULE_DESCRIPTION("BCM2835 mailbox IPC driver"); ++MODULE_LICENSE("GPL v2"); + +From 44369d3764961e5cb7a7dfce2fdb31a86ff16b14 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Wed, 13 May 2015 13:10:32 -0700 +Subject: [PATCH 110/149] mailbox/bcm2835: Fix mailbox full detection. + +With the VC reader blocked and the ARM writing, MAIL0_STA reads empty +permanently while MAIL1_STA goes from empty (0x40000000) to non-empty +(0x00000001-0x00000007) to full (0x80000008). + +This bug ended up having no effect on us, because all of our +transactions in the client driver were synchronous and under a mutex. + +Suggested-by: Phil Elwell +Signed-off-by: Eric Anholt +Acked-by: Stephen Warren +Signed-off-by: Jassi Brar +--- + drivers/mailbox/bcm2835-mailbox.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/mailbox/bcm2835-mailbox.c b/drivers/mailbox/bcm2835-mailbox.c +index 4b13268..0b47dd4 100644 +--- a/drivers/mailbox/bcm2835-mailbox.c ++++ b/drivers/mailbox/bcm2835-mailbox.c +@@ -49,6 +49,7 @@ + #define MAIL0_STA (ARM_0_MAIL0 + 0x18) + #define MAIL0_CNF (ARM_0_MAIL0 + 0x1C) + #define MAIL1_WRT (ARM_0_MAIL1 + 0x00) ++#define MAIL1_STA (ARM_0_MAIL1 + 0x18) + + /* Status register: FIFO state. */ + #define ARM_MS_FULL BIT(31) +@@ -117,7 +118,7 @@ static bool bcm2835_last_tx_done(struct mbox_chan *link) + bool ret; + + spin_lock(&mbox->lock); +- ret = !(readl(mbox->regs + MAIL0_STA) & ARM_MS_FULL); ++ ret = !(readl(mbox->regs + MAIL1_STA) & ARM_MS_FULL); + spin_unlock(&mbox->lock); + return ret; + } + +From 4e08351a07fbe7f6e8625e3e538e94a2bc4c08bb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 26 Jun 2015 14:19:30 +0200 +Subject: [PATCH 111/149] mailbox: bcm2835: Support ARCH_BCM270x +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Make it possible to use bcm2835-mailbox without Device Tree. +Load driver early because of lacking support for deferred probing +in many drivers. + +Signed-off-by: Noralf Trønnes +--- + drivers/mailbox/Kconfig | 2 +- + drivers/mailbox/bcm2835-mailbox.c | 18 ++++++++++++++++-- + drivers/mailbox/mailbox.c | 13 ++++++++++++- + 3 files changed, 29 insertions(+), 4 deletions(-) + +diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig +index dc64c93..962b80c 100644 +--- a/drivers/mailbox/Kconfig ++++ b/drivers/mailbox/Kconfig +@@ -69,7 +69,7 @@ config ALTERA_MBOX + + config BCM2835_MBOX + tristate "BCM2835 Mailbox" +- depends on ARCH_BCM2835 ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 + help + An implementation of the BCM2385 Mailbox. It is used to invoke + the services of the Videocore. Say Y here if you want to use the +diff --git a/drivers/mailbox/bcm2835-mailbox.c b/drivers/mailbox/bcm2835-mailbox.c +index 0b47dd4..d16e286 100644 +--- a/drivers/mailbox/bcm2835-mailbox.c ++++ b/drivers/mailbox/bcm2835-mailbox.c +@@ -51,12 +51,15 @@ + #define MAIL1_WRT (ARM_0_MAIL1 + 0x00) + #define MAIL1_STA (ARM_0_MAIL1 + 0x18) + ++/* On ARCH_BCM270x these come through (arm_control.h ) */ ++#ifndef ARM_MS_FULL + /* Status register: FIFO state. */ + #define ARM_MS_FULL BIT(31) + #define ARM_MS_EMPTY BIT(30) + + /* Configuration register: Enable interrupts. */ + #define ARM_MC_IHAVEDATAIRQEN BIT(0) ++#endif + + struct bcm2835_mbox { + void __iomem *regs; +@@ -151,7 +154,7 @@ static int bcm2835_mbox_probe(struct platform_device *pdev) + return -ENOMEM; + spin_lock_init(&mbox->lock); + +- ret = devm_request_irq(dev, irq_of_parse_and_map(dev->of_node, 0), ++ ret = devm_request_irq(dev, platform_get_irq(pdev, 0), + bcm2835_mbox_irq, 0, dev_name(dev), mbox); + if (ret) { + dev_err(dev, "Failed to register a mailbox IRQ handler: %d\n", +@@ -210,7 +213,18 @@ static struct platform_driver bcm2835_mbox_driver = { + .probe = bcm2835_mbox_probe, + .remove = bcm2835_mbox_remove, + }; +-module_platform_driver(bcm2835_mbox_driver); ++ ++static int __init bcm2835_mbox_init(void) ++{ ++ return platform_driver_register(&bcm2835_mbox_driver); ++} ++arch_initcall(bcm2835_mbox_init); ++ ++static void __init bcm2835_mbox_exit(void) ++{ ++ platform_driver_unregister(&bcm2835_mbox_driver); ++} ++module_exit(bcm2835_mbox_exit); + + MODULE_AUTHOR("Lubomir Rintel "); + MODULE_DESCRIPTION("BCM2835 mailbox IPC driver"); +diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c +index 19b491d..cc07d71 100644 +--- a/drivers/mailbox/mailbox.c ++++ b/drivers/mailbox/mailbox.c +@@ -304,13 +304,23 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index) + unsigned long flags; + int ret; + +- if (!dev || !dev->of_node) { ++ if (!dev) { + pr_debug("%s: No owner device node\n", __func__); + return ERR_PTR(-ENODEV); + } + + mutex_lock(&con_mutex); + ++ if (!dev->of_node) { ++ chan = NULL; ++ /* pick the first controller in the list */ ++ list_for_each_entry(mbox, &mbox_cons, node) { ++ chan = &mbox->chans[0]; ++ break; ++ } ++ goto skip_dt; ++ } ++ + if (of_parse_phandle_with_args(dev->of_node, "mboxes", + "#mbox-cells", index, &spec)) { + dev_dbg(dev, "%s: can't parse \"mboxes\" property\n", __func__); +@@ -327,6 +337,7 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index) + + of_node_put(spec.np); + ++skip_dt: + if (!chan || chan->cl || !try_module_get(mbox->dev->driver->owner)) { + dev_dbg(dev, "%s: mailbox not free\n", __func__); + mutex_unlock(&con_mutex); + +From 3389224055b1ee2a518308c13583361f88ff5f82 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Thu, 4 Jun 2015 13:11:47 -0700 +Subject: [PATCH 112/149] ARM: bcm2835: Add the firmware driver information to + the RPi DT +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Eric Anholt +Acked-by: Lee Jones (previous version with pm-domains) +Acked-by: Stephen Warren +[Rebased on rpi-4.1.y] +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2835-rpi.dtsi | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/arch/arm/boot/dts/bcm2835-rpi.dtsi b/arch/arm/boot/dts/bcm2835-rpi.dtsi +index 466f02b..5cdfd5a 100644 +--- a/arch/arm/boot/dts/bcm2835-rpi.dtsi ++++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi +@@ -27,6 +27,13 @@ + }; + }; + ++ soc { ++ firmware: firmware { ++ compatible = "raspberrypi,bcm2835-firmware"; ++ mboxes = <&mailbox>; ++ }; ++ }; ++ + /* Onboard audio */ + audio: audio { + compatible = "brcm,bcm2835-audio"; + +From cc901351e0dd5e50ee5e11b8697a6f5b1f35ee0d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 26 Jun 2015 14:21:20 +0200 +Subject: [PATCH 113/149] firmware: bcm2835: Add missing property tags +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Noralf Trønnes +--- + include/soc/bcm2835/raspberrypi-firmware.h | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h +index 9d9efb7..d3933af 100644 +--- a/include/soc/bcm2835/raspberrypi-firmware.h ++++ b/include/soc/bcm2835/raspberrypi-firmware.h +@@ -60,6 +60,7 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_GET_MIN_VOLTAGE = 0x00030008, + RPI_FIRMWARE_GET_TURBO = 0x00030009, + RPI_FIRMWARE_GET_MAX_TEMPERATURE = 0x0003000a, ++ RPI_FIRMWARE_GET_STC = 0x0003000b, + RPI_FIRMWARE_ALLOCATE_MEMORY = 0x0003000c, + RPI_FIRMWARE_LOCK_MEMORY = 0x0003000d, + RPI_FIRMWARE_UNLOCK_MEMORY = 0x0003000e, +@@ -69,10 +70,12 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_SET_ENABLE_QPU = 0x00030012, + RPI_FIRMWARE_GET_DISPMANX_RESOURCE_MEM_HANDLE = 0x00030014, + RPI_FIRMWARE_GET_EDID_BLOCK = 0x00030020, ++ RPI_FIRMWARE_GET_CUSTOMER_OTP = 0x00030021, + RPI_FIRMWARE_SET_CLOCK_STATE = 0x00038001, + RPI_FIRMWARE_SET_CLOCK_RATE = 0x00038002, + RPI_FIRMWARE_SET_VOLTAGE = 0x00038003, + RPI_FIRMWARE_SET_TURBO = 0x00038009, ++ RPI_FIRMWARE_SET_CUSTOMER_OTP = 0x00038021, + + /* Dispmanx TAGS */ + RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE = 0x00040001, +@@ -86,6 +89,7 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_FRAMEBUFFER_GET_VIRTUAL_OFFSET = 0x00040009, + RPI_FIRMWARE_FRAMEBUFFER_GET_OVERSCAN = 0x0004000a, + RPI_FIRMWARE_FRAMEBUFFER_GET_PALETTE = 0x0004000b, ++ RPI_FIRMWARE_FRAMEBUFFER_GET_TOUCHBUF = 0x0004000f, + RPI_FIRMWARE_FRAMEBUFFER_RELEASE = 0x00048001, + RPI_FIRMWARE_FRAMEBUFFER_TEST_PHYSICAL_WIDTH_HEIGHT = 0x00044003, + RPI_FIRMWARE_FRAMEBUFFER_TEST_VIRTUAL_WIDTH_HEIGHT = 0x00044004, +@@ -95,6 +99,7 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_FRAMEBUFFER_TEST_VIRTUAL_OFFSET = 0x00044009, + RPI_FIRMWARE_FRAMEBUFFER_TEST_OVERSCAN = 0x0004400a, + RPI_FIRMWARE_FRAMEBUFFER_TEST_PALETTE = 0x0004400b, ++ RPI_FIRMWARE_FRAMEBUFFER_TEST_VSYNC = 0x0004400e, + RPI_FIRMWARE_FRAMEBUFFER_SET_PHYSICAL_WIDTH_HEIGHT = 0x00048003, + RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT = 0x00048004, + RPI_FIRMWARE_FRAMEBUFFER_SET_DEPTH = 0x00048005, +@@ -103,6 +108,9 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_OFFSET = 0x00048009, + RPI_FIRMWARE_FRAMEBUFFER_SET_OVERSCAN = 0x0004800a, + RPI_FIRMWARE_FRAMEBUFFER_SET_PALETTE = 0x0004800b, ++ RPI_FIRMWARE_FRAMEBUFFER_SET_VSYNC = 0x0004800e, ++ ++ RPI_FIRMWARE_VCHIQ_INIT = 0x00048010, + + RPI_FIRMWARE_GET_COMMAND_LINE = 0x00050001, + RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001, + +From 31139cf5452a835f8e160b7093b05dca12c6dd29 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 26 Jun 2015 14:25:01 +0200 +Subject: [PATCH 114/149] firmware: bcm2835: Support ARCH_BCM270x +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Support booting without Device Tree. +Turn on USB power. +Load driver early because of lacking support for deferred probing +in many drivers. + +Signed-off-by: Noralf Trønnes +--- + drivers/firmware/raspberrypi.c | 41 +++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 39 insertions(+), 2 deletions(-) + +diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c +index dd506cd3..b980d53 100644 +--- a/drivers/firmware/raspberrypi.c ++++ b/drivers/firmware/raspberrypi.c +@@ -28,6 +28,8 @@ struct rpi_firmware { + u32 enabled; + }; + ++static struct platform_device *g_pdev; ++ + static DEFINE_MUTEX(transaction_lock); + + static void response_callback(struct mbox_client *cl, void *msg) +@@ -183,6 +185,25 @@ rpi_firmware_print_firmware_revision(struct rpi_firmware *fw) + } + } + ++static int raspberrypi_firmware_set_power(struct rpi_firmware *fw, ++ u32 domain, bool on) ++{ ++ struct { ++ u32 domain; ++ u32 on; ++ } packet; ++ int ret; ++ ++ packet.domain = domain; ++ packet.on = on; ++ ret = rpi_firmware_property(fw, RPI_FIRMWARE_SET_POWER_STATE, ++ &packet, sizeof(packet)); ++ if (!ret && packet.on != on) ++ ret = -EINVAL; ++ ++ return ret; ++} ++ + static int rpi_firmware_probe(struct platform_device *pdev) + { + struct device *dev = &pdev->dev; +@@ -207,9 +228,13 @@ static int rpi_firmware_probe(struct platform_device *pdev) + init_completion(&fw->c); + + platform_set_drvdata(pdev, fw); ++ g_pdev = pdev; + + rpi_firmware_print_firmware_revision(fw); + ++ if (raspberrypi_firmware_set_power(fw, 3, true)) ++ dev_err(dev, "failed to turn on USB power\n"); ++ + return 0; + } + +@@ -218,6 +243,7 @@ static int rpi_firmware_remove(struct platform_device *pdev) + struct rpi_firmware *fw = platform_get_drvdata(pdev); + + mbox_free_channel(fw->chan); ++ g_pdev = NULL; + + return 0; + } +@@ -230,7 +256,7 @@ static int rpi_firmware_remove(struct platform_device *pdev) + */ + struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node) + { +- struct platform_device *pdev = of_find_device_by_node(firmware_node); ++ struct platform_device *pdev = g_pdev; + + if (!pdev) + return NULL; +@@ -253,7 +279,18 @@ static struct platform_driver rpi_firmware_driver = { + .probe = rpi_firmware_probe, + .remove = rpi_firmware_remove, + }; +-module_platform_driver(rpi_firmware_driver); ++ ++static int __init rpi_firmware_init(void) ++{ ++ return platform_driver_register(&rpi_firmware_driver); ++} ++subsys_initcall(rpi_firmware_init); ++ ++static void __init rpi_firmware_exit(void) ++{ ++ platform_driver_unregister(&rpi_firmware_driver); ++} ++module_exit(rpi_firmware_exit); + + MODULE_AUTHOR("Eric Anholt "); + MODULE_DESCRIPTION("Raspberry Pi firmware driver"); + +From fd247161acad069df68411af0500b183fbc78063 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 26 Jun 2015 14:26:10 +0200 +Subject: [PATCH 115/149] firmware: bcm2835: Support legacy mailbox API +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add support for the bcm_mailbox_*() functions. +This is temporary until all drivers have been converted to the +firmware API (rpi_firmware_property*()). + +Signed-off-by: Noralf Trønnes +--- + drivers/firmware/raspberrypi.c | 15 +++++++++++++-- + include/soc/bcm2835/raspberrypi-firmware.h | 2 ++ + 2 files changed, 15 insertions(+), 2 deletions(-) + +diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c +index b980d53..89421a9 100644 +--- a/drivers/firmware/raspberrypi.c ++++ b/drivers/firmware/raspberrypi.c +@@ -19,6 +19,7 @@ + #define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf)) + #define MBOX_CHAN(msg) ((msg) & 0xf) + #define MBOX_DATA28(msg) ((msg) & ~0xf) ++#define MBOX_CHAN_VCHIQ 3 + #define MBOX_CHAN_PROPERTY 8 + + struct rpi_firmware { +@@ -26,6 +27,7 @@ struct rpi_firmware { + struct mbox_chan *chan; /* The property channel. */ + struct completion c; + u32 enabled; ++ u32 received; + }; + + static struct platform_device *g_pdev; +@@ -35,6 +37,7 @@ static DEFINE_MUTEX(transaction_lock); + static void response_callback(struct mbox_client *cl, void *msg) + { + struct rpi_firmware *fw = container_of(cl, struct rpi_firmware, cl); ++ fw->received = *(u32 *)msg; + complete(&fw->c); + } + +@@ -42,7 +45,7 @@ static void response_callback(struct mbox_client *cl, void *msg) + * Sends a request to the firmware through the BCM2835 mailbox driver, + * and synchronously waits for the reply. + */ +-static int ++int + rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data) + { + u32 message = MBOX_MSG(chan, data); +@@ -54,7 +57,8 @@ rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data) + reinit_completion(&fw->c); + ret = mbox_send_message(fw->chan, &message); + if (ret >= 0) { +- wait_for_completion(&fw->c); ++ if (chan != MBOX_CHAN_VCHIQ) ++ wait_for_completion(&fw->c); + ret = 0; + } else { + dev_err(fw->cl.dev, "mbox_send_message returned %d\n", ret); +@@ -63,6 +67,13 @@ rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data) + + return ret; + } ++EXPORT_SYMBOL(rpi_firmware_transaction); ++ ++u32 rpi_firmware_transaction_received(struct rpi_firmware *fw) ++{ ++ return MBOX_DATA28(fw->received); ++} ++EXPORT_SYMBOL(rpi_firmware_transaction_received); + + /** + * rpi_firmware_property_list - Submit firmware property list +diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h +index d3933af..9a08cf1 100644 +--- a/include/soc/bcm2835/raspberrypi-firmware.h ++++ b/include/soc/bcm2835/raspberrypi-firmware.h +@@ -116,6 +116,8 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001, + }; + ++int rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data); ++u32 rpi_firmware_transaction_received(struct rpi_firmware *fw); + int rpi_firmware_property(struct rpi_firmware *fw, + u32 tag, void *data, size_t len); + int rpi_firmware_property_list(struct rpi_firmware *fw, + +From 491b53a48fc956dd91151f5998d54544ffeab094 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 26 Jun 2015 14:27:06 +0200 +Subject: [PATCH 116/149] char: broadcom: Add vcio module +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add module for accessing the mailbox property channel through +/dev/vcio. Was previously in bcm2708-vcio. + +Signed-off-by: Noralf Trønnes +--- + drivers/char/broadcom/Kconfig | 6 ++ + drivers/char/broadcom/Makefile | 1 + + drivers/char/broadcom/vcio.c | 175 +++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 182 insertions(+) + create mode 100644 drivers/char/broadcom/vcio.c + +diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig +index 75fa1cb..fc40846 100644 +--- a/drivers/char/broadcom/Kconfig ++++ b/drivers/char/broadcom/Kconfig +@@ -22,6 +22,12 @@ config BCM2708_VCMEM + help + Helper for videocore memory access and total size allocation. + ++config BCM_VCIO ++ tristate "Mailbox userspace access" ++ depends on BCM2835_MBOX ++ help ++ Gives access to the mailbox property channel from userspace. ++ + endif + + config BCM_VC_SM +diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile +index de8feb9..18171e2 100644 +--- a/drivers/char/broadcom/Makefile ++++ b/drivers/char/broadcom/Makefile +@@ -1,3 +1,4 @@ + obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ + obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o ++obj-$(CONFIG_BCM_VCIO) += vcio.o + obj-$(CONFIG_BCM_VC_SM) += vc_sm/ +diff --git a/drivers/char/broadcom/vcio.c b/drivers/char/broadcom/vcio.c +new file mode 100644 +index 0000000..c19bc20 +--- /dev/null ++++ b/drivers/char/broadcom/vcio.c +@@ -0,0 +1,175 @@ ++/* ++ * Copyright (C) 2010 Broadcom ++ * Copyright (C) 2015 Noralf Trønnes ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define MBOX_CHAN_PROPERTY 8 ++ ++#define VCIO_IOC_MAGIC 100 ++#define IOCTL_MBOX_PROPERTY _IOWR(VCIO_IOC_MAGIC, 0, char *) ++ ++static struct { ++ dev_t devt; ++ struct cdev cdev; ++ struct class *class; ++ struct rpi_firmware *fw; ++} vcio; ++ ++static int vcio_user_property_list(void *user) ++{ ++ u32 *buf, size; ++ int ret; ++ ++ /* The first 32-bit is the size of the buffer */ ++ if (copy_from_user(&size, user, sizeof(size))) ++ return -EFAULT; ++ ++ buf = kmalloc(size, GFP_KERNEL); ++ if (!buf) ++ return -ENOMEM; ++ ++ if (copy_from_user(buf, user, size)) { ++ kfree(buf); ++ return -EFAULT; ++ } ++ ++ /* Strip off protocol encapsulation */ ++ ret = rpi_firmware_property_list(vcio.fw, &buf[2], size - 12); ++ if (ret) { ++ kfree(buf); ++ return ret; ++ } ++ ++ buf[1] = RPI_FIRMWARE_STATUS_SUCCESS; ++ if (copy_to_user(user, buf, size)) ++ ret = -EFAULT; ++ ++ kfree(buf); ++ ++ return ret; ++} ++ ++static int vcio_device_open(struct inode *inode, struct file *file) ++{ ++ try_module_get(THIS_MODULE); ++ ++ return 0; ++} ++ ++static int vcio_device_release(struct inode *inode, struct file *file) ++{ ++ module_put(THIS_MODULE); ++ ++ return 0; ++} ++ ++static long vcio_device_ioctl(struct file *file, unsigned int ioctl_num, ++ unsigned long ioctl_param) ++{ ++ switch (ioctl_num) { ++ case IOCTL_MBOX_PROPERTY: ++ return vcio_user_property_list((void *)ioctl_param); ++ default: ++ pr_err("unknown ioctl: %d\n", ioctl_num); ++ return -EINVAL; ++ } ++} ++ ++const struct file_operations vcio_fops = { ++ .unlocked_ioctl = vcio_device_ioctl, ++ .open = vcio_device_open, ++ .release = vcio_device_release, ++}; ++ ++static int __init vcio_init(void) ++{ ++ struct device_node *np; ++ static struct device *dev; ++ int ret; ++ ++ np = of_find_compatible_node(NULL, NULL, ++ "raspberrypi,bcm2835-firmware"); ++/* Uncomment this when we only boot with Device Tree ++ if (!of_device_is_available(np)) ++ return -ENODEV; ++*/ ++ vcio.fw = rpi_firmware_get(np); ++ if (!vcio.fw) ++ return -ENODEV; ++ ++ ret = alloc_chrdev_region(&vcio.devt, 0, 1, "vcio"); ++ if (ret) { ++ pr_err("failed to allocate device number\n"); ++ return ret; ++ } ++ ++ cdev_init(&vcio.cdev, &vcio_fops); ++ vcio.cdev.owner = THIS_MODULE; ++ ret = cdev_add(&vcio.cdev, vcio.devt, 1); ++ if (ret) { ++ pr_err("failed to register device\n"); ++ goto err_unregister_chardev; ++ } ++ ++ /* ++ * Create sysfs entries ++ * 'bcm2708_vcio' is used for backwards compatibility so we don't break ++ * userspace. Raspian has a udev rule that changes the permissions. ++ */ ++ vcio.class = class_create(THIS_MODULE, "bcm2708_vcio"); ++ if (IS_ERR(vcio.class)) { ++ ret = PTR_ERR(vcio.class); ++ pr_err("failed to create class\n"); ++ goto err_cdev_del; ++ } ++ ++ dev = device_create(vcio.class, NULL, vcio.devt, NULL, "vcio"); ++ if (IS_ERR(dev)) { ++ ret = PTR_ERR(dev); ++ pr_err("failed to create device\n"); ++ goto err_class_destroy; ++ } ++ ++ return 0; ++ ++err_class_destroy: ++ class_destroy(vcio.class); ++err_cdev_del: ++ cdev_del(&vcio.cdev); ++err_unregister_chardev: ++ unregister_chrdev_region(vcio.devt, 1); ++ ++ return ret; ++} ++module_init(vcio_init); ++ ++static void __exit vcio_exit(void) ++{ ++ device_destroy(vcio.class, vcio.devt); ++ class_destroy(vcio.class); ++ cdev_del(&vcio.cdev); ++ unregister_chrdev_region(vcio.devt, 1); ++} ++module_exit(vcio_exit); ++ ++MODULE_AUTHOR("Gray Girling"); ++MODULE_AUTHOR("Noralf Trønnes"); ++MODULE_DESCRIPTION("Mailbox userspace access"); ++MODULE_LICENSE("GPL"); + +From 0c90bfa500f9c896f42a8cb59f7037b2c78fc8e5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 26 Jun 2015 14:37:19 +0200 +Subject: [PATCH 117/149] BCM270x: Switch to firmware driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +defconfig: enable BCM2835_MBOX, RASPBERRYPI_FIRMWARE and BCM_VCIO. +Add firmware node and change mailbox node in Device Tree. +Add/update platform file for firmware and mailbox. +Strip bcm2708-vcio of everything except the legacy API and hook it +up with the firmware driver. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 8 +- + arch/arm/configs/bcm2709_defconfig | 3 + + arch/arm/configs/bcmrpi_defconfig | 3 + + arch/arm/mach-bcm2708/bcm2708.c | 13 +- + arch/arm/mach-bcm2709/bcm2709.c | 13 +- + drivers/mailbox/Kconfig | 2 +- + drivers/mailbox/bcm2708-vcio.c | 353 ++-------------------------------- + 7 files changed, 51 insertions(+), 344 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index abf3e5d..2dd25f7 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -74,9 +74,10 @@ + }; + + mailbox: mailbox@7e00b800 { +- compatible = "brcm,bcm2708-vcio"; ++ compatible = "brcm,bcm2835-mbox"; + reg = <0x7e00b880 0x40>; + interrupts = <0 1>; ++ #mbox-cells = <0>; + }; + + watchdog: watchdog@7e100000 { +@@ -205,6 +206,11 @@ + <1 9>; + }; + ++ firmware: firmware { ++ compatible = "raspberrypi,bcm2835-firmware"; ++ mboxes = <&mailbox>; ++ }; ++ + leds: leds { + compatible = "gpio-leds"; + }; +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 5ecd84f..d75b104 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -574,6 +574,7 @@ CONFIG_HW_RANDOM_BCM2708=m + CONFIG_RAW_DRIVER=y + CONFIG_BRCM_CHAR_DRIVERS=y + CONFIG_BCM_VC_CMA=y ++CONFIG_BCM_VCIO=y + CONFIG_BCM_VC_SM=y + CONFIG_I2C=y + CONFIG_I2C_CHARDEV=m +@@ -1074,6 +1075,7 @@ CONFIG_FB_FLEX=m + CONFIG_FB_TFT_FBTFT_DEVICE=m + CONFIG_MAILBOX=y + CONFIG_BCM2708_MBOX=y ++CONFIG_BCM2835_MBOX=y + # CONFIG_IOMMU_SUPPORT is not set + CONFIG_EXTCON=m + CONFIG_EXTCON_ARIZONA=m +@@ -1082,6 +1084,7 @@ CONFIG_IIO_BUFFER=y + CONFIG_IIO_BUFFER_CB=y + CONFIG_IIO_KFIFO_BUF=m + CONFIG_DHT11=m ++CONFIG_RASPBERRYPI_FIRMWARE=y + CONFIG_EXT4_FS=y + CONFIG_EXT4_FS_POSIX_ACL=y + CONFIG_EXT4_FS_SECURITY=y +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 14b91fdf..9159892 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -567,6 +567,7 @@ CONFIG_HW_RANDOM_BCM2708=m + CONFIG_RAW_DRIVER=y + CONFIG_BRCM_CHAR_DRIVERS=y + CONFIG_BCM_VC_CMA=y ++CONFIG_BCM_VCIO=y + CONFIG_BCM_VC_SM=y + CONFIG_I2C=y + CONFIG_I2C_CHARDEV=m +@@ -1067,6 +1068,7 @@ CONFIG_FB_FLEX=m + CONFIG_FB_TFT_FBTFT_DEVICE=m + CONFIG_MAILBOX=y + CONFIG_BCM2708_MBOX=y ++CONFIG_BCM2835_MBOX=y + # CONFIG_IOMMU_SUPPORT is not set + CONFIG_EXTCON=m + CONFIG_EXTCON_ARIZONA=m +@@ -1075,6 +1077,7 @@ CONFIG_IIO_BUFFER=y + CONFIG_IIO_BUFFER_CB=y + CONFIG_IIO_KFIFO_BUF=m + CONFIG_DHT11=m ++CONFIG_RASPBERRYPI_FIRMWARE=y + CONFIG_EXT4_FS=y + CONFIG_EXT4_FS_POSIX_ACL=y + CONFIG_EXT4_FS_SECURITY=y +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index 937c2d3..1b9c3be 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -405,7 +405,7 @@ static struct resource bcm2708_vcio_resources[] = { + static u64 vcio_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); + + static struct platform_device bcm2708_vcio_device = { +- .name = "bcm2708_vcio", ++ .name = "bcm2835-mbox", + .id = -1, /* only one VideoCore I/O area */ + .resource = bcm2708_vcio_resources, + .num_resources = ARRAY_SIZE(bcm2708_vcio_resources), +@@ -415,6 +415,16 @@ static struct platform_device bcm2708_vcio_device = { + }, + }; + ++static u64 rpifw_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); ++ ++static struct platform_device bcm2708_rpifw_device = { ++ .name = "raspberrypi-firmware", ++ .dev = { ++ .dma_mask = &rpifw_dmamask, ++ .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON), ++ }, ++}; ++ + static struct resource bcm2708_vchiq_resources[] = { + { + .start = ARMCTRL_0_BELL_BASE, +@@ -871,6 +881,7 @@ void __init bcm2708_init(void) + + bcm_register_device_dt(&bcm2708_dmaengine_device); + bcm_register_device_dt(&bcm2708_vcio_device); ++ bcm_register_device_dt(&bcm2708_rpifw_device); + bcm_register_device_dt(&bcm2708_vchiq_device); + #ifdef CONFIG_BCM2708_GPIO + bcm_register_device_dt(&bcm2708_gpio_device); +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index fe71c50..e1934dc 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -426,7 +426,7 @@ static struct resource bcm2708_vcio_resources[] = { + static u64 vcio_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); + + static struct platform_device bcm2708_vcio_device = { +- .name = "bcm2708_vcio", ++ .name = "bcm2835-mbox", + .id = -1, /* only one VideoCore I/O area */ + .resource = bcm2708_vcio_resources, + .num_resources = ARRAY_SIZE(bcm2708_vcio_resources), +@@ -436,6 +436,16 @@ static struct platform_device bcm2708_vcio_device = { + }, + }; + ++static u64 rpifw_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); ++ ++static struct platform_device bcm2708_rpifw_device = { ++ .name = "raspberrypi-firmware", ++ .dev = { ++ .dma_mask = &rpifw_dmamask, ++ .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON), ++ }, ++}; ++ + static struct resource bcm2708_vchiq_resources[] = { + { + .start = ARMCTRL_0_BELL_BASE, +@@ -892,6 +902,7 @@ void __init bcm2709_init(void) + + bcm_register_device_dt(&bcm2708_dmaengine_device); + bcm_register_device_dt(&bcm2708_vcio_device); ++ bcm_register_device_dt(&bcm2708_rpifw_device); + bcm_register_device_dt(&bcm2708_vchiq_device); + #ifdef CONFIG_BCM2708_GPIO + bcm_register_device_dt(&bcm2708_gpio_device); +diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig +index 962b80c..d1a6671 100644 +--- a/drivers/mailbox/Kconfig ++++ b/drivers/mailbox/Kconfig +@@ -9,7 +9,7 @@ if MAILBOX + + config BCM2708_MBOX + bool "Broadcom BCM2708 Mailbox (vcio)" +- depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835 ++ depends on BCM2835_MBOX + help + Broadcom BCM2708 Mailbox (vcio) + +diff --git a/drivers/mailbox/bcm2708-vcio.c b/drivers/mailbox/bcm2708-vcio.c +index 06fb2c2f..2e4031b 100644 +--- a/drivers/mailbox/bcm2708-vcio.c ++++ b/drivers/mailbox/bcm2708-vcio.c +@@ -1,6 +1,4 @@ + /* +- * linux/arch/arm/mach-bcm2708/vcio.c +- * + * Copyright (C) 2010 Broadcom + * + * This program is free software; you can redistribute it and/or modify +@@ -12,195 +10,38 @@ + * VideoCore processor + */ + +-#include + #include +-#include +-#include +-#include + #include +-#include +-#include +-#include ++#include + #include +-#include + #include ++#include + + #define DRIVER_NAME "bcm2708_vcio" +-#define DEVICE_FILE_NAME "vcio" +- +-/* offsets from a mail box base address */ +-#define MAIL0_RD 0x00 /* read - and next 4 words */ +-#define MAIL0_POL 0x10 /* read without popping the fifo */ +-#define MAIL0_SND 0x14 /* sender ID (bottom two bits) */ +-#define MAIL0_STA 0x18 /* status */ +-#define MAIL0_CNF 0x1C /* configuration */ +-#define MAIL1_WRT 0x20 /* write - and next 4 words */ +-#define MAIL1_STA 0x38 /* status */ +- +-/* On MACH_BCM270x these come through (arm_control.h ) */ +-#ifndef ARM_MS_EMPTY +-#define ARM_MS_EMPTY BIT(30) +-#define ARM_MS_FULL BIT(31) +- +-#define ARM_MC_IHAVEDATAIRQEN BIT(0) +-#endif +- +-#define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf)) +-#define MBOX_MSG_LSB(chan, data28) (((data28) << 4) | ((chan) & 0xf)) +-#define MBOX_CHAN(msg) ((msg) & 0xf) +-#define MBOX_DATA28(msg) ((msg) & ~0xf) +-#define MBOX_DATA28_LSB(msg) (((uint32_t)msg) >> 4) +- +-#define MBOX_MAGIC 0xd0d0c0de +- +-#define MAJOR_NUM 100 +-#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *) +- +-static struct class *vcio_class; +- +-struct vc_mailbox { +- void __iomem *regs; +- uint32_t msg[MBOX_CHAN_COUNT]; +- struct semaphore sema[MBOX_CHAN_COUNT]; +- uint32_t magic; +-}; +- +-static void mbox_init(struct vc_mailbox *mbox_out) +-{ +- int i; +- +- for (i = 0; i < MBOX_CHAN_COUNT; i++) { +- mbox_out->msg[i] = 0; +- sema_init(&mbox_out->sema[i], 0); +- } +- +- /* Enable the interrupt on data reception */ +- writel(ARM_MC_IHAVEDATAIRQEN, mbox_out->regs + MAIL0_CNF); +- +- mbox_out->magic = MBOX_MAGIC; +-} +- +-static int mbox_write(struct vc_mailbox *mbox, unsigned chan, uint32_t data28) +-{ +- if (mbox->magic != MBOX_MAGIC) +- return -EINVAL; +- +- /* wait for the mailbox FIFO to have some space in it */ +- while (0 != (readl(mbox->regs + MAIL1_STA) & ARM_MS_FULL)) +- cpu_relax(); +- +- writel(MBOX_MSG(chan, data28), mbox->regs + MAIL1_WRT); +- +- return 0; +-} +- +-static int mbox_read(struct vc_mailbox *mbox, unsigned chan, uint32_t *data28) +-{ +- if (mbox->magic != MBOX_MAGIC) +- return -EINVAL; +- +- down(&mbox->sema[chan]); +- *data28 = MBOX_DATA28(mbox->msg[chan]); +- mbox->msg[chan] = 0; +- +- return 0; +-} +- +-static irqreturn_t mbox_irq_handler(int irq, void *dev_id) +-{ +- /* wait for the mailbox FIFO to have some data in it */ +- struct vc_mailbox *mbox = (struct vc_mailbox *)dev_id; +- int status = readl(mbox->regs + MAIL0_STA); +- int ret = IRQ_NONE; +- +- while (!(status & ARM_MS_EMPTY)) { +- uint32_t msg = readl(mbox->regs + MAIL0_RD); +- int chan = MBOX_CHAN(msg); +- +- if (chan < MBOX_CHAN_COUNT) { +- if (mbox->msg[chan]) { +- pr_err(DRIVER_NAME +- ": mbox chan %d overflow - drop %08x\n", +- chan, msg); +- } else { +- mbox->msg[chan] = (msg | 0xf); +- up(&mbox->sema[chan]); +- } +- } else { +- pr_err(DRIVER_NAME +- ": invalid channel selector (msg %08x)\n", msg); +- } +- ret = IRQ_HANDLED; +- status = readl(mbox->regs + MAIL0_STA); +- } +- return ret; +-} +- +-/* Mailbox Methods */ +- +-static struct device *mbox_dev; /* we assume there's only one! */ +- +-static int dev_mbox_write(struct device *dev, unsigned chan, uint32_t data28) +-{ +- struct vc_mailbox *mailbox = dev_get_drvdata(dev); +- int rc; +- +- device_lock(dev); +- rc = mbox_write(mailbox, chan, data28); +- device_unlock(dev); +- +- return rc; +-} +- +-static int dev_mbox_read(struct device *dev, unsigned chan, uint32_t *data28) +-{ +- struct vc_mailbox *mailbox = dev_get_drvdata(dev); +- int rc; +- +- device_lock(dev); +- rc = mbox_read(mailbox, chan, data28); +- device_unlock(dev); +- +- return rc; +-} + + extern int bcm_mailbox_write(unsigned chan, uint32_t data28) + { +- if (!mbox_dev) ++ struct rpi_firmware *fw = rpi_firmware_get(NULL); ++ ++ if (!fw) + return -ENODEV; + +- return dev_mbox_write(mbox_dev, chan, data28); ++ return rpi_firmware_transaction(fw, chan, data28); + } + EXPORT_SYMBOL_GPL(bcm_mailbox_write); + + extern int bcm_mailbox_read(unsigned chan, uint32_t *data28) + { +- if (!mbox_dev) +- return -ENODEV; +- +- return dev_mbox_read(mbox_dev, chan, data28); +-} +-EXPORT_SYMBOL_GPL(bcm_mailbox_read); ++ struct rpi_firmware *fw = rpi_firmware_get(NULL); + +-static int mbox_copy_from_user(void *dst, const void *src, int size) +-{ +- if ((uint32_t)src < TASK_SIZE) +- return copy_from_user(dst, src, size); +- +- memcpy(dst, src, size); +- +- return 0; +-} +- +-static int mbox_copy_to_user(void *dst, const void *src, int size) +-{ +- if ((uint32_t)dst < TASK_SIZE) +- return copy_to_user(dst, src, size); ++ if (!fw) ++ return -ENODEV; + +- memcpy(dst, src, size); ++ *data28 = rpi_firmware_transaction_received(fw); + + return 0; + } ++EXPORT_SYMBOL_GPL(bcm_mailbox_read); + + static DEFINE_MUTEX(mailbox_lock); + extern int bcm_mailbox_property(void *data, int size) +@@ -216,7 +57,7 @@ extern int bcm_mailbox_property(void *data, int size) + GFP_KERNEL); + if (mem_kern) { + /* create the message */ +- mbox_copy_from_user(mem_kern, data, size); ++ memcpy(mem_kern, data, size); + + /* send the message */ + wmb(); +@@ -226,7 +67,7 @@ extern int bcm_mailbox_property(void *data, int size) + if (s == 0) { + /* copy the response */ + rmb(); +- mbox_copy_to_user(data, mem_kern, size); ++ memcpy(data, mem_kern, size); + } + dma_free_coherent(NULL, PAGE_ALIGN(size), mem_kern, mem_bus); + } else { +@@ -240,174 +81,6 @@ extern int bcm_mailbox_property(void *data, int size) + } + EXPORT_SYMBOL_GPL(bcm_mailbox_property); + +-/* Platform Device for Mailbox */ +- +-/* This is called whenever a process attempts to open the device file */ +-static int device_open(struct inode *inode, struct file *file) +-{ +- try_module_get(THIS_MODULE); +- +- return 0; +-} +- +-static int device_release(struct inode *inode, struct file *file) +-{ +- module_put(THIS_MODULE); +- +- return 0; +-} +- +-/* +- * This function is called whenever a process tries to do an ioctl on our +- * device file. We get two extra parameters (additional to the inode and file +- * structures, which all device functions get): the number of the ioctl called +- * and the parameter given to the ioctl function. +- * +- * If the ioctl is write or read/write (meaning output is returned to the +- * calling process), the ioctl call returns the output of this function. +- * +- */ +-static long device_ioctl(struct file *file, unsigned int ioctl_num, +- unsigned long ioctl_param) +-{ +- unsigned size; +- +- switch (ioctl_num) { +- case IOCTL_MBOX_PROPERTY: +- /* +- * Receive a pointer to a message (in user space) and set that +- * to be the device's message. Get the parameter given to +- * ioctl by the process. +- */ +- mbox_copy_from_user(&size, (void *)ioctl_param, sizeof(size)); +- return bcm_mailbox_property((void *)ioctl_param, size); +- default: +- pr_err(DRIVER_NAME "unknown ioctl: %d\n", ioctl_num); +- return -EINVAL; +- } +- +- return 0; +-} +- +-/* Module Declarations */ +- +-/* +- * This structure will hold the functions to be called +- * when a process does something to the device we +- * created. Since a pointer to this structure is kept in +- * the devices table, it can't be local to +- * init_module. NULL is for unimplemented functios. +- */ +-const struct file_operations fops = { +- .unlocked_ioctl = device_ioctl, +- .open = device_open, +- .release = device_release, /* a.k.a. close */ +-}; +- +-static int bcm_vcio_probe(struct platform_device *pdev) +-{ +- struct device *dev = &pdev->dev; +- struct device *vdev; +- struct vc_mailbox *mailbox; +- struct resource *res; +- int irq, ret; +- +- mailbox = devm_kzalloc(dev, sizeof(*mailbox), GFP_KERNEL); +- if (!mailbox) +- return -ENOMEM; +- +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- mailbox->regs = devm_ioremap_resource(dev, res); +- if (IS_ERR(mailbox->regs)) +- return PTR_ERR(mailbox->regs); +- +- irq = platform_get_irq(pdev, 0); +- ret = devm_request_irq(dev, irq, mbox_irq_handler, +- IRQF_IRQPOLL, +- dev_name(dev), mailbox); +- if (ret) { +- dev_err(dev, "Interrupt request failed %d\n", ret); +- return ret; +- } +- +- ret = register_chrdev(MAJOR_NUM, DEVICE_FILE_NAME, &fops); +- if (ret < 0) { +- pr_err("Character device registration failed %d\n", ret); +- return ret; +- } +- +- vcio_class = class_create(THIS_MODULE, DRIVER_NAME); +- if (IS_ERR(vcio_class)) { +- ret = PTR_ERR(vcio_class); +- pr_err("Class creation failed %d\n", ret); +- goto err_class; +- } +- +- vdev = device_create(vcio_class, NULL, MKDEV(MAJOR_NUM, 0), NULL, +- "vcio"); +- if (IS_ERR(vdev)) { +- ret = PTR_ERR(vdev); +- pr_err("Device creation failed %d\n", ret); +- goto err_dev; +- } +- +- mbox_init(mailbox); +- platform_set_drvdata(pdev, mailbox); +- mbox_dev = dev; +- +- dev_info(dev, "mailbox at %p\n", mailbox->regs); +- +- return 0; +- +-err_dev: +- class_destroy(vcio_class); +-err_class: +- unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); +- +- return ret; +-} +- +-static int bcm_vcio_remove(struct platform_device *pdev) +-{ +- mbox_dev = NULL; +- platform_set_drvdata(pdev, NULL); +- device_destroy(vcio_class, MKDEV(MAJOR_NUM, 0)); +- class_destroy(vcio_class); +- unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); +- +- return 0; +-} +- +-static const struct of_device_id bcm_vcio_of_match_table[] = { +- { .compatible = "brcm,bcm2708-vcio", }, +- {}, +-}; +-MODULE_DEVICE_TABLE(of, bcm_vcio_of_match_table); +- +-static struct platform_driver bcm_mbox_driver = { +- .probe = bcm_vcio_probe, +- .remove = bcm_vcio_remove, +- +- .driver = { +- .name = DRIVER_NAME, +- .owner = THIS_MODULE, +- .of_match_table = bcm_vcio_of_match_table, +- }, +-}; +- +-static int __init bcm_mbox_init(void) +-{ +- return platform_driver_register(&bcm_mbox_driver); +-} +- +-static void __exit bcm_mbox_exit(void) +-{ +- platform_driver_unregister(&bcm_mbox_driver); +-} +- +-arch_initcall(bcm_mbox_init); /* Initialize early */ +-module_exit(bcm_mbox_exit); +- + MODULE_AUTHOR("Gray Girling"); + MODULE_DESCRIPTION("ARM I/O to VideoCore processor"); + MODULE_LICENSE("GPL"); + +From 261e67ec20793d9a0f615e16b7bce7ae7a70e138 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 26 Jun 2015 14:39:21 +0200 +Subject: [PATCH 118/149] bcm2835: Switch to firmware driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +defconfig: enable BCM2835_MBOX, RASPBERRYPI_FIRMWARE and BCM_VCIO. + +Add firmware node and change mailbox node in Device Tree. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2835.dtsi | 3 ++- + arch/arm/configs/bcm2835_defconfig | 3 +++ + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi +index 4b6dd65f..4a63704 100644 +--- a/arch/arm/boot/dts/bcm2835.dtsi ++++ b/arch/arm/boot/dts/bcm2835.dtsi +@@ -62,9 +62,10 @@ + }; + + mailbox: mailbox@7e00b800 { +- compatible = "brcm,bcm2708-vcio"; ++ compatible = "brcm,bcm2835-mbox"; + reg = <0x7e00b880 0x40>; + interrupts = <0 1>; ++ #mbox-cells = <0>; + }; + + gpio: gpio@7e200000 { +diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig +index 47f2a6a..c284414 100644 +--- a/arch/arm/configs/bcm2835_defconfig ++++ b/arch/arm/configs/bcm2835_defconfig +@@ -568,6 +568,7 @@ CONFIG_HW_RANDOM_BCM2835=m + CONFIG_RAW_DRIVER=y + CONFIG_BRCM_CHAR_DRIVERS=y + CONFIG_BCM_VC_CMA=y ++CONFIG_BCM_VCIO=y + CONFIG_BCM_VC_SM=y + CONFIG_I2C=y + CONFIG_I2C_CHARDEV=m +@@ -1064,9 +1065,11 @@ CONFIG_FB_FLEX=m + CONFIG_FB_TFT_FBTFT_DEVICE=m + CONFIG_MAILBOX=y + CONFIG_BCM2708_MBOX=y ++CONFIG_BCM2835_MBOX=y + # CONFIG_IOMMU_SUPPORT is not set + CONFIG_EXTCON=m + CONFIG_EXTCON_ARIZONA=m ++CONFIG_RASPBERRYPI_FIRMWARE=y + CONFIG_EXT2_FS=y + CONFIG_EXT2_FS_XATTR=y + CONFIG_EXT2_FS_POSIX_ACL=y + +From 564c166a50d6db491679366414e4c51d58b951d4 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 13 Jul 2015 13:25:31 +0100 +Subject: [PATCH 119/149] Merge pull request #1059 from pelwell/rpi-4.0.y + +w1_therm: Back-port locking improvements from 4.2-rc1 +--- + Documentation/ABI/stable/sysfs-driver-w1_ds28ea00 | 6 ++ + Documentation/w1/slaves/w1_therm | 11 ++- + drivers/w1/slaves/w1_therm.c | 102 +++++++++++++++++++++- + 3 files changed, 117 insertions(+), 2 deletions(-) + create mode 100644 Documentation/ABI/stable/sysfs-driver-w1_ds28ea00 + +diff --git a/Documentation/ABI/stable/sysfs-driver-w1_ds28ea00 b/Documentation/ABI/stable/sysfs-driver-w1_ds28ea00 +new file mode 100644 +index 0000000..e928def +--- /dev/null ++++ b/Documentation/ABI/stable/sysfs-driver-w1_ds28ea00 +@@ -0,0 +1,6 @@ ++What: /sys/bus/w1/devices/.../w1_seq ++Date: Apr 2015 ++Contact: Matt Campbell ++Description: Support for the DS28EA00 chain sequence function ++ see Documentation/w1/slaves/w1_therm for detailed information ++Users: any user space application which wants to communicate with DS28EA00 +diff --git a/Documentation/w1/slaves/w1_therm b/Documentation/w1/slaves/w1_therm +index cc62a95..13411fe 100644 +--- a/Documentation/w1/slaves/w1_therm ++++ b/Documentation/w1/slaves/w1_therm +@@ -11,12 +11,14 @@ Author: Evgeniy Polyakov + Description + ----------- + +-w1_therm provides basic temperature conversion for ds18*20 devices. ++w1_therm provides basic temperature conversion for ds18*20 devices, and the ++ds28ea00 device. + supported family codes: + W1_THERM_DS18S20 0x10 + W1_THERM_DS1822 0x22 + W1_THERM_DS18B20 0x28 + W1_THERM_DS1825 0x3B ++W1_THERM_DS28EA00 0x42 + + Support is provided through the sysfs w1_slave file. Each open and + read sequence will initiate a temperature conversion then provide two +@@ -48,3 +50,10 @@ resistor). The DS18b20 temperature sensor specification lists a + maximum current draw of 1.5mA and that a 5k pullup resistor is not + sufficient. The strong pullup is designed to provide the additional + current required. ++ ++The DS28EA00 provides an additional two pins for implementing a sequence ++detection algorithm. This feature allows you to determine the physical ++location of the chip in the 1-wire bus without needing pre-existing ++knowledge of the bus ordering. Support is provided through the sysfs ++w1_seq file. The file will contain a single line with an integer value ++representing the device index in the bus starting at 0. +diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c +index 55eb86c..2f029e8 100644 +--- a/drivers/w1/slaves/w1_therm.c ++++ b/drivers/w1/slaves/w1_therm.c +@@ -92,13 +92,24 @@ static void w1_therm_remove_slave(struct w1_slave *sl) + static ssize_t w1_slave_show(struct device *device, + struct device_attribute *attr, char *buf); + ++static ssize_t w1_seq_show(struct device *device, ++ struct device_attribute *attr, char *buf); ++ + static DEVICE_ATTR_RO(w1_slave); ++static DEVICE_ATTR_RO(w1_seq); + + static struct attribute *w1_therm_attrs[] = { + &dev_attr_w1_slave.attr, + NULL, + }; ++ ++static struct attribute *w1_ds28ea00_attrs[] = { ++ &dev_attr_w1_slave.attr, ++ &dev_attr_w1_seq.attr, ++ NULL, ++}; + ATTRIBUTE_GROUPS(w1_therm); ++ATTRIBUTE_GROUPS(w1_ds28ea00); + + static struct w1_family_ops w1_therm_fops = { + .add_slave = w1_therm_add_slave, +@@ -106,6 +117,12 @@ static struct w1_family_ops w1_therm_fops = { + .groups = w1_therm_groups, + }; + ++static struct w1_family_ops w1_ds28ea00_fops = { ++ .add_slave = w1_therm_add_slave, ++ .remove_slave = w1_therm_remove_slave, ++ .groups = w1_ds28ea00_groups, ++}; ++ + static struct w1_family w1_therm_family_DS18S20 = { + .fid = W1_THERM_DS18S20, + .fops = &w1_therm_fops, +@@ -123,7 +140,7 @@ static struct w1_family w1_therm_family_DS1822 = { + + static struct w1_family w1_therm_family_DS28EA00 = { + .fid = W1_THERM_DS28EA00, +- .fops = &w1_therm_fops, ++ .fops = &w1_ds28ea00_fops, + }; + + static struct w1_family w1_therm_family_DS1825 = { +@@ -316,6 +333,89 @@ static ssize_t w1_slave_show(struct device *device, + return ret; + } + ++#define W1_42_CHAIN 0x99 ++#define W1_42_CHAIN_OFF 0x3C ++#define W1_42_CHAIN_OFF_INV 0xC3 ++#define W1_42_CHAIN_ON 0x5A ++#define W1_42_CHAIN_ON_INV 0xA5 ++#define W1_42_CHAIN_DONE 0x96 ++#define W1_42_CHAIN_DONE_INV 0x69 ++#define W1_42_COND_READ 0x0F ++#define W1_42_SUCCESS_CONFIRM_BYTE 0xAA ++#define W1_42_FINISHED_BYTE 0xFF ++static ssize_t w1_seq_show(struct device *device, ++ struct device_attribute *attr, char *buf) ++{ ++ struct w1_slave *sl = dev_to_w1_slave(device); ++ ssize_t c = PAGE_SIZE; ++ int rv; ++ int i; ++ u8 ack; ++ u64 rn; ++ struct w1_reg_num *reg_num; ++ int seq = 0; ++ ++ mutex_lock(&sl->master->bus_mutex); ++ /* Place all devices in CHAIN state */ ++ if (w1_reset_bus(sl->master)) ++ goto error; ++ w1_write_8(sl->master, W1_SKIP_ROM); ++ w1_write_8(sl->master, W1_42_CHAIN); ++ w1_write_8(sl->master, W1_42_CHAIN_ON); ++ w1_write_8(sl->master, W1_42_CHAIN_ON_INV); ++ msleep(sl->master->pullup_duration); ++ ++ /* check for acknowledgment */ ++ ack = w1_read_8(sl->master); ++ if (ack != W1_42_SUCCESS_CONFIRM_BYTE) ++ goto error; ++ ++ /* In case the bus fails to send 0xFF, limit*/ ++ for (i = 0; i <= 64; i++) { ++ if (w1_reset_bus(sl->master)) ++ goto error; ++ ++ w1_write_8(sl->master, W1_42_COND_READ); ++ rv = w1_read_block(sl->master, (u8 *)&rn, 8); ++ reg_num = (struct w1_reg_num *) &rn; ++ if (reg_num->family == W1_42_FINISHED_BYTE) ++ break; ++ if (sl->reg_num.id == reg_num->id) ++ seq = i; ++ ++ w1_write_8(sl->master, W1_42_CHAIN); ++ w1_write_8(sl->master, W1_42_CHAIN_DONE); ++ w1_write_8(sl->master, W1_42_CHAIN_DONE_INV); ++ w1_read_block(sl->master, &ack, sizeof(ack)); ++ ++ /* check for acknowledgment */ ++ ack = w1_read_8(sl->master); ++ if (ack != W1_42_SUCCESS_CONFIRM_BYTE) ++ goto error; ++ ++ } ++ ++ /* Exit from CHAIN state */ ++ if (w1_reset_bus(sl->master)) ++ goto error; ++ w1_write_8(sl->master, W1_SKIP_ROM); ++ w1_write_8(sl->master, W1_42_CHAIN); ++ w1_write_8(sl->master, W1_42_CHAIN_OFF); ++ w1_write_8(sl->master, W1_42_CHAIN_OFF_INV); ++ ++ /* check for acknowledgment */ ++ ack = w1_read_8(sl->master); ++ if (ack != W1_42_SUCCESS_CONFIRM_BYTE) ++ goto error; ++ mutex_unlock(&sl->master->bus_mutex); ++ ++ c -= snprintf(buf + PAGE_SIZE - c, c, "%d\n", seq); ++ return PAGE_SIZE - c; ++error: ++ mutex_unlock(&sl->master->bus_mutex); ++ return -EIO; ++} ++ + static int __init w1_therm_init(void) + { + int err, i; + +From 01f81174825984b4f3d309ffcdade224d94ab572 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 14 Jul 2015 11:11:51 +0100 +Subject: [PATCH 120/149] vchiq_arm: Sort out the vmalloc case + +See: https://github.com/raspberrypi/linux/issues/1055 +--- + .../misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +index 5edba23..56bff05 100644 +--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +@@ -394,21 +394,21 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, + if (is_vmalloc_addr(buf)) { + int dir = (type == PAGELIST_WRITE) ? + DMA_TO_DEVICE : DMA_FROM_DEVICE; +- unsigned long length = pagelist->length; +- unsigned int offset = pagelist->offset; ++ unsigned long length = count; ++ unsigned int off = offset; + + for (actual_pages = 0; actual_pages < num_pages; + actual_pages++) { + struct page *pg = vmalloc_to_page(buf + (actual_pages * + PAGE_SIZE)); +- size_t bytes = PAGE_SIZE - offset; ++ size_t bytes = PAGE_SIZE - off; + + if (bytes > length) + bytes = length; + pages[actual_pages] = pg; +- dmac_map_area(page_address(pg) + offset, bytes, dir); ++ dmac_map_area(page_address(pg) + off, bytes, dir); + length -= bytes; +- offset = 0; ++ off = 0; + } + *need_release = 0; /* do not try and release vmalloc pages */ + } else { + +From 6a9ee1422507ded4b20bb30b34a1ae8151ae2141 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 14 Jul 2015 10:26:09 +0100 +Subject: [PATCH 121/149] spidev: Add "spidev" compatible string to silence + warning + +See: https://github.com/raspberrypi/linux/issues/1054 +--- + drivers/spi/spidev.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c +index 92c909e..0535375 100644 +--- a/drivers/spi/spidev.c ++++ b/drivers/spi/spidev.c +@@ -706,6 +706,7 @@ static struct class *spidev_class; + #ifdef CONFIG_OF + static const struct of_device_id spidev_dt_ids[] = { + { .compatible = "rohm,dh2228fv" }, ++ { .compatible = "spidev" }, + {}, + }; + MODULE_DEVICE_TABLE(of, spidev_dt_ids); + +From 710b1c336c5ca81b429212218b6209df1db468c9 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 14 Jul 2015 14:32:47 +0100 +Subject: [PATCH 122/149] Merge pull request #1043 from XECDesign/sense-4.0 + +mfd: Add Raspberry Pi Sense HAT core driver +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 6 + + arch/arm/boot/dts/overlays/rpi-sense-overlay.dts | 47 +++++ + arch/arm/configs/bcm2709_defconfig | 2 + + arch/arm/configs/bcmrpi_defconfig | 2 + + drivers/input/joystick/Kconfig | 8 + + drivers/input/joystick/Makefile | 1 + + drivers/input/joystick/rpisense-js.c | 153 +++++++++++++++ + drivers/mfd/Kconfig | 8 + + drivers/mfd/Makefile | 2 + + drivers/mfd/rpisense-core.c | 157 +++++++++++++++ + drivers/video/fbdev/Kconfig | 13 ++ + drivers/video/fbdev/Makefile | 1 + + drivers/video/fbdev/rpisense-fb.c | 235 +++++++++++++++++++++++ + include/linux/mfd/rpisense/core.h | 47 +++++ + include/linux/mfd/rpisense/framebuffer.h | 28 +++ + include/linux/mfd/rpisense/joystick.h | 35 ++++ + 17 files changed, 746 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/rpi-sense-overlay.dts + create mode 100644 drivers/input/joystick/rpisense-js.c + create mode 100644 drivers/mfd/rpisense-core.c + create mode 100644 drivers/video/fbdev/rpisense-fb.c + create mode 100644 include/linux/mfd/rpisense/core.h + create mode 100644 include/linux/mfd/rpisense/framebuffer.h + create mode 100644 include/linux/mfd/rpisense/joystick.h + +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +index 4ff9836..5f6082f 100644 +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -39,6 +39,7 @@ dtb-$(RPI_DT_OVERLAYS) += rpi-dac-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += rpi-display-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += rpi-ft5406-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += rpi-proto-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += rpi-sense-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += sdhost-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += spi-bcm2708-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += spi-bcm2835-overlay.dtb +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 88ed678..8792f98 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -442,6 +442,12 @@ Load: dtoverlay=rpi-proto + Params: + + ++Name: rpi-sense ++Info: Raspberry Pi Sense HAT ++Load: dtoverlay=rpi-sense ++Params: ++ ++ + Name: sdhost + Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock + Load: dtoverlay=sdhost,= +diff --git a/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts b/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts +new file mode 100644 +index 0000000..2715324 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts +@@ -0,0 +1,47 @@ ++// rpi-sense HAT ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ rpi-sense@46 { ++ compatible = "rpi,rpi-sense"; ++ reg = <0x46>; ++ keys-int-gpios = <&gpio 23 1>; ++ status = "okay"; ++ }; ++ ++ lsm9ds1-magn@1c { ++ compatible = "st,lsm9ds1-magn"; ++ reg = <0x1c>; ++ status = "okay"; ++ }; ++ ++ lsm9ds1-accel6a { ++ compatible = "st,lsm9ds1-accel"; ++ reg = <0x6a>; ++ status = "okay"; ++ }; ++ ++ lps25h-press@5c { ++ compatible = "st,lps25h-press"; ++ reg = <0x5c>; ++ status = "okay"; ++ }; ++ ++ hts221-humid@5f { ++ compatible = "st,hts221-humid"; ++ reg = <0x5f>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index d75b104..f78a483 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -533,6 +533,7 @@ CONFIG_JOYSTICK_IFORCE=m + CONFIG_JOYSTICK_IFORCE_USB=y + CONFIG_JOYSTICK_XPAD=m + CONFIG_JOYSTICK_XPAD_FF=y ++CONFIG_JOYSTICK_RPISENSE=m + CONFIG_INPUT_TOUCHSCREEN=y + CONFIG_TOUCHSCREEN_ADS7846=m + CONFIG_TOUCHSCREEN_EGALAX=m +@@ -789,6 +790,7 @@ CONFIG_VIDEO_MT9V011=m + CONFIG_FB=y + CONFIG_FB_BCM2708=y + CONFIG_FB_SSD1307=m ++CONFIG_FB_RPISENSE=m + # CONFIG_BACKLIGHT_GENERIC is not set + CONFIG_BACKLIGHT_GPIO=m + CONFIG_FRAMEBUFFER_CONSOLE=y +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 9159892..b9b5bdf 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -526,6 +526,7 @@ CONFIG_JOYSTICK_IFORCE=m + CONFIG_JOYSTICK_IFORCE_USB=y + CONFIG_JOYSTICK_XPAD=m + CONFIG_JOYSTICK_XPAD_FF=y ++CONFIG_JOYSTICK_RPISENSE=m + CONFIG_INPUT_TOUCHSCREEN=y + CONFIG_TOUCHSCREEN_ADS7846=m + CONFIG_TOUCHSCREEN_EGALAX=m +@@ -782,6 +783,7 @@ CONFIG_VIDEO_MT9V011=m + CONFIG_FB=y + CONFIG_FB_BCM2708=y + CONFIG_FB_SSD1307=m ++CONFIG_FB_RPISENSE=m + # CONFIG_BACKLIGHT_GENERIC is not set + CONFIG_BACKLIGHT_GPIO=m + CONFIG_FRAMEBUFFER_CONSOLE=y +diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig +index 56eb471..73e3a23 100644 +--- a/drivers/input/joystick/Kconfig ++++ b/drivers/input/joystick/Kconfig +@@ -329,4 +329,12 @@ config JOYSTICK_MAPLE + To compile this as a module choose M here: the module will be called + maplecontrol. + ++config JOYSTICK_RPISENSE ++ tristate "Raspberry Pi Sense HAT joystick" ++ depends on GPIOLIB && INPUT ++ select MFD_RPISENSE_CORE ++ ++ help ++ This is the joystick driver for the Raspberry Pi Sense HAT ++ + endif +diff --git a/drivers/input/joystick/Makefile b/drivers/input/joystick/Makefile +index 92dc0de..1758160 100644 +--- a/drivers/input/joystick/Makefile ++++ b/drivers/input/joystick/Makefile +@@ -32,4 +32,5 @@ obj-$(CONFIG_JOYSTICK_WARRIOR) += warrior.o + obj-$(CONFIG_JOYSTICK_XPAD) += xpad.o + obj-$(CONFIG_JOYSTICK_ZHENHUA) += zhenhua.o + obj-$(CONFIG_JOYSTICK_WALKERA0701) += walkera0701.o ++obj-$(CONFIG_JOYSTICK_RPISENSE) += rpisense-js.o + +diff --git a/drivers/input/joystick/rpisense-js.c b/drivers/input/joystick/rpisense-js.c +new file mode 100644 +index 0000000..9eca897 +--- /dev/null ++++ b/drivers/input/joystick/rpisense-js.c +@@ -0,0 +1,153 @@ ++/* ++ * Raspberry Pi Sense HAT joystick driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#include ++ ++#include ++#include ++ ++struct rpisense *rpisense; ++unsigned char keymap[5] = {KEY_DOWN, KEY_RIGHT, KEY_UP, KEY_ENTER, KEY_LEFT,}; ++ ++static void keys_work_fn(struct work_struct *work) ++{ ++ int i; ++ static s32 prev_keys; ++ struct rpisense_js *rpisense_js = &rpisense->joystick; ++ s32 keys = rpisense_reg_read(rpisense, RPISENSE_KEYS); ++ s32 changes = keys ^ prev_keys; ++ ++ prev_keys = keys; ++ for (i = 0; i < 5; i++) { ++ if (changes & 1) { ++ input_report_key(rpisense_js->keys_dev, ++ keymap[i], keys & 1); ++ } ++ changes >>= 1; ++ keys >>= 1; ++ } ++ input_sync(rpisense_js->keys_dev); ++} ++ ++static irqreturn_t keys_irq_handler(int irq, void *pdev) ++{ ++ struct rpisense_js *rpisense_js = &rpisense->joystick; ++ ++ schedule_work(&rpisense_js->keys_work_s); ++ return IRQ_HANDLED; ++} ++ ++static int rpisense_js_probe(struct platform_device *pdev) ++{ ++ int ret; ++ int i; ++ struct rpisense_js *rpisense_js; ++ ++ rpisense = rpisense_get_dev(); ++ rpisense_js = &rpisense->joystick; ++ ++ INIT_WORK(&rpisense_js->keys_work_s, keys_work_fn); ++ ++ rpisense_js->keys_dev = input_allocate_device(); ++ if (!rpisense_js->keys_dev) { ++ dev_err(&pdev->dev, "Could not allocate input device.\n"); ++ return -ENOMEM; ++ } ++ ++ rpisense_js->keys_dev->evbit[0] = BIT_MASK(EV_KEY); ++ for (i = 0; i < ARRAY_SIZE(keymap); i++) { ++ set_bit(keymap[i], ++ rpisense_js->keys_dev->keybit); ++ } ++ ++ rpisense_js->keys_dev->name = "Raspberry Pi Sense HAT Joystick"; ++ rpisense_js->keys_dev->phys = "rpi-sense-joy/input0"; ++ rpisense_js->keys_dev->id.bustype = BUS_I2C; ++ rpisense_js->keys_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); ++ rpisense_js->keys_dev->keycode = keymap; ++ rpisense_js->keys_dev->keycodesize = sizeof(unsigned char); ++ rpisense_js->keys_dev->keycodemax = ARRAY_SIZE(keymap); ++ ++ ret = input_register_device(rpisense_js->keys_dev); ++ if (ret) { ++ dev_err(&pdev->dev, "Could not register input device.\n"); ++ goto err_keys_alloc; ++ } ++ ++ ret = gpiod_direction_input(rpisense_js->keys_desc); ++ if (ret) { ++ dev_err(&pdev->dev, "Could not set keys-int direction.\n"); ++ goto err_keys_reg; ++ } ++ ++ rpisense_js->keys_irq = gpiod_to_irq(rpisense_js->keys_desc); ++ if (rpisense_js->keys_irq < 0) { ++ dev_err(&pdev->dev, "Could not determine keys-int IRQ.\n"); ++ ret = rpisense_js->keys_irq; ++ goto err_keys_reg; ++ } ++ ++ ret = devm_request_irq(&pdev->dev, rpisense_js->keys_irq, ++ keys_irq_handler, IRQF_TRIGGER_RISING, ++ "keys", &pdev->dev); ++ if (ret) { ++ dev_err(&pdev->dev, "IRQ request failed.\n"); ++ goto err_keys_reg; ++ } ++ return 0; ++err_keys_reg: ++ input_unregister_device(rpisense_js->keys_dev); ++err_keys_alloc: ++ input_free_device(rpisense_js->keys_dev); ++ return ret; ++} ++ ++static int rpisense_js_remove(struct platform_device *pdev) ++{ ++ struct rpisense_js *rpisense_js = &rpisense->joystick; ++ ++ input_unregister_device(rpisense_js->keys_dev); ++ input_free_device(rpisense_js->keys_dev); ++ return 0; ++} ++ ++#ifdef CONFIG_OF ++static const struct of_device_id rpisense_js_id[] = { ++ { .compatible = "rpi,rpi-sense-js" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, rpisense_js_id); ++#endif ++ ++static struct platform_device_id rpisense_js_device_id[] = { ++ { .name = "rpi-sense-js" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(platform, rpisense_js_device_id); ++ ++static struct platform_driver rpisense_js_driver = { ++ .probe = rpisense_js_probe, ++ .remove = rpisense_js_remove, ++ .driver = { ++ .name = "rpi-sense-js", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++module_platform_driver(rpisense_js_driver); ++ ++MODULE_DESCRIPTION("Raspberry Pi Sense HAT joystick driver"); ++MODULE_AUTHOR("Serge Schneider "); ++MODULE_LICENSE("GPL"); +diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig +index d5ad04d..dfb730e 100644 +--- a/drivers/mfd/Kconfig ++++ b/drivers/mfd/Kconfig +@@ -10,6 +10,14 @@ config MFD_CORE + select IRQ_DOMAIN + default n + ++config MFD_RPISENSE_CORE ++ tristate "Raspberry Pi Sense HAT core functions" ++ depends on I2C ++ select MFD_CORE ++ help ++ This is the core driver for the Raspberry Pi Sense HAT. This provides ++ the necessary functions to communicate with the hardware. ++ + config MFD_CS5535 + tristate "AMD CS5535 and CS5536 southbridge core functions" + select MFD_CORE +diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile +index 0e5cfeb..9c491fb 100644 +--- a/drivers/mfd/Makefile ++++ b/drivers/mfd/Makefile +@@ -185,3 +185,5 @@ obj-$(CONFIG_MFD_SKY81452) += sky81452.o + intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o + obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o + obj-$(CONFIG_MFD_MT6397) += mt6397-core.o ++ ++obj-$(CONFIG_MFD_RPISENSE_CORE) += rpisense-core.o +diff --git a/drivers/mfd/rpisense-core.c b/drivers/mfd/rpisense-core.c +new file mode 100644 +index 0000000..7539547 +--- /dev/null ++++ b/drivers/mfd/rpisense-core.c +@@ -0,0 +1,157 @@ ++/* ++ * Raspberry Pi Sense HAT core driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ * This driver is based on wm8350 implementation. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++struct rpisense *rpisense; ++ ++static void rpisense_client_dev_register(struct rpisense *rpisense, ++ const char *name, ++ struct platform_device **pdev) ++{ ++ int ret; ++ ++ *pdev = platform_device_alloc(name, -1); ++ if (*pdev == NULL) { ++ dev_err(rpisense->dev, "Failed to allocate %s\n", name); ++ return; ++ } ++ ++ (*pdev)->dev.parent = rpisense->dev; ++ platform_set_drvdata(*pdev, rpisense); ++ ret = platform_device_add(*pdev); ++ if (ret != 0) { ++ dev_err(rpisense->dev, "Failed to register %s: %d\n", ++ name, ret); ++ platform_device_put(*pdev); ++ *pdev = NULL; ++ } ++} ++ ++static int rpisense_probe(struct i2c_client *i2c, ++ const struct i2c_device_id *id) ++{ ++ int ret; ++ struct rpisense_js *rpisense_js; ++ ++ rpisense = devm_kzalloc(&i2c->dev, sizeof(struct rpisense), GFP_KERNEL); ++ if (rpisense == NULL) ++ return -ENOMEM; ++ ++ i2c_set_clientdata(i2c, rpisense); ++ rpisense->dev = &i2c->dev; ++ rpisense->i2c_client = i2c; ++ ++ ret = rpisense_reg_read(rpisense, RPISENSE_WAI); ++ if (ret > 0) { ++ if (ret != 's') ++ return -EINVAL; ++ } else { ++ return ret; ++ } ++ ret = rpisense_reg_read(rpisense, RPISENSE_VER); ++ if (ret < 0) ++ return ret; ++ ++ dev_info(rpisense->dev, ++ "Raspberry Pi Sense HAT firmware version %i\n", ret); ++ ++ rpisense_js = &rpisense->joystick; ++ rpisense_js->keys_desc = devm_gpiod_get(&i2c->dev, ++ "keys-int", GPIOD_IN); ++ if (IS_ERR(rpisense_js->keys_desc)) { ++ dev_warn(&i2c->dev, "Failed to get keys-int descriptor.\n"); ++ rpisense_js->keys_desc = gpio_to_desc(23); ++ if (rpisense_js->keys_desc == NULL) { ++ dev_err(&i2c->dev, "GPIO23 fallback failed.\n"); ++ return PTR_ERR(rpisense_js->keys_desc); ++ } ++ } ++ rpisense_client_dev_register(rpisense, "rpi-sense-js", ++ &(rpisense->joystick.pdev)); ++ rpisense_client_dev_register(rpisense, "rpi-sense-fb", ++ &(rpisense->framebuffer.pdev)); ++ ++ return 0; ++} ++ ++static int rpisense_remove(struct i2c_client *i2c) ++{ ++ struct rpisense *rpisense = i2c_get_clientdata(i2c); ++ ++ platform_device_unregister(rpisense->joystick.pdev); ++ return 0; ++} ++ ++struct rpisense *rpisense_get_dev(void) ++{ ++ return rpisense; ++} ++EXPORT_SYMBOL_GPL(rpisense_get_dev); ++ ++s32 rpisense_reg_read(struct rpisense *rpisense, int reg) ++{ ++ int ret = i2c_smbus_read_byte_data(rpisense->i2c_client, reg); ++ ++ if (ret < 0) ++ dev_err(rpisense->dev, "Read from reg %d failed\n", reg); ++ /* Due to the BCM270x I2C clock stretching bug, some values ++ * may have MSB set. Clear it to avoid incorrect values. ++ * */ ++ return ret & 0x7F; ++} ++EXPORT_SYMBOL_GPL(rpisense_reg_read); ++ ++int rpisense_block_write(struct rpisense *rpisense, const char *buf, int count) ++{ ++ int ret = i2c_master_send(rpisense->i2c_client, buf, count); ++ ++ if (ret < 0) ++ dev_err(rpisense->dev, "Block write failed\n"); ++ return ret; ++} ++EXPORT_SYMBOL_GPL(rpisense_block_write); ++ ++static const struct i2c_device_id rpisense_i2c_id[] = { ++ { "rpi-sense", 0 }, ++ { } ++}; ++MODULE_DEVICE_TABLE(i2c, rpisense_i2c_id); ++ ++ ++static struct i2c_driver rpisense_driver = { ++ .driver = { ++ .name = "rpi-sense", ++ .owner = THIS_MODULE, ++ }, ++ .probe = rpisense_probe, ++ .remove = rpisense_remove, ++ .id_table = rpisense_i2c_id, ++}; ++ ++module_i2c_driver(rpisense_driver); ++ ++MODULE_DESCRIPTION("Raspberry Pi Sense HAT core driver"); ++MODULE_AUTHOR("Serge Schneider "); ++MODULE_LICENSE("GPL"); ++ +diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig +index 42e6c3b..3444a4c 100644 +--- a/drivers/video/fbdev/Kconfig ++++ b/drivers/video/fbdev/Kconfig +@@ -2495,3 +2495,16 @@ config FB_SSD1307 + help + This driver implements support for the Solomon SSD1307 + OLED controller over I2C. ++ ++config FB_RPISENSE ++ tristate "Raspberry Pi Sense HAT framebuffer" ++ depends on FB ++ select MFD_RPISENSE_CORE ++ select FB_SYS_FOPS ++ select FB_SYS_FILLRECT ++ select FB_SYS_COPYAREA ++ select FB_SYS_IMAGEBLIT ++ select FB_DEFERRED_IO ++ ++ help ++ This is the framebuffer driver for the Raspberry Pi Sense HAT +diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile +index 57181ad..ee7568b 100644 +--- a/drivers/video/fbdev/Makefile ++++ b/drivers/video/fbdev/Makefile +@@ -150,6 +150,7 @@ obj-$(CONFIG_FB_DA8XX) += da8xx-fb.o + obj-$(CONFIG_FB_MXS) += mxsfb.o + obj-$(CONFIG_FB_SSD1307) += ssd1307fb.o + obj-$(CONFIG_FB_SIMPLE) += simplefb.o ++obj-$(CONFIG_FB_RPISENSE) += rpisense-fb.o + + # the test framebuffer is last + obj-$(CONFIG_FB_VIRTUAL) += vfb.o +diff --git a/drivers/video/fbdev/rpisense-fb.c b/drivers/video/fbdev/rpisense-fb.c +new file mode 100644 +index 0000000..99bb8ea +--- /dev/null ++++ b/drivers/video/fbdev/rpisense-fb.c +@@ -0,0 +1,235 @@ ++/* ++ * Raspberry Pi Sense HAT framebuffer driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++struct rpisense *rpisense; ++ ++struct rpisense_fb_param { ++ char __iomem *vmem; ++ u8 *vmem_work; ++ u32 vmemsize; ++ u8 gamma[32]; ++}; ++ ++static struct rpisense_fb_param rpisense_fb_param = { ++ .vmem = NULL, ++ .vmemsize = 128, ++ .gamma = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, ++ 0x02, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x07, ++ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0E, 0x0F, 0x11, ++ 0x12, 0x14, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F,}, ++}; ++ ++static struct fb_deferred_io rpisense_fb_defio; ++ ++static struct fb_fix_screeninfo rpisense_fb_fix = { ++ .id = "RPi-Sense FB", ++ .type = FB_TYPE_PACKED_PIXELS, ++ .visual = FB_VISUAL_TRUECOLOR, ++ .xpanstep = 0, ++ .ypanstep = 0, ++ .ywrapstep = 0, ++ .accel = FB_ACCEL_NONE, ++ .line_length = 16, ++}; ++ ++static struct fb_var_screeninfo rpisense_fb_var = { ++ .xres = 8, ++ .yres = 8, ++ .xres_virtual = 8, ++ .yres_virtual = 8, ++ .bits_per_pixel = 16, ++ .red = {11, 5, 0}, ++ .green = {5, 6, 0}, ++ .blue = {0, 5, 0}, ++}; ++ ++static ssize_t rpisense_fb_write(struct fb_info *info, ++ const char __user *buf, size_t count, ++ loff_t *ppos) ++{ ++ ssize_t res = fb_sys_write(info, buf, count, ppos); ++ ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++ return res; ++} ++ ++static void rpisense_fb_fillrect(struct fb_info *info, ++ const struct fb_fillrect *rect) ++{ ++ sys_fillrect(info, rect); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++} ++ ++static void rpisense_fb_copyarea(struct fb_info *info, ++ const struct fb_copyarea *area) ++{ ++ sys_copyarea(info, area); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++} ++ ++static void rpisense_fb_imageblit(struct fb_info *info, ++ const struct fb_image *image) ++{ ++ sys_imageblit(info, image); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++} ++ ++static void rpisense_fb_deferred_io(struct fb_info *info, ++ struct list_head *pagelist) ++{ ++ int i; ++ int j; ++ u8 *vmem_work = rpisense_fb_param.vmem_work; ++ u16 *mem = (u16 *)rpisense_fb_param.vmem; ++ u8 *gamma = rpisense_fb_param.gamma; ++ ++ vmem_work[0] = 0; ++ for (j = 0; j < 8; j++) { ++ for (i = 0; i < 8; i++) { ++ vmem_work[(j * 24) + i + 1] = ++ gamma[(mem[(j * 8) + i] >> 11) & 0x1F]; ++ vmem_work[(j * 24) + (i + 8) + 1] = ++ gamma[(mem[(j * 8) + i] >> 6) & 0x1F]; ++ vmem_work[(j * 24) + (i + 16) + 1] = ++ gamma[(mem[(j * 8) + i]) & 0x1F]; ++ } ++ } ++ rpisense_block_write(rpisense, vmem_work, 193); ++} ++ ++static struct fb_deferred_io rpisense_fb_defio = { ++ .delay = HZ/100, ++ .deferred_io = rpisense_fb_deferred_io, ++}; ++ ++static struct fb_ops rpisense_fb_ops = { ++ .owner = THIS_MODULE, ++ .fb_read = fb_sys_read, ++ .fb_write = rpisense_fb_write, ++ .fb_fillrect = rpisense_fb_fillrect, ++ .fb_copyarea = rpisense_fb_copyarea, ++ .fb_imageblit = rpisense_fb_imageblit, ++}; ++ ++static int rpisense_fb_probe(struct platform_device *pdev) ++{ ++ struct fb_info *info; ++ int ret = -ENOMEM; ++ struct rpisense_fb *rpisense_fb; ++ ++ rpisense = rpisense_get_dev(); ++ rpisense_fb = &rpisense->framebuffer; ++ ++ rpisense_fb_param.vmem = vzalloc(rpisense_fb_param.vmemsize); ++ if (!rpisense_fb_param.vmem) ++ return ret; ++ ++ rpisense_fb_param.vmem_work = devm_kmalloc(&pdev->dev, 193, GFP_KERNEL); ++ if (!rpisense_fb_param.vmem_work) ++ goto err_malloc; ++ ++ info = framebuffer_alloc(0, &pdev->dev); ++ if (!info) { ++ dev_err(&pdev->dev, "Could not allocate framebuffer.\n"); ++ goto err_malloc; ++ } ++ rpisense_fb->info = info; ++ ++ rpisense_fb_fix.smem_start = (unsigned long)rpisense_fb_param.vmem; ++ rpisense_fb_fix.smem_len = rpisense_fb_param.vmemsize; ++ ++ info->fbops = &rpisense_fb_ops; ++ info->fix = rpisense_fb_fix; ++ info->var = rpisense_fb_var; ++ info->fbdefio = &rpisense_fb_defio; ++ info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB; ++ info->screen_base = rpisense_fb_param.vmem; ++ info->screen_size = rpisense_fb_param.vmemsize; ++ ++ fb_deferred_io_init(info); ++ ++ ret = register_framebuffer(info); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "Could not register framebuffer.\n"); ++ goto err_fballoc; ++ } ++ ++ fb_info(info, "%s frame buffer device\n", info->fix.id); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++ return 0; ++err_fballoc: ++ framebuffer_release(info); ++err_malloc: ++ vfree(rpisense_fb_param.vmem); ++ return ret; ++} ++ ++static int rpisense_fb_remove(struct platform_device *pdev) ++{ ++ struct rpisense_fb *rpisense_fb = &rpisense->framebuffer; ++ struct fb_info *info = rpisense_fb->info; ++ ++ if (info) { ++ unregister_framebuffer(info); ++ fb_deferred_io_cleanup(info); ++ framebuffer_release(info); ++ vfree(rpisense_fb_param.vmem); ++ } ++ ++ return 0; ++} ++ ++#ifdef CONFIG_OF ++static const struct of_device_id rpisense_fb_id[] = { ++ { .compatible = "rpi,rpi-sense-fb" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, rpisense_fb_id); ++#endif ++ ++static struct platform_device_id rpisense_fb_device_id[] = { ++ { .name = "rpi-sense-fb" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(platform, rpisense_fb_device_id); ++ ++static struct platform_driver rpisense_fb_driver = { ++ .probe = rpisense_fb_probe, ++ .remove = rpisense_fb_remove, ++ .driver = { ++ .name = "rpi-sense-fb", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++module_platform_driver(rpisense_fb_driver); ++ ++MODULE_DESCRIPTION("Raspberry Pi Sense HAT framebuffer driver"); ++MODULE_AUTHOR("Serge Schneider "); ++MODULE_LICENSE("GPL"); ++ +diff --git a/include/linux/mfd/rpisense/core.h b/include/linux/mfd/rpisense/core.h +new file mode 100644 +index 0000000..4856aa3 +--- /dev/null ++++ b/include/linux/mfd/rpisense/core.h +@@ -0,0 +1,47 @@ ++/* ++ * Raspberry Pi Sense HAT core driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#ifndef __LINUX_MFD_RPISENSE_CORE_H_ ++#define __LINUX_MFD_RPISENSE_CORE_H_ ++ ++#include ++#include ++ ++/* ++ * Register values. ++ */ ++#define RPISENSE_FB 0x00 ++#define RPISENSE_WAI 0xF0 ++#define RPISENSE_VER 0xF1 ++#define RPISENSE_KEYS 0xF2 ++#define RPISENSE_EE_WP 0xF3 ++ ++#define RPISENSE_ID 's' ++ ++struct rpisense { ++ struct device *dev; ++ struct i2c_client *i2c_client; ++ ++ /* Client devices */ ++ struct rpisense_js joystick; ++ struct rpisense_fb framebuffer; ++}; ++ ++struct rpisense *rpisense_get_dev(void); ++s32 rpisense_reg_read(struct rpisense *rpisense, int reg); ++int rpisense_reg_write(struct rpisense *rpisense, int reg, u16 val); ++int rpisense_block_write(struct rpisense *rpisense, const char *buf, int count); ++ ++#endif +diff --git a/include/linux/mfd/rpisense/framebuffer.h b/include/linux/mfd/rpisense/framebuffer.h +new file mode 100644 +index 0000000..c4c1118 +--- /dev/null ++++ b/include/linux/mfd/rpisense/framebuffer.h +@@ -0,0 +1,28 @@ ++/* ++ * Raspberry Pi Sense HAT framebuffer driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#ifndef __LINUX_RPISENSE_FB_H_ ++#define __LINUX_RPISENSE_FB_H_ ++ ++#include ++ ++struct rpisense; ++ ++struct rpisense_fb { ++ struct platform_device *pdev; ++ struct fb_info *info; ++}; ++ ++#endif +diff --git a/include/linux/mfd/rpisense/joystick.h b/include/linux/mfd/rpisense/joystick.h +new file mode 100644 +index 0000000..56196dc +--- /dev/null ++++ b/include/linux/mfd/rpisense/joystick.h +@@ -0,0 +1,35 @@ ++/* ++ * Raspberry Pi Sense HAT joystick driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ */ ++ ++#ifndef __LINUX_RPISENSE_JOYSTICK_H_ ++#define __LINUX_RPISENSE_JOYSTICK_H_ ++ ++#include ++#include ++#include ++#include ++ ++struct rpisense; ++ ++struct rpisense_js { ++ struct platform_device *pdev; ++ struct input_dev *keys_dev; ++ struct gpio_desc *keys_desc; ++ struct work_struct keys_work_s; ++ int keys_irq; ++}; ++ ++ ++#endif + +From 2dce729ff88f1ae4fc318dc36e16732c8f152469 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 15 Jul 2015 13:46:08 +0100 +Subject: [PATCH 123/149] leds-gpio: Implement the brightness_get method + +The power LED uses some clever logic that means it is driven +by a voltage measuring circuit when configured as input, otherwise +it is driven by the GPIO output value. This patch wires up the +brightness_get method for leds-gpio so that user-space can monitor +the LED value via /sys/class/gpio/led1/brightness. Using the input +trigger this returns an indication of the system power health, +otherwise it is just whatever value the trigger has written most +recently. + +See: https://github.com/raspberrypi/linux/issues/1064 +--- + drivers/leds/leds-gpio.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c +index 3cfbd6a..4e4e132 100644 +--- a/drivers/leds/leds-gpio.c ++++ b/drivers/leds/leds-gpio.c +@@ -82,6 +82,13 @@ static void gpio_led_set(struct led_classdev *led_cdev, + } + } + ++static enum led_brightness gpio_led_get(struct led_classdev *led_cdev) ++{ ++ struct gpio_led_data *led_dat = ++ container_of(led_cdev, struct gpio_led_data, cdev); ++ return gpiod_get_value_cansleep(led_dat->gpiod) ? LED_FULL : LED_OFF; ++} ++ + static int gpio_blink_set(struct led_classdev *led_cdev, + unsigned long *delay_on, unsigned long *delay_off) + { +@@ -138,6 +145,7 @@ static int create_gpio_led(const struct gpio_led *template, + led_dat->cdev.blink_set = gpio_blink_set; + } + led_dat->cdev.brightness_set = gpio_led_set; ++ led_dat->cdev.brightness_get = gpio_led_get; + if (template->default_state == LEDS_GPIO_DEFSTATE_KEEP) + state = !!gpiod_get_value_cansleep(led_dat->gpiod); + else + +From 45d1edd1051ba8c3dcff92c18b0d56adea55ab5c Mon Sep 17 00:00:00 2001 +From: Robert Tiemann +Date: Fri, 17 Jul 2015 09:50:55 +0200 +Subject: [PATCH 124/149] dmaengine: bcm2708-dmaengine: Fix memory leak when + stopping a running transfer + +--- + drivers/dma/bcm2708-dmaengine.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/dma/bcm2708-dmaengine.c b/drivers/dma/bcm2708-dmaengine.c +index 987ed53..73c6c00 100644 +--- a/drivers/dma/bcm2708-dmaengine.c ++++ b/drivers/dma/bcm2708-dmaengine.c +@@ -964,6 +964,7 @@ static int bcm2835_dma_terminate_all(struct dma_chan *chan) + * c->desc is NULL and exit.) + */ + if (c->desc) { ++ bcm2835_dma_desc_free(&c->desc->vd); + c->desc = NULL; + bcm2835_dma_abort(c->chan_base); + + +From 5f40c5575ed6f7831637415de4e99400f270dd22 Mon Sep 17 00:00:00 2001 +From: Robert Tiemann +Date: Mon, 20 Jul 2015 11:01:13 +0200 +Subject: [PATCH 125/149] BCM270X_DT: Fix I2S register map + +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index 2dd25f7..728e14a 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -117,8 +117,8 @@ + + i2s: i2s@7e203000 { + compatible = "brcm,bcm2708-i2s"; +- reg = <0x7e203000 0x20>, +- <0x7e101098 0x02>; ++ reg = <0x7e203000 0x24>, ++ <0x7e101098 0x08>; + + //dmas = <&dma 2>, + // <&dma 3>; + +From cc5fa860bef4a444edca29c4493da61837e1b7e7 Mon Sep 17 00:00:00 2001 +From: Robert Tiemann +Date: Mon, 20 Jul 2015 11:01:25 +0200 +Subject: [PATCH 126/149] BCM2835_DT: Fix I2S register map + +--- + Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt | 4 ++-- + Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt | 4 ++-- + arch/arm/boot/dts/bcm2835.dtsi | 4 ++-- + 3 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt b/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt +index 1396078..2db8294 100644 +--- a/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt ++++ b/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt +@@ -48,8 +48,8 @@ Example: + + bcm2835_i2s: i2s@7e203000 { + compatible = "brcm,bcm2835-i2s"; +- reg = < 0x7e203000 0x20>, +- < 0x7e101098 0x02>; ++ reg = < 0x7e203000 0x24>, ++ < 0x7e101098 0x08>; + + dmas = <&dma 2>, + <&dma 3>; +diff --git a/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt b/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt +index 65783de..a89fe42 100644 +--- a/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt ++++ b/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt +@@ -16,8 +16,8 @@ Example: + + bcm2835_i2s: i2s@7e203000 { + compatible = "brcm,bcm2835-i2s"; +- reg = <0x7e203000 0x20>, +- <0x7e101098 0x02>; ++ reg = <0x7e203000 0x24>, ++ <0x7e101098 0x08>; + + dmas = <&dma 2>, + <&dma 3>; +diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi +index 4a63704..1135120 100644 +--- a/arch/arm/boot/dts/bcm2835.dtsi ++++ b/arch/arm/boot/dts/bcm2835.dtsi +@@ -101,8 +101,8 @@ + + i2s: i2s@7e203000 { + compatible = "brcm,bcm2835-i2s"; +- reg = <0x7e203000 0x20>, +- <0x7e101098 0x02>; ++ reg = <0x7e203000 0x24>, ++ <0x7e101098 0x08>; + + dmas = <&dma 2>, + <&dma 3>; + +From 0480e8bf45e8c4fd614ce16c1f3091d85ce95576 Mon Sep 17 00:00:00 2001 +From: David Frey +Date: Tue, 14 Jul 2015 15:57:36 +0200 +Subject: [PATCH 127/149] config: Enable SHT drivers for raspberry pi + +The SHT temperature and humidity sensors are often used in weather +station projects. + +Signed-off-by: David Frey +--- + arch/arm/configs/bcm2709_defconfig | 4 +++- + arch/arm/configs/bcmrpi_defconfig | 4 +++- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index f78a483..dd00e7c 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -611,7 +611,9 @@ CONFIG_W1_SLAVE_BQ27000=m + CONFIG_BATTERY_DS2760=m + CONFIG_POWER_RESET=y + CONFIG_POWER_RESET_GPIO=y +-# CONFIG_HWMON is not set ++CONFIG_HWMON=m ++CONFIG_SENSORS_SHT21=m ++CONFIG_SENSORS_SHTC1=m + CONFIG_THERMAL=y + CONFIG_THERMAL_BCM2835=y + CONFIG_WATCHDOG=y +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index b9b5bdf..7b24274 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -604,7 +604,9 @@ CONFIG_W1_SLAVE_BQ27000=m + CONFIG_BATTERY_DS2760=m + CONFIG_POWER_RESET=y + CONFIG_POWER_RESET_GPIO=y +-# CONFIG_HWMON is not set ++CONFIG_HWMON=m ++CONFIG_SENSORS_SHT21=m ++CONFIG_SENSORS_SHTC1=m + CONFIG_THERMAL=y + CONFIG_THERMAL_BCM2835=y + CONFIG_WATCHDOG=y + +From a433727025805fd09e50b829738fc02b99446617 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 20 Jul 2015 14:07:14 +0100 +Subject: [PATCH 128/149] BCM270X_DT: Correct typo in overlays/README + +--- + arch/arm/boot/dts/overlays/README | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 8792f98..ed484ae 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -78,7 +78,7 @@ Name: + Info: Configures the base Raspberry Pi hardware + Load: + Params: +- audio Set to "on" to disable the onboard ALSA audio ++ audio Set to "on" to enable the onboard ALSA audio + interface (default "off") + + i2c_arm Set to "on" to enable the ARM's i2c interface + +From 26be449bd477753ba005248dfde121a9e4c16a39 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 20 Jul 2015 10:53:26 +0100 +Subject: [PATCH 129/149] bcm2835-sdhost: Add the ERASE capability + +See: https://github.com/raspberrypi/linux/issues/1076 +--- + drivers/mmc/host/bcm2835-sdhost.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c +index d65870a..57a6ad3 100644 +--- a/drivers/mmc/host/bcm2835-sdhost.c ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -1675,7 +1675,7 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) + /* host controller capabilities */ + mmc->caps |= /* MMC_CAP_SDIO_IRQ |*/ MMC_CAP_4_BIT_DATA | + MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED | +- MMC_CAP_NEEDS_POLL | MMC_CAP_HW_RESET | ++ MMC_CAP_NEEDS_POLL | MMC_CAP_HW_RESET | MMC_CAP_ERASE | + (ALLOW_CMD23 * MMC_CAP_CMD23); + + spin_lock_init(&host->lock); + +From 02c4ebf0f3e2f379496ce265f883e23a0b7be363 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 20 Jul 2015 17:32:18 +0100 +Subject: [PATCH 130/149] bcm2835-sdhost: Ignore CRC7 for MMC CMD1 + +It seems that the sdhost interface returns CRC7 errors for CMD1, +which is the MMC-specific SEND_OP_COND. Returning these errors to +the MMC layer causes a downward spiral, but ignoring them seems +to be harmless. +--- + drivers/mmc/host/bcm2835-sdhost.c | 39 +++++++++++++++++++++++---------------- + 1 file changed, 23 insertions(+), 16 deletions(-) + +diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c +index 57a6ad3..84f645f 100644 +--- a/drivers/mmc/host/bcm2835-sdhost.c ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -959,25 +959,32 @@ static void bcm2835_sdhost_finish_command(struct bcm2835_host *host) + mmc_hostname(host->mmc), sdcmd, sdhsts, + bcm2835_sdhost_read(host, SDEDM)); + +- if (sdhsts & SDHSTS_CMD_TIME_OUT) { +- switch (host->cmd->opcode) { +- case 5: case 52: case 53: +- /* Don't warn about SDIO commands */ +- break; +- default: +- pr_err("%s: command timeout\n", ++ if ((sdhsts & SDHSTS_CRC7_ERROR) && ++ (host->cmd->opcode == 1)) { ++ if (host->debug) ++ pr_info("%s: ignoring CRC7 error for CMD1\n", ++ mmc_hostname(host->mmc)); ++ } else { ++ if (sdhsts & SDHSTS_CMD_TIME_OUT) { ++ switch (host->cmd->opcode) { ++ case 5: case 52: case 53: ++ /* Don't warn about SDIO commands */ ++ break; ++ default: ++ pr_err("%s: command timeout\n", ++ mmc_hostname(host->mmc)); ++ break; ++ } ++ host->cmd->error = -ETIMEDOUT; ++ } else { ++ pr_err("%s: unexpected command error\n", + mmc_hostname(host->mmc)); +- break; ++ bcm2835_sdhost_dumpregs(host); ++ host->cmd->error = -EIO; + } +- host->cmd->error = -ETIMEDOUT; +- } else { +- pr_err("%s: unexpected command error\n", +- mmc_hostname(host->mmc)); +- bcm2835_sdhost_dumpregs(host); +- host->cmd->error = -EIO; ++ tasklet_schedule(&host->finish_tasklet); ++ return; + } +- tasklet_schedule(&host->finish_tasklet); +- return; + } + + if (host->cmd->flags & MMC_RSP_PRESENT) { + +From 995b4ff06b418b3dbc8d560547c95d8e9e501c0c Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 20 Jul 2015 14:48:21 +0100 +Subject: [PATCH 131/149] BCM270X_DT: Add unit address to gpio node name + +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index 728e14a..cb608df 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -92,7 +92,7 @@ + status = "disabled"; + }; + +- gpio: gpio { ++ gpio: gpio@7e200000 { + compatible = "brcm,bcm2835-gpio"; + reg = <0x7e200000 0xb4>; + interrupts = <2 17>, <2 18>; + +From 56bc2c9c4ef10c7dc0b0ed9bf1868e2010e4adb6 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 24 Jul 2015 10:36:32 +0100 +Subject: [PATCH 132/149] BCM270X_DT: Use i2c_arm for rtc and bmp085 overlays + +--- + arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts | 2 +- + arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts b/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts +index b830bf2..782b171 100644 +--- a/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts ++++ b/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts +@@ -6,7 +6,7 @@ + compatible = "brcm,bcm2708"; + + fragment@0 { +- target = <&i2c1>; ++ target = <&i2c_arm>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; +diff --git a/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts +index 7052c71..fed4bd8 100644 +--- a/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts ++++ b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts +@@ -6,7 +6,7 @@ + compatible = "brcm,bcm2708"; + + fragment@0 { +- target = <&i2c1>; ++ target = <&i2c_arm>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + +From a3201af81c47ab3cf0ca61d3632a6df14e935b23 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 24 Jul 2015 12:11:31 +0100 +Subject: [PATCH 133/149] BCM2708_DT: CM dtparams for audio, watchdog and RNG + +--- + arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +index 34d4bc6..713e5a2 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +@@ -17,14 +17,14 @@ + status = "okay"; + }; + +-&audio { +- status = "okay"; +-}; +- + / { + __overrides__ { + act_led_gpio = <&act_led>,"gpios:4"; + act_led_activelow = <&act_led>,"gpios:8"; + act_led_trigger = <&act_led>,"linux,default-trigger"; ++ ++ audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; + }; + }; + +From 30929ea53242c1f5efc06caf4a17b9c7922fd437 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Mon, 20 Jul 2015 12:13:18 +0200 +Subject: [PATCH 134/149] vchiq: Use firmware API +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Use the new firmware API instead of the legacy mailbox API. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 1 + + .../vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 17 +++++++++-------- + .../misc/vc04_services/interface/vchiq_arm/vchiq_arm.c | 17 +++++++++++++++++ + 3 files changed, 27 insertions(+), 8 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index cb608df..df66e64 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -225,6 +225,7 @@ + reg = <0x7e00b840 0xf>; + interrupts = <0 2>; + cache-line-size = <32>; ++ firmware = <&firmware>; + }; + + thermal: thermal { +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +index 56bff05..c9febcc 100644 +--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +@@ -39,11 +39,11 @@ + #include + #include + #include +-#include + #include + #include + #include + #include ++#include + + #define TOTAL_SLOTS (VCHIQ_SLOT_ZERO_SLOTS + 2 * 32) + +@@ -89,10 +89,12 @@ free_pagelist(PAGELIST_T *pagelist, int actual); + int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) + { + struct device *dev = &pdev->dev; ++ struct rpi_firmware *fw = platform_get_drvdata(pdev); + VCHIQ_SLOT_ZERO_T *vchiq_slot_zero; + struct resource *res; + void *slot_mem; + dma_addr_t slot_phys; ++ u32 channelbase; + int slot_mem_size, frag_mem_size; + int err, irq, i; + +@@ -157,13 +159,12 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) + } + + /* Send the base address of the slots to VideoCore */ +- +- dsb(); /* Ensure all writes have completed */ +- +- err = bcm_mailbox_write(MBOX_CHAN_VCHIQ, (unsigned int)slot_phys); +- if (err) { +- dev_err(dev, "mailbox write failed\n"); +- return err; ++ channelbase = slot_phys; ++ err = rpi_firmware_property(fw, RPI_FIRMWARE_VCHIQ_INIT, ++ &channelbase, sizeof(channelbase)); ++ if (err || channelbase) { ++ dev_err(dev, "failed to set channelbase\n"); ++ return err ? : -ENXIO; + } + + vchiq_log_info(vchiq_arm_log_level, +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c +index 31e2cba..e11c0e0 100644 +--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c +@@ -45,7 +45,9 @@ + #include + #include + #include ++#include + #include ++#include + + #include "vchiq_core.h" + #include "vchiq_ioctl.h" +@@ -2793,9 +2795,24 @@ void vchiq_platform_conn_state_changed(VCHIQ_STATE_T *state, + + static int vchiq_probe(struct platform_device *pdev) + { ++ struct device_node *fw_node; ++ struct rpi_firmware *fw; + int err; + void *ptr_err; + ++ fw_node = of_parse_phandle(pdev->dev.of_node, "firmware", 0); ++/* Remove comment when booting without Device Tree is no longer supported ++ if (!fw_node) { ++ dev_err(&pdev->dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } ++*/ ++ fw = rpi_firmware_get(fw_node); ++ if (!fw) ++ return -EPROBE_DEFER; ++ ++ platform_set_drvdata(pdev, fw); ++ + /* create debugfs entries */ + err = vchiq_debugfs_init(); + if (err != 0) + +From 978ebf9c4c2ef238e19ea1478b5fd11c3252c912 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Mon, 20 Jul 2015 12:17:10 +0200 +Subject: [PATCH 135/149] thermal: bcm2835: Use firmware API +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Use the new firmware API instead of the legacy mailbox API. +Remove retry loop on failure to read temperature. +Clean up code. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 1 + + drivers/thermal/bcm2835-thermal.c | 197 +++++++++++++--------------------- + 2 files changed, 75 insertions(+), 123 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index df66e64..bd8ac0a 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -230,6 +230,7 @@ + + thermal: thermal { + compatible = "brcm,bcm2835-thermal"; ++ firmware = <&firmware>; + }; + }; + +diff --git a/drivers/thermal/bcm2835-thermal.c b/drivers/thermal/bcm2835-thermal.c +index 3bc80f1..c1d8f1b 100644 +--- a/drivers/thermal/bcm2835-thermal.c ++++ b/drivers/thermal/bcm2835-thermal.c +@@ -12,161 +12,113 @@ + * consent. + *****************************************************************************/ + +-#include + #include +-#include +-#include + #include +-#include +-#include + #include ++#include + +- +-/* --- DEFINITIONS --- */ +-#define MODULE_NAME "bcm2835_thermal" +- +-/*#define THERMAL_DEBUG_ENABLE*/ +- +-#ifdef THERMAL_DEBUG_ENABLE +-#define print_debug(fmt,...) printk(KERN_INFO "%s:%s:%d: "fmt"\n", MODULE_NAME, __func__, __LINE__, ##__VA_ARGS__) +-#else +-#define print_debug(fmt,...) +-#endif +-#define print_err(fmt,...) printk(KERN_ERR "%s:%s:%d: "fmt"\n", MODULE_NAME, __func__,__LINE__, ##__VA_ARGS__) +- +-#define VC_TAG_GET_TEMP 0x00030006 +-#define VC_TAG_GET_MAX_TEMP 0x0003000A +- +-typedef enum { +- TEMP, +- MAX_TEMP, +-} temp_type; +- +-/* --- STRUCTS --- */ +-/* tag part of the message */ +-struct vc_msg_tag { +- uint32_t tag_id; /* the tag ID for the temperature */ +- uint32_t buffer_size; /* size of the buffer (should be 8) */ +- uint32_t request_code; /* identifies message as a request (should be 0) */ +- uint32_t id; /* extra ID field (should be 0) */ +- uint32_t val; /* returned value of the temperature */ +-}; +- +-/* message structure to be sent to videocore */ +-struct vc_msg { +- uint32_t msg_size; /* simply, sizeof(struct vc_msg) */ +- uint32_t request_code; /* holds various information like the success and number of bytes returned (refer to mailboxes wiki) */ +- struct vc_msg_tag tag; /* the tag structure above to make */ +- uint32_t end_tag; /* an end identifier, should be set to NULL */ +-}; +- +-struct bcm2835_thermal_data { +- struct thermal_zone_device *thermal_dev; +- struct vc_msg msg; +-}; +- +-/* --- GLOBALS --- */ +-static struct bcm2835_thermal_data bcm2835_data; +- +-/* Thermal Device Operations */ +-static struct thermal_zone_device_ops ops; +- +-/* --- FUNCTIONS --- */ +- +-static int bcm2835_get_temp_or_max(struct thermal_zone_device *thermal_dev, unsigned long *temp, unsigned tag_id) ++static int bcm2835_thermal_get_property(struct thermal_zone_device *tz, ++ unsigned long *temp, u32 tag) + { +- int result = -1, retry = 3; +- print_debug("IN"); ++ struct rpi_firmware *fw = tz->devdata; ++ struct { ++ u32 id; ++ u32 val; ++ } packet; ++ int ret; + + *temp = 0; +- while (result != 0 && retry-- > 0) { +- /* wipe all previous message data */ +- memset(&bcm2835_data.msg, 0, sizeof bcm2835_data.msg); +- +- /* prepare message */ +- bcm2835_data.msg.msg_size = sizeof bcm2835_data.msg; +- bcm2835_data.msg.tag.buffer_size = 8; +- bcm2835_data.msg.tag.tag_id = tag_id; +- +- /* send the message */ +- result = bcm_mailbox_property(&bcm2835_data.msg, sizeof bcm2835_data.msg); +- print_debug("Got %stemperature as %u (%d,%x)\n", tag_id==VC_TAG_GET_MAX_TEMP ? "max ":"", (uint)bcm2835_data.msg.tag.val, result, bcm2835_data.msg.request_code); +- if (!(bcm2835_data.msg.request_code & 0x80000000)) +- result = -1; ++ packet.id = 0; ++ ret = rpi_firmware_property(fw, tag, &packet, sizeof(packet)); ++ if (ret) { ++ dev_err(&tz->device, "Failed to get temperature\n"); ++ return ret; + } + +- /* check if it was all ok and return the rate in milli degrees C */ +- if (result == 0) +- *temp = (uint)bcm2835_data.msg.tag.val; +- else +- print_err("Failed to get temperature! (%x:%d)\n", tag_id, result); +- print_debug("OUT"); +- return result; ++ *temp = packet.val; ++ dev_dbg(&tz->device, "%stemp=%lu\n", ++ tag == RPI_FIRMWARE_GET_MAX_TEMPERATURE ? "max" : "", *temp); ++ ++ return 0; + } + +-static int bcm2835_get_temp(struct thermal_zone_device *thermal_dev, unsigned long *temp) ++static int bcm2835_thermal_get_temp(struct thermal_zone_device *tz, ++ unsigned long *temp) + { +- return bcm2835_get_temp_or_max(thermal_dev, temp, VC_TAG_GET_TEMP); ++ return bcm2835_thermal_get_property(tz, temp, ++ RPI_FIRMWARE_GET_TEMPERATURE); + } + +-static int bcm2835_get_max_temp(struct thermal_zone_device *thermal_dev, int trip_num, unsigned long *temp) ++static int bcm2835_thermal_get_max_temp(struct thermal_zone_device *tz, ++ int trip, unsigned long *temp) + { +- return bcm2835_get_temp_or_max(thermal_dev, temp, VC_TAG_GET_MAX_TEMP); ++ /* ++ * The maximum safe temperature of the SoC. ++ * Overclock may be disabled above this temperature. ++ */ ++ return bcm2835_thermal_get_property(tz, temp, ++ RPI_FIRMWARE_GET_MAX_TEMPERATURE); + } + +-static int bcm2835_get_trip_type(struct thermal_zone_device * thermal_dev, int trip_num, enum thermal_trip_type *trip_type) ++static int bcm2835_thermal_get_trip_type(struct thermal_zone_device *tz, ++ int trip, enum thermal_trip_type *type) + { +- *trip_type = THERMAL_TRIP_HOT; ++ *type = THERMAL_TRIP_HOT; ++ + return 0; + } + +- +-static int bcm2835_get_mode(struct thermal_zone_device *thermal_dev, enum thermal_device_mode *dev_mode) ++static int bcm2835_thermal_get_mode(struct thermal_zone_device *tz, ++ enum thermal_device_mode *mode) + { +- *dev_mode = THERMAL_DEVICE_ENABLED; ++ *mode = THERMAL_DEVICE_ENABLED; ++ + return 0; + } + ++static struct thermal_zone_device_ops ops = { ++ .get_temp = bcm2835_thermal_get_temp, ++ .get_trip_temp = bcm2835_thermal_get_max_temp, ++ .get_trip_type = bcm2835_thermal_get_trip_type, ++ .get_mode = bcm2835_thermal_get_mode, ++}; + + static int bcm2835_thermal_probe(struct platform_device *pdev) + { +- print_debug("IN"); +- print_debug("THERMAL Driver has been probed!"); +- +- /* check that the device isn't null!*/ +- if(pdev == NULL) +- { +- print_debug("Platform device is empty!"); +- return -ENODEV; ++ struct device_node *fw_np; ++ struct rpi_firmware *fw; ++ struct thermal_zone_device *tz; ++ ++ fw_np = of_parse_phandle(pdev->dev.of_node, "firmware", 0); ++/* Remove comment when booting without Device Tree is no longer supported ++ if (!fw_np) { ++ dev_err(&pdev->dev, "Missing firmware node\n"); ++ return -ENOENT; + } +- +- if(!(bcm2835_data.thermal_dev = thermal_zone_device_register("bcm2835_thermal", 1, 0, NULL, &ops, NULL, 0, 0))) +- { +- print_debug("Unable to register the thermal device!"); +- return -EFAULT; ++*/ ++ fw = rpi_firmware_get(fw_np); ++ if (!fw) ++ return -EPROBE_DEFER; ++ ++ tz = thermal_zone_device_register("bcm2835_thermal", 1, 0, fw, &ops, ++ NULL, 0, 0); ++ if (IS_ERR(tz)) { ++ dev_err(&pdev->dev, "Failed to register the thermal device\n"); ++ return PTR_ERR(tz); + } ++ ++ platform_set_drvdata(pdev, tz); ++ + return 0; + } + +- + static int bcm2835_thermal_remove(struct platform_device *pdev) + { +- print_debug("IN"); +- +- thermal_zone_device_unregister(bcm2835_data.thermal_dev); +- +- print_debug("OUT"); ++ thermal_zone_device_unregister(platform_get_drvdata(pdev)); + + return 0; + } + +-static struct thermal_zone_device_ops ops = { +- .get_temp = bcm2835_get_temp, +- .get_trip_temp = bcm2835_get_max_temp, +- .get_trip_type = bcm2835_get_trip_type, +- .get_mode = bcm2835_get_mode, +-}; +- + static const struct of_device_id bcm2835_thermal_of_match_table[] = { + { .compatible = "brcm,bcm2835-thermal", }, + {}, +@@ -177,14 +129,13 @@ static struct platform_driver bcm2835_thermal_driver = { + .probe = bcm2835_thermal_probe, + .remove = bcm2835_thermal_remove, + .driver = { +- .name = "bcm2835_thermal", +- .owner = THIS_MODULE, +- .of_match_table = bcm2835_thermal_of_match_table, +- }, ++ .name = "bcm2835_thermal", ++ .of_match_table = bcm2835_thermal_of_match_table, ++ }, + }; ++module_platform_driver(bcm2835_thermal_driver); + +-MODULE_LICENSE("GPL"); + MODULE_AUTHOR("Dorian Peake"); ++MODULE_AUTHOR("Noralf Trønnes"); + MODULE_DESCRIPTION("Thermal driver for bcm2835 chip"); +- +-module_platform_driver(bcm2835_thermal_driver); ++MODULE_LICENSE("GPL"); + +From 26b1f0b224f9e59fc87d02e8d0a683a3ca847356 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Mon, 20 Jul 2015 12:18:36 +0200 +Subject: [PATCH 136/149] cpufreq: bcm2835: Use firmware API +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Use the new firmware API instead of the legacy mailbox API. + +Signed-off-by: Noralf Trønnes +--- + drivers/cpufreq/bcm2835-cpufreq.c | 117 +++++++++++++++++--------------------- + 1 file changed, 53 insertions(+), 64 deletions(-) + +diff --git a/drivers/cpufreq/bcm2835-cpufreq.c b/drivers/cpufreq/bcm2835-cpufreq.c +index 6735da9..3eb9e93 100644 +--- a/drivers/cpufreq/bcm2835-cpufreq.c ++++ b/drivers/cpufreq/bcm2835-cpufreq.c +@@ -26,7 +26,7 @@ + #include + #include + #include +-#include ++#include + + /* ---------- DEFINES ---------- */ + /*#define CPUFREQ_DEBUG_ENABLE*/ /* enable debugging */ +@@ -43,23 +43,6 @@ + #define print_err(fmt,...) pr_err("%s:%s:%d: "fmt, MODULE_NAME, __func__,__LINE__, ##__VA_ARGS__) + #define print_info(fmt,...) pr_info("%s: "fmt, MODULE_NAME, ##__VA_ARGS__) + +-/* tag part of the message */ +-struct vc_msg_tag { +- uint32_t tag_id; /* the message id */ +- uint32_t buffer_size; /* size of the buffer (which in this case is always 8 bytes) */ +- uint32_t data_size; /* amount of data being sent or received */ +- uint32_t dev_id; /* the ID of the clock/voltage to get or set */ +- uint32_t val; /* the value (e.g. rate (in Hz)) to set */ +-}; +- +-/* message structure to be sent to videocore */ +-struct vc_msg { +- uint32_t msg_size; /* simply, sizeof(struct vc_msg) */ +- uint32_t request_code; /* holds various information like the success and number of bytes returned (refer to mailboxes wiki) */ +- struct vc_msg_tag tag; /* the tag structure above to make */ +- uint32_t end_tag; /* an end identifier, should be set to NULL */ +-}; +- + /* ---------- GLOBALS ---------- */ + static struct cpufreq_driver bcm2835_cpufreq_driver; /* the cpufreq driver global */ + +@@ -74,62 +57,63 @@ static struct cpufreq_frequency_table bcm2835_freq_table[] = { + clk_rate either gets or sets the clock rates. + =============================================== + */ +-static uint32_t bcm2835_cpufreq_set_clock(int cur_rate, int arm_rate) ++ ++static int bcm2835_cpufreq_clock_property(u32 tag, u32 id, u32 *val) + { +- int s, actual_rate=0; +- struct vc_msg msg; ++ struct rpi_firmware *fw = rpi_firmware_get(NULL); ++ struct { ++ u32 id; ++ u32 val; ++ } packet; ++ int ret; ++ ++ packet.id = id; ++ packet.val = *val; ++ ret = rpi_firmware_property(fw, tag, &packet, sizeof(packet)); ++ if (ret) ++ return ret; + +- /* wipe all previous message data */ +- memset(&msg, 0, sizeof msg); ++ *val = packet.val; + +- msg.msg_size = sizeof msg; ++ return 0; ++} + +- msg.tag.tag_id = VCMSG_SET_CLOCK_RATE; +- msg.tag.buffer_size = 8; +- msg.tag.data_size = 8; /* we're sending the clock ID and the new rates which is a total of 2 words */ +- msg.tag.dev_id = VCMSG_ID_ARM_CLOCK; +- msg.tag.val = arm_rate * 1000; ++static uint32_t bcm2835_cpufreq_set_clock(int cur_rate, int arm_rate) ++{ ++ u32 rate = arm_rate * 1000; ++ int ret; + +- /* send the message */ +- s = bcm_mailbox_property(&msg, sizeof msg); ++ ret = bcm2835_cpufreq_clock_property(RPI_FIRMWARE_SET_CLOCK_RATE, VCMSG_ID_ARM_CLOCK, &rate); ++ if (ret) { ++ print_err("Failed to set clock: %d (%d)\n", arm_rate, ret); ++ return 0; ++ } + +- /* check if it was all ok and return the rate in KHz */ +- if (s == 0 && (msg.request_code & 0x80000000)) +- actual_rate = msg.tag.val/1000; ++ rate /= 1000; ++ print_debug("Setting new frequency = %d -> %d (actual %d)\n", cur_rate, arm_rate, rate); + +- print_debug("Setting new frequency = %d -> %d (actual %d)\n", cur_rate, arm_rate, actual_rate); +- return actual_rate; ++ return rate; + } + + static uint32_t bcm2835_cpufreq_get_clock(int tag) + { +- int s; +- int arm_rate = 0; +- struct vc_msg msg; +- +- /* wipe all previous message data */ +- memset(&msg, 0, sizeof msg); +- +- msg.msg_size = sizeof msg; +- msg.tag.tag_id = tag; +- msg.tag.buffer_size = 8; +- msg.tag.data_size = 4; /* we're just sending the clock ID which is one word long */ +- msg.tag.dev_id = VCMSG_ID_ARM_CLOCK; ++ u32 rate; ++ int ret; + +- /* send the message */ +- s = bcm_mailbox_property(&msg, sizeof msg); +- +- /* check if it was all ok and return the rate in KHz */ +- if (s == 0 && (msg.request_code & 0x80000000)) +- arm_rate = msg.tag.val/1000; ++ ret = bcm2835_cpufreq_clock_property(tag, VCMSG_ID_ARM_CLOCK, &rate); ++ if (ret) { ++ print_err("Failed to get clock (%d)\n", ret); ++ return 0; ++ } + +- print_debug("%s frequency = %d\n", +- tag == VCMSG_GET_CLOCK_RATE ? "Current": +- tag == VCMSG_GET_MIN_CLOCK ? "Min": +- tag == VCMSG_GET_MAX_CLOCK ? "Max": +- "Unexpected", arm_rate); ++ rate /= 1000; ++ print_debug("%s frequency = %u\n", ++ tag == RPI_FIRMWARE_GET_CLOCK_RATE ? "Current": ++ tag == RPI_FIRMWARE_GET_MIN_CLOCK_RATE ? "Min": ++ tag == RPI_FIRMWARE_GET_MAX_CLOCK_RATE ? "Max": ++ "Unexpected", rate); + +- return arm_rate; ++ return rate; + } + + /* +@@ -165,9 +149,14 @@ static int bcm2835_cpufreq_driver_init(struct cpufreq_policy *policy) + /* measured value of how long it takes to change frequency */ + const unsigned int transition_latency = 355000; /* ns */ + ++ if (!rpi_firmware_get(NULL)) { ++ print_err("Firmware is not available\n"); ++ return -ENODEV; ++ } ++ + /* now find out what the maximum and minimum frequencies are */ +- bcm2835_freq_table[0].frequency = bcm2835_cpufreq_get_clock(VCMSG_GET_MIN_CLOCK); +- bcm2835_freq_table[1].frequency = bcm2835_cpufreq_get_clock(VCMSG_GET_MAX_CLOCK); ++ bcm2835_freq_table[0].frequency = bcm2835_cpufreq_get_clock(RPI_FIRMWARE_GET_MIN_CLOCK_RATE); ++ bcm2835_freq_table[1].frequency = bcm2835_cpufreq_get_clock(RPI_FIRMWARE_GET_MAX_CLOCK_RATE); + + print_info("min=%d max=%d\n", bcm2835_freq_table[0].frequency, bcm2835_freq_table[1].frequency); + return cpufreq_generic_init(policy, bcm2835_freq_table, transition_latency); +@@ -201,8 +190,8 @@ static int bcm2835_cpufreq_driver_target_index(struct cpufreq_policy *policy, un + + static unsigned int bcm2835_cpufreq_driver_get(unsigned int cpu) + { +- unsigned int actual_rate = bcm2835_cpufreq_get_clock(VCMSG_GET_CLOCK_RATE); +- print_debug("%d: freq=%d\n", cpu, actual_rate); ++ unsigned int actual_rate = bcm2835_cpufreq_get_clock(RPI_FIRMWARE_GET_CLOCK_RATE); ++ print_debug("cpu%d: freq=%d\n", cpu, actual_rate); + return actual_rate <= bcm2835_freq_table[0].frequency ? bcm2835_freq_table[0].frequency : bcm2835_freq_table[1].frequency; + } + + +From a15106c0300ea7958fa7e1cc62c573d999eb4ee2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Mon, 20 Jul 2015 12:20:59 +0200 +Subject: [PATCH 137/149] fbdev: bcm2708: Use firmware API +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Use the new firmware API instead of the legacy mailbox API. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 1 + + drivers/video/fbdev/bcm2708_fb.c | 273 +++++++++++++++++++--------------- + 2 files changed, 152 insertions(+), 122 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index bd8ac0a..d1c3bdf 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -217,6 +217,7 @@ + + fb: fb { + compatible = "brcm,bcm2708-fb"; ++ firmware = <&firmware>; + status = "disabled"; + }; + +diff --git a/drivers/video/fbdev/bcm2708_fb.c b/drivers/video/fbdev/bcm2708_fb.c +index f6ac7da..06a96d16 100644 +--- a/drivers/video/fbdev/bcm2708_fb.c ++++ b/drivers/video/fbdev/bcm2708_fb.c +@@ -25,7 +25,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -34,6 +33,7 @@ + #include + #include + #include ++#include + + //#define BCM2708_FB_DEBUG + #define MODULE_NAME "bcm2708_fb" +@@ -58,15 +58,19 @@ static u32 dma_busy_wait_threshold = 1<<15; + module_param(dma_busy_wait_threshold, int, 0644); + MODULE_PARM_DESC(dma_busy_wait_threshold, "Busy-wait for DMA completion below this area"); + +-/* this data structure describes each frame buffer device we find */ +- +-struct fbinfo_s { +- u32 xres, yres, xres_virtual, yres_virtual; +- u32 pitch, bpp; ++struct fb_alloc_tags { ++ struct rpi_firmware_property_tag_header tag1; ++ u32 xres, yres; ++ struct rpi_firmware_property_tag_header tag2; ++ u32 xres_virtual, yres_virtual; ++ struct rpi_firmware_property_tag_header tag3; ++ u32 bpp; ++ struct rpi_firmware_property_tag_header tag4; + u32 xoffset, yoffset; +- u32 base; +- u32 screen_size; +- u16 cmap[256]; ++ struct rpi_firmware_property_tag_header tag5; ++ u32 base, screen_size; ++ struct rpi_firmware_property_tag_header tag6; ++ u32 pitch; + }; + + struct bcm2708_fb_stats { +@@ -78,9 +82,9 @@ struct bcm2708_fb_stats { + struct bcm2708_fb { + struct fb_info fb; + struct platform_device *dev; +- struct fbinfo_s *info; +- dma_addr_t dma; ++ struct rpi_firmware *fw; + u32 cmap[16]; ++ u32 gpu_cmap[256]; + int dma_chan; + int dma_irq; + void __iomem *dma_chan_base; +@@ -270,69 +274,71 @@ static int bcm2708_fb_check_var(struct fb_var_screeninfo *var, + + static int bcm2708_fb_set_par(struct fb_info *info) + { +- uint32_t val = 0; + struct bcm2708_fb *fb = to_bcm2708(info); +- volatile struct fbinfo_s *fbinfo = fb->info; +- fbinfo->xres = info->var.xres; +- fbinfo->yres = info->var.yres; +- fbinfo->xres_virtual = info->var.xres_virtual; +- fbinfo->yres_virtual = info->var.yres_virtual; +- fbinfo->bpp = info->var.bits_per_pixel; +- fbinfo->xoffset = info->var.xoffset; +- fbinfo->yoffset = info->var.yoffset; +- fbinfo->base = 0; /* filled in by VC */ +- fbinfo->pitch = 0; /* filled in by VC */ ++ struct fb_alloc_tags fbinfo = { ++ .tag1 = { RPI_FIRMWARE_FRAMEBUFFER_SET_PHYSICAL_WIDTH_HEIGHT, ++ 8, 0, }, ++ .xres = info->var.xres, ++ .yres = info->var.yres, ++ .tag2 = { RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT, ++ 8, 0, }, ++ .xres_virtual = info->var.xres_virtual, ++ .yres_virtual = info->var.yres_virtual, ++ .tag3 = { RPI_FIRMWARE_FRAMEBUFFER_SET_DEPTH, 4, 0 }, ++ .bpp = info->var.bits_per_pixel, ++ .tag4 = { RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_OFFSET, 8, 0 }, ++ .xoffset = info->var.xoffset, ++ .yoffset = info->var.yoffset, ++ .tag5 = { RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE, 8, 0 }, ++ .base = 0, ++ .screen_size = 0, ++ .tag6 = { RPI_FIRMWARE_FRAMEBUFFER_GET_PITCH, 4, 0 }, ++ .pitch = 0, ++ }; ++ int ret; + + print_debug("bcm2708_fb_set_par info(%p) %dx%d (%dx%d), %d, %d\n", info, + info->var.xres, info->var.yres, info->var.xres_virtual, + info->var.yres_virtual, (int)info->screen_size, + info->var.bits_per_pixel); + +- /* ensure last write to fbinfo is visible to GPU */ +- wmb(); +- +- /* inform vc about new framebuffer */ +- bcm_mailbox_write(MBOX_CHAN_FB, fb->dma); +- +- /* TODO: replace fb driver with vchiq version */ +- /* wait for response */ +- bcm_mailbox_read(MBOX_CHAN_FB, &val); +- +- /* ensure GPU writes are visible to us */ +- rmb(); +- +- if (val == 0) { +- fb->fb.fix.line_length = fbinfo->pitch; +- +- if (info->var.bits_per_pixel <= 8) +- fb->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR; +- else +- fb->fb.fix.visual = FB_VISUAL_TRUECOLOR; +- +- fb->fb_bus_address = fbinfo->base; +- fbinfo->base &= ~0xc0000000; +- fb->fb.fix.smem_start = fbinfo->base; +- fb->fb.fix.smem_len = fbinfo->pitch * fbinfo->yres_virtual; +- fb->fb.screen_size = fbinfo->screen_size; +- if (fb->fb.screen_base) +- iounmap(fb->fb.screen_base); +- fb->fb.screen_base = +- (void *)ioremap_wc(fbinfo->base, fb->fb.screen_size); +- if (!fb->fb.screen_base) { +- /* the console may currently be locked */ +- console_trylock(); +- console_unlock(); +- pr_err("bcm2708_fb_set_par: Failed to set screen_base\n"); +- return -EIO; +- } ++ ret = rpi_firmware_property_list(fb->fw, &fbinfo, sizeof(fbinfo)); ++ if (ret) { ++ dev_err(info->device, ++ "Failed to allocate GPU framebuffer (%d)\n", ret); ++ return ret; + } ++ ++ if (info->var.bits_per_pixel <= 8) ++ fb->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR; ++ else ++ fb->fb.fix.visual = FB_VISUAL_TRUECOLOR; ++ ++ fb->fb.fix.line_length = fbinfo.pitch; ++ fbinfo.base |= 0x40000000; ++ fb->fb_bus_address = fbinfo.base; ++ fbinfo.base &= ~0xc0000000; ++ fb->fb.fix.smem_start = fbinfo.base; ++ fb->fb.fix.smem_len = fbinfo.pitch * fbinfo.yres_virtual; ++ fb->fb.screen_size = fbinfo.screen_size; ++ if (fb->fb.screen_base) ++ iounmap(fb->fb.screen_base); ++ fb->fb.screen_base = ioremap_wc(fbinfo.base, fb->fb.screen_size); ++ if (!fb->fb.screen_base) { ++ /* the console may currently be locked */ ++ console_trylock(); ++ console_unlock(); ++ dev_err(info->device, "Failed to set screen_base\n"); ++ return -ENOMEM; ++ } ++ + print_debug +- ("BCM2708FB: start = %p,%p width=%d, height=%d, bpp=%d, pitch=%d size=%d success=%d\n", ++ ("BCM2708FB: start = %p,%p width=%d, height=%d, bpp=%d, pitch=%d size=%d\n", + (void *)fb->fb.screen_base, (void *)fb->fb_bus_address, +- fbinfo->xres, fbinfo->yres, fbinfo->bpp, +- fbinfo->pitch, (int)fb->fb.screen_size, val); ++ fbinfo.xres, fbinfo.yres, fbinfo.bpp, ++ fbinfo.pitch, (int)fb->fb.screen_size); + +- return val; ++ return 0; + } + + static inline u32 convert_bitfield(int val, struct fb_bitfield *bf) +@@ -352,15 +358,34 @@ static int bcm2708_fb_setcolreg(unsigned int regno, unsigned int red, + /*print_debug("BCM2708FB: setcolreg %d:(%02x,%02x,%02x,%02x) %x\n", regno, red, green, blue, transp, fb->fb.fix.visual);*/ + if (fb->fb.var.bits_per_pixel <= 8) { + if (regno < 256) { +- /* blue [0:4], green [5:10], red [11:15] */ +- fb->info->cmap[regno] = ((red >> (16-5)) & 0x1f) << 11 | +- ((green >> (16-6)) & 0x3f) << 5 | +- ((blue >> (16-5)) & 0x1f) << 0; ++ /* blue [23:16], green [15:8], red [7:0] */ ++ fb->gpu_cmap[regno] = ((red >> 8) & 0xff) << 0 | ++ ((green >> 8) & 0xff) << 8 | ++ ((blue >> 8) & 0xff) << 16; + } + /* Hack: we need to tell GPU the palette has changed, but currently bcm2708_fb_set_par takes noticable time when called for every (256) colour */ + /* So just call it for what looks like the last colour in a list for now. */ +- if (regno == 15 || regno == 255) +- bcm2708_fb_set_par(info); ++ if (regno == 15 || regno == 255) { ++ struct packet { ++ u32 offset; ++ u32 length; ++ u32 cmap[256]; ++ } *packet; ++ int ret; ++ ++ packet = kmalloc(sizeof(*packet), GFP_KERNEL); ++ if (!packet) ++ return -ENOMEM; ++ packet->offset = 0; ++ packet->length = regno + 1; ++ memcpy(packet->cmap, fb->gpu_cmap, sizeof(packet->cmap)); ++ ret = rpi_firmware_property(fb->fw, RPI_FIRMWARE_FRAMEBUFFER_SET_PALETTE, ++ packet, (2 + packet->length) * sizeof(u32)); ++ if (ret || packet->offset) ++ dev_err(info->device, "Failed to set palette (%d,%u)\n", ++ ret, packet->offset); ++ kfree(packet); ++ } + } else if (regno < 16) { + fb->cmap[regno] = convert_bitfield(transp, &fb->fb.var.transp) | + convert_bitfield(blue, &fb->fb.var.blue) | +@@ -372,27 +397,31 @@ static int bcm2708_fb_setcolreg(unsigned int regno, unsigned int red, + + static int bcm2708_fb_blank(int blank_mode, struct fb_info *info) + { +- s32 result = -1; +- u32 p[7]; +- if ( (blank_mode == FB_BLANK_NORMAL) || +- (blank_mode == FB_BLANK_UNBLANK)) { +- +- p[0] = 28; // size = sizeof u32 * length of p +- p[1] = VCMSG_PROCESS_REQUEST; // process request +- p[2] = VCMSG_SET_BLANK_SCREEN; // (the tag id) +- p[3] = 4; // (size of the response buffer) +- p[4] = 4; // (size of the request data) +- p[5] = blank_mode; +- p[6] = VCMSG_PROPERTY_END; // end tag +- +- bcm_mailbox_property(&p, p[0]); +- +- if ( p[1] == VCMSG_REQUEST_SUCCESSFUL ) +- result = 0; +- else +- pr_err("bcm2708_fb_blank(%d) returns=%d p[1]=0x%x\n", blank_mode, p[5], p[1]); ++ struct bcm2708_fb *fb = to_bcm2708(info); ++ u32 value; ++ int ret; ++ ++ switch (blank_mode) { ++ case FB_BLANK_UNBLANK: ++ value = 0; ++ break; ++ case FB_BLANK_NORMAL: ++ case FB_BLANK_VSYNC_SUSPEND: ++ case FB_BLANK_HSYNC_SUSPEND: ++ case FB_BLANK_POWERDOWN: ++ value = 1; ++ break; ++ default: ++ return -EINVAL; + } +- return result; ++ ++ ret = rpi_firmware_property(fb->fw, RPI_FIRMWARE_FRAMEBUFFER_BLANK, ++ &value, sizeof(value)); ++ if (ret) ++ dev_err(info->device, "bcm2708_fb_blank(%d) failed: %d\n", ++ blank_mode, ret); ++ ++ return ret; + } + + static int bcm2708_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) +@@ -408,25 +437,25 @@ static int bcm2708_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info + + static int bcm2708_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) + { +- s32 result = -1; +- u32 p[7]; +- if (cmd == FBIO_WAITFORVSYNC) { +- p[0] = 28; // size = sizeof u32 * length of p +- p[1] = VCMSG_PROCESS_REQUEST; // process request +- p[2] = VCMSG_SET_VSYNC; // (the tag id) +- p[3] = 4; // (size of the response buffer) +- p[4] = 4; // (size of the request data) +- p[5] = 0; // dummy +- p[6] = VCMSG_PROPERTY_END; // end tag +- +- bcm_mailbox_property(&p, p[0]); +- +- if ( p[1] == VCMSG_REQUEST_SUCCESSFUL ) +- result = 0; +- else +- pr_err("bcm2708_fb_ioctl %x,%lx returns=%d p[1]=0x%x\n", cmd, arg, p[5], p[1]); ++ struct bcm2708_fb *fb = to_bcm2708(info); ++ u32 dummy = 0; ++ int ret; ++ ++ switch (cmd) { ++ case FBIO_WAITFORVSYNC: ++ ret = rpi_firmware_property(fb->fw, ++ RPI_FIRMWARE_FRAMEBUFFER_SET_VSYNC, ++ &dummy, sizeof(dummy)); ++ break; ++ default: ++ dev_err(info->device, "Unknown ioctl 0x%x\n", cmd); ++ return -EINVAL; + } +- return result; ++ ++ if (ret) ++ dev_err(info->device, "ioctl 0x%x failed (%d)\n", cmd, ret); ++ ++ return ret; + } + static void bcm2708_fb_fillrect(struct fb_info *info, + const struct fb_fillrect *rect) +@@ -621,20 +650,7 @@ static struct fb_ops bcm2708_fb_ops = { + static int bcm2708_fb_register(struct bcm2708_fb *fb) + { + int ret; +- dma_addr_t dma; +- void *mem; +- +- mem = +- dma_alloc_coherent(&fb->dev->dev, PAGE_ALIGN(sizeof(*fb->info)), &dma, +- GFP_KERNEL); + +- if (NULL == mem) { +- pr_err(": unable to allocate fbinfo buffer\n"); +- ret = -ENOMEM; +- } else { +- fb->info = (struct fbinfo_s *)mem; +- fb->dma = dma; +- } + fb->fb.fbops = &bcm2708_fb_ops; + fb->fb.flags = FBINFO_FLAG_DEFAULT | FBINFO_HWACCEL_COPYAREA; + fb->fb.pseudo_palette = fb->cmap; +@@ -693,9 +709,22 @@ static int bcm2708_fb_register(struct bcm2708_fb *fb) + + static int bcm2708_fb_probe(struct platform_device *dev) + { ++ struct device_node *fw_np; ++ struct rpi_firmware *fw; + struct bcm2708_fb *fb; + int ret; + ++ fw_np = of_parse_phandle(dev->dev.of_node, "firmware", 0); ++/* Remove comment when booting without Device Tree is no longer supported ++ if (!fw_np) { ++ dev_err(&dev->dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } ++*/ ++ fw = rpi_firmware_get(fw_np); ++ if (!fw) ++ return -EPROBE_DEFER; ++ + fb = kzalloc(sizeof(struct bcm2708_fb), GFP_KERNEL); + if (!fb) { + dev_err(&dev->dev, +@@ -704,6 +733,7 @@ static int bcm2708_fb_probe(struct platform_device *dev) + goto free_region; + } + ++ fb->fw = fw; + bcm2708_fb_debugfs_init(fb); + + fb->cb_base = dma_alloc_writecombine(&dev->dev, SZ_64K, +@@ -737,6 +767,7 @@ static int bcm2708_fb_probe(struct platform_device *dev) + fb->dma_chan, fb->dma_chan_base); + + fb->dev = dev; ++ fb->fb.device = &dev->dev; + + ret = bcm2708_fb_register(fb); + if (ret == 0) { +@@ -769,8 +800,6 @@ static int bcm2708_fb_remove(struct platform_device *dev) + dma_free_writecombine(&dev->dev, SZ_64K, fb->cb_base, fb->cb_handle); + bcm_dma_chan_free(fb->dma_chan); + +- dma_free_coherent(NULL, PAGE_ALIGN(sizeof(*fb->info)), (void *)fb->info, +- fb->dma); + bcm2708_fb_debugfs_deinit(fb); + + free_irq(fb->dma_irq, fb); + +From 8af174253322c75147e90fbc0ec0698d171e15ad Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Mon, 20 Jul 2015 12:27:17 +0200 +Subject: [PATCH 138/149] bcm2835: Add firmware property to affected devices +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Also move firmware depending devices to the rpi dtsi file since +they depend on the Pi specific firmware. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2835-rpi.dtsi | 22 ++++++++++++++++++---- + arch/arm/boot/dts/bcm2835.dtsi | 15 --------------- + 2 files changed, 18 insertions(+), 19 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2835-rpi.dtsi b/arch/arm/boot/dts/bcm2835-rpi.dtsi +index 5cdfd5a..6c3daaf 100644 +--- a/arch/arm/boot/dts/bcm2835-rpi.dtsi ++++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi +@@ -32,6 +32,24 @@ + compatible = "raspberrypi,bcm2835-firmware"; + mboxes = <&mailbox>; + }; ++ ++ fb: fb { ++ compatible = "brcm,bcm2708-fb"; ++ firmware = <&firmware>; ++ }; ++ ++ thermal: thermal { ++ compatible = "brcm,bcm2835-thermal"; ++ firmware = <&firmware>; ++ }; ++ ++ vchiq: vchiq { ++ compatible = "brcm,bcm2835-vchiq"; ++ reg = <0x7e00b840 0xf>; ++ interrupts = <0 2>; ++ cache-line-size = <32>; ++ firmware = <&firmware>; ++ }; + }; + + /* Onboard audio */ +@@ -101,10 +119,6 @@ + bus-width = <4>; + }; + +-&fb { +- status = "okay"; +-}; +- + / { + __overrides__ { + i2s = <&i2s>,"status"; +diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi +index 1135120..807264d 100644 +--- a/arch/arm/boot/dts/bcm2835.dtsi ++++ b/arch/arm/boot/dts/bcm2835.dtsi +@@ -160,21 +160,6 @@ + arm-pmu { + compatible = "arm,arm1176-pmu"; + }; +- +- fb: fb { +- compatible = "brcm,bcm2708-fb"; +- status = "disabled"; +- }; +- +- vchiq: vchiq { +- compatible = "brcm,bcm2835-vchiq"; +- reg = <0x7e00b840 0xf>; +- interrupts = <0 2>; +- }; +- +- thermal: thermal { +- compatible = "brcm,bcm2835-thermal"; +- }; + }; + + clocks { + +From 66840ef91d4a460062686c8312f267264b567f98 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Tue, 21 Jul 2015 19:09:39 +0200 +Subject: [PATCH 139/149] rpi-ft5406: Use firmware API +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts | 1 + + drivers/input/touchscreen/rpi-ft5406.c | 74 ++++++++++------------- + 2 files changed, 32 insertions(+), 43 deletions(-) + +diff --git a/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts b/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts +index 40deab5..2e53a17 100644 +--- a/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts ++++ b/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts +@@ -9,6 +9,7 @@ + __overlay__ { + rpi_ft5406: rpi_ft5406 { + compatible = "rpi,rpi-ft5406"; ++ firmware = <&firmware>; + status = "okay"; + }; + }; +diff --git a/drivers/input/touchscreen/rpi-ft5406.c b/drivers/input/touchscreen/rpi-ft5406.c +index d41851d..c08817e 100644 +--- a/drivers/input/touchscreen/rpi-ft5406.c ++++ b/drivers/input/touchscreen/rpi-ft5406.c +@@ -21,7 +21,7 @@ + #include + #include + #include +-#include ++#include + + #define MAXIMUM_SUPPORTED_POINTS 10 + struct ft5406_regs { +@@ -49,23 +49,6 @@ struct ft5406 { + struct task_struct * thread; + }; + +- +-/* tag part of the message */ +-struct vc_msg_tag { +- uint32_t tag_id; /* the message id */ +- uint32_t buffer_size; /* size of the buffer (which in this case is always 8 bytes) */ +- uint32_t data_size; /* amount of data being sent or received */ +- uint32_t val; /* data buffer */ +-}; +- +-/* message structure to be sent to videocore */ +-struct vc_msg { +- uint32_t msg_size; /* simply, sizeof(struct vc_msg) */ +- uint32_t request_code; /* holds various information like the success and number of bytes returned (refer to mailboxes wiki) */ +- struct vc_msg_tag tag; /* the tag structure above to make */ +- uint32_t end_tag; /* an end identifier, should be set to NULL */ +-}; +- + /* Thread to poll for touchscreen events + * + * This thread polls the memory based register copy of the ft5406 registers +@@ -136,11 +119,37 @@ static int ft5406_probe(struct platform_device *pdev) + { + int ret; + struct input_dev * input_dev = input_allocate_device(); +- struct vc_msg request; + struct ft5406 * ts; ++ struct device_node *fw_node; ++ struct rpi_firmware *fw; ++ u32 touchbuf; + + dev_info(&pdev->dev, "Probing device\n"); + ++ fw_node = of_parse_phandle(pdev->dev.of_node, "firmware", 0); ++ if (!fw_node) { ++ dev_err(&pdev->dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } ++ ++ fw = rpi_firmware_get(fw_node); ++ if (!fw) ++ return -EPROBE_DEFER; ++ ++ ret = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_GET_TOUCHBUF, ++ &touchbuf, sizeof(touchbuf)); ++ if (ret) { ++ dev_err(&pdev->dev, "Failed to get touch buffer\n"); ++ return ret; ++ } ++ ++ if (!touchbuf) { ++ dev_err(&pdev->dev, "Touchscreen not detected\n"); ++ return -ENODEV; ++ } ++ ++ dev_dbg(&pdev->dev, "Got TS buffer 0x%x\n", touchbuf); ++ + ts = kzalloc(sizeof(struct ft5406), GFP_KERNEL); + + if (!ts || !input_dev) { +@@ -174,36 +183,15 @@ static int ft5406_probe(struct platform_device *pdev) + return ret; + } + +- memset(&request, 0, sizeof request); +- +- request.msg_size = sizeof request; +- request.request_code = VCMSG_PROCESS_REQUEST; +- request.tag.tag_id = VCMSG_GET_TOUCHBUF; +- request.tag.buffer_size = 4; +- request.tag.data_size = 4; +- +- bcm_mailbox_property(&request, sizeof(request)); +- +- if(request.request_code == VCMSG_REQUEST_SUCCESSFUL && request.tag.val != 0) +- { +- dev_dbg(&pdev->dev, "Got TS buffer 0x%x\n", request.tag.val); +- } +- else +- { +- input_unregister_device(input_dev); +- kzfree(ts); +- return -1; +- } +- + // mmap the physical memory +- request.tag.val &= ~0xc0000000; +- ts->ts_base = ioremap(request.tag.val, sizeof(*ts->regs)); ++ touchbuf &= ~0xc0000000; ++ ts->ts_base = ioremap(touchbuf, sizeof(*ts->regs)); + if(ts->ts_base == NULL) + { + dev_err(&pdev->dev, "Failed to map physical address\n"); + input_unregister_device(input_dev); + kzfree(ts); +- return -1; ++ return -ENOMEM; + } + + ts->regs = (struct ft5406_regs *) ts->ts_base; + +From c1a5966807b9f6111684fda87e17df03f948e4d2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 12 Jun 2015 19:01:05 +0200 +Subject: [PATCH 140/149] irqchip: bcm2835: Add FIQ support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add a duplicate irq range with an offset on the hwirq's so the +driver can detect that enable_fiq() is used. +Tested with downstream dwc_otg USB controller driver. + +Signed-off-by: Noralf Trønnes +Reviewed-by: Eric Anholt +Acked-by: Stephen Warren +--- + arch/arm/mach-bcm/Kconfig | 1 + + drivers/irqchip/irq-bcm2835.c | 53 ++++++++++++++++++++++++++++++++++++++----- + 2 files changed, 48 insertions(+), 6 deletions(-) + +diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig +index 8b11f44..7cfef7b 100644 +--- a/arch/arm/mach-bcm/Kconfig ++++ b/arch/arm/mach-bcm/Kconfig +@@ -114,6 +114,7 @@ config ARCH_BCM2835 + select ARM_ERRATA_411920 + select ARM_TIMER_SP804 + select CLKSRC_OF ++ select FIQ + select PINCTRL + select PINCTRL_BCM2835 + help +diff --git a/drivers/irqchip/irq-bcm2835.c b/drivers/irqchip/irq-bcm2835.c +index 5916d6c..db66246 100644 +--- a/drivers/irqchip/irq-bcm2835.c ++++ b/drivers/irqchip/irq-bcm2835.c +@@ -56,7 +56,7 @@ + #include "irqchip.h" + + /* Put the bank and irq (32 bits) into the hwirq */ +-#define MAKE_HWIRQ(b, n) ((b << 5) | (n)) ++#define MAKE_HWIRQ(b, n) (((b) << 5) | (n)) + #define HWIRQ_BANK(i) (i >> 5) + #define HWIRQ_BIT(i) BIT(i & 0x1f) + +@@ -72,9 +72,13 @@ + | SHORTCUT1_MASK | SHORTCUT2_MASK) + + #define REG_FIQ_CONTROL 0x0c ++#define REG_FIQ_ENABLE 0x80 ++#define REG_FIQ_DISABLE 0 + + #define NR_BANKS 3 + #define IRQS_PER_BANK 32 ++#define NUMBER_IRQS MAKE_HWIRQ(NR_BANKS, 0) ++#define FIQ_START (NR_IRQS_BANK0 + MAKE_HWIRQ(NR_BANKS - 1, 0)) + + static int reg_pending[] __initconst = { 0x00, 0x04, 0x08 }; + static int reg_enable[] __initconst = { 0x18, 0x10, 0x14 }; +@@ -98,14 +102,38 @@ static struct armctrl_ic intc __read_mostly; + static void __exception_irq_entry bcm2835_handle_irq( + struct pt_regs *regs); + ++static inline unsigned int hwirq_to_fiq(unsigned long hwirq) ++{ ++ hwirq -= NUMBER_IRQS; ++ /* ++ * The hwirq numbering used in this driver is: ++ * BASE (0-7) GPU1 (32-63) GPU2 (64-95). ++ * This differ from the one used in the FIQ register: ++ * GPU1 (0-31) GPU2 (32-63) BASE (64-71) ++ */ ++ if (hwirq >= 32) ++ return hwirq - 32; ++ ++ return hwirq + 64; ++} ++ + static void armctrl_mask_irq(struct irq_data *d) + { +- writel_relaxed(HWIRQ_BIT(d->hwirq), intc.disable[HWIRQ_BANK(d->hwirq)]); ++ if (d->hwirq >= NUMBER_IRQS) ++ writel_relaxed(REG_FIQ_DISABLE, intc.base + REG_FIQ_CONTROL); ++ else ++ writel_relaxed(HWIRQ_BIT(d->hwirq), ++ intc.disable[HWIRQ_BANK(d->hwirq)]); + } + + static void armctrl_unmask_irq(struct irq_data *d) + { +- writel_relaxed(HWIRQ_BIT(d->hwirq), intc.enable[HWIRQ_BANK(d->hwirq)]); ++ if (d->hwirq >= NUMBER_IRQS) ++ writel_relaxed(REG_FIQ_ENABLE | hwirq_to_fiq(d->hwirq), ++ intc.base + REG_FIQ_CONTROL); ++ else ++ writel_relaxed(HWIRQ_BIT(d->hwirq), ++ intc.enable[HWIRQ_BANK(d->hwirq)]); + } + + static struct irq_chip armctrl_chip = { +@@ -150,8 +178,9 @@ static int __init armctrl_of_init(struct device_node *node, + panic("%s: unable to map IC registers\n", + node->full_name); + +- intc.domain = irq_domain_add_linear(node, MAKE_HWIRQ(NR_BANKS, 0), +- &armctrl_ops, NULL); ++ intc.base = base; ++ intc.domain = irq_domain_add_linear(node, NUMBER_IRQS * 2, ++ &armctrl_ops, NULL); + if (!intc.domain) + panic("%s: unable to create IRQ domain\n", node->full_name); + +@@ -168,8 +197,20 @@ static int __init armctrl_of_init(struct device_node *node, + set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); + } + } +- + set_handle_irq(bcm2835_handle_irq); ++ ++ /* Make a duplicate irq range which is used to enable FIQ */ ++ for (b = 0; b < NR_BANKS; b++) { ++ for (i = 0; i < bank_irqs[b]; i++) { ++ irq = irq_create_mapping(intc.domain, ++ MAKE_HWIRQ(b, i) + NUMBER_IRQS); ++ BUG_ON(irq <= 0); ++ irq_set_chip(irq, &armctrl_chip); ++ set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); ++ } ++ } ++ init_FIQ(FIQ_START); ++ + return 0; + } + + +From 0086c10ac490fb95a1ec82df80587b591ee74ab3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 24 Jul 2015 15:50:04 +0200 +Subject: [PATCH 141/149] dwc_otg: Add ARCH_BCM2835 support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Noralf Trønnes +--- + drivers/usb/host/dwc_otg/dwc_otg_driver.c | 1 + + drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 1 - + drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c | 4 ++++ + 3 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_driver.c b/drivers/usb/host/dwc_otg/dwc_otg_driver.c +index 53307f0..95edadf 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_driver.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_driver.c +@@ -723,6 +723,7 @@ static int dwc_otg_driver_probe( + + memset(dwc_otg_device, 0, sizeof(*dwc_otg_device)); + dwc_otg_device->os_dep.reg_offset = 0xFFFFFFFF; ++ dwc_otg_device->os_dep.platformdev = _dev; + + /* + * Map the DWC_otg Core memory into virtual address space. +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +index 8a31562..3f71f29 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +@@ -36,7 +36,6 @@ + #include "dwc_otg_regs.h" + + #include +-#include + #include + + +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c +index 0f4ebcd..5c83309 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c +@@ -445,7 +445,11 @@ static void hcd_init_fiq(void *cookie) + DWC_WARN("MPHI periph has NOT been enabled"); + #endif + // Enable FIQ interrupt from USB peripheral ++#ifdef CONFIG_ARCH_BCM2835 ++ enable_fiq(platform_get_irq(otg_dev->os_dep.platformdev, 1)); ++#else + enable_fiq(INTERRUPT_VC_USB); ++#endif + local_fiq_enable(); + } + + +From 025a502906cf5454047391a95846c4d6a3065240 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 24 Jul 2015 15:50:24 +0200 +Subject: [PATCH 142/149] bcm2835: Use DWC_OTG +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2835.dtsi | 8 +++++--- + arch/arm/configs/bcm2835_defconfig | 1 + + 2 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi +index 807264d..8a5d6ec 100644 +--- a/arch/arm/boot/dts/bcm2835.dtsi ++++ b/arch/arm/boot/dts/bcm2835.dtsi +@@ -152,9 +152,11 @@ + }; + + usb: usb@7e980000 { +- compatible = "brcm,bcm2835-usb"; +- reg = <0x7e980000 0x10000>; +- interrupts = <1 9>; ++ compatible = "brcm,bcm2708-usb"; ++ reg = <0x7e980000 0x10000>, ++ <0x7e006000 0x1000>; ++ interrupts = <2 0>, ++ <1 9>; + }; + + arm-pmu { +diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig +index c284414..14ef294 100644 +--- a/arch/arm/configs/bcm2835_defconfig ++++ b/arch/arm/configs/bcm2835_defconfig +@@ -869,6 +869,7 @@ CONFIG_USB_HIDDEV=y + CONFIG_USB=y + CONFIG_USB_ANNOUNCE_NEW_DEVICES=y + CONFIG_USB_MON=m ++CONFIG_USB_DWCOTG=y + CONFIG_USB_PRINTER=m + CONFIG_USB_STORAGE=y + CONFIG_USB_STORAGE_REALTEK=m + +From 808a80f803c9f8897b0867a5a7c0d52cfe984bfe Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 24 Jul 2015 19:33:16 +0200 +Subject: [PATCH 143/149] Fix RASPBERRYPI_FIRMWARE dependents +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If forgot this when converting the drivers. + +Signed-off-by: Noralf Trønnes +--- + drivers/cpufreq/Kconfig.arm | 2 +- + drivers/input/touchscreen/Kconfig | 2 +- + drivers/misc/vc04_services/Kconfig | 2 +- + drivers/thermal/Kconfig | 2 +- + drivers/video/fbdev/Kconfig | 2 +- + 5 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm +index a1039f0..0037516 100644 +--- a/drivers/cpufreq/Kconfig.arm ++++ b/drivers/cpufreq/Kconfig.arm +@@ -259,7 +259,7 @@ config ARM_SPEAR_CPUFREQ + This adds the CPUFreq driver support for SPEAr SOCs. + + config ARM_BCM2835_CPUFREQ +- depends on BCM2708_MBOX ++ depends on RASPBERRYPI_FIRMWARE + bool "BCM2835 Driver" + default y + help +diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig +index 5848562..d7e74a1 100644 +--- a/drivers/input/touchscreen/Kconfig ++++ b/drivers/input/touchscreen/Kconfig +@@ -585,7 +585,7 @@ config TOUCHSCREEN_EDT_FT5X06 + + config TOUCHSCREEN_RPI_FT5406 + tristate "Raspberry Pi FT5406 driver" +- depends on ARCH_BCM2708 || ARCH_BCM2709 ++ depends on RASPBERRYPI_FIRMWARE + help + Say Y here to enable the Raspberry Pi memory based FT5406 device + +diff --git a/drivers/misc/vc04_services/Kconfig b/drivers/misc/vc04_services/Kconfig +index c5ba283..db8e1be 100644 +--- a/drivers/misc/vc04_services/Kconfig ++++ b/drivers/misc/vc04_services/Kconfig +@@ -1,6 +1,6 @@ + config BCM2708_VCHIQ + tristate "Videocore VCHIQ" +- depends on (MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835) && BCM2708_MBOX ++ depends on RASPBERRYPI_FIRMWARE + default y + help + Kernel to VideoCore communication interface for the +diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig +index ddc77ad..b911213 100644 +--- a/drivers/thermal/Kconfig ++++ b/drivers/thermal/Kconfig +@@ -239,7 +239,7 @@ config INTEL_POWERCLAMP + user interface is exposed via generic thermal framework. + + config THERMAL_BCM2835 +- depends on BCM2708_MBOX ++ depends on RASPBERRYPI_FIRMWARE + tristate "BCM2835 Thermal Driver" + help + This will enable temperature monitoring for the Broadcom BCM2835 +diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig +index 3444a4c..c073d55 100644 +--- a/drivers/video/fbdev/Kconfig ++++ b/drivers/video/fbdev/Kconfig +@@ -226,7 +226,7 @@ comment "Frame buffer hardware drivers" + + config FB_BCM2708 + tristate "BCM2708 framebuffer support" +- depends on FB && ARM && BCM2708_MBOX ++ depends on FB && RASPBERRYPI_FIRMWARE + select FB_CFB_FILLRECT + select FB_CFB_COPYAREA + select FB_CFB_IMAGEBLIT + +From eca36789db0d78a939c6520e28bbb7f7e8ea1442 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 24 Jul 2015 19:33:46 +0200 +Subject: [PATCH 144/149] vc_mem: Remove unnecessary include +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Noralf Trønnes +--- + drivers/char/broadcom/vc_mem.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/char/broadcom/vc_mem.c b/drivers/char/broadcom/vc_mem.c +index fcde6b1..be64f23 100644 +--- a/drivers/char/broadcom/vc_mem.c ++++ b/drivers/char/broadcom/vc_mem.c +@@ -22,7 +22,6 @@ + #include + #include + #include +-#include + #include + + #define DRIVER_NAME "vc-mem" + +From 89df011c7e129660df28ee2bc7744f8ff60ed316 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 24 Jul 2015 19:34:06 +0200 +Subject: [PATCH 145/149] configs: Remove BCM2708_MBOX +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Noralf Trønnes +--- + arch/arm/configs/bcm2709_defconfig | 1 - + arch/arm/configs/bcm2835_defconfig | 1 - + arch/arm/configs/bcmrpi_defconfig | 1 - + 3 files changed, 3 deletions(-) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index dd00e7c..e3155da 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -1078,7 +1078,6 @@ CONFIG_FB_TFT_WATTEROTT=m + CONFIG_FB_FLEX=m + CONFIG_FB_TFT_FBTFT_DEVICE=m + CONFIG_MAILBOX=y +-CONFIG_BCM2708_MBOX=y + CONFIG_BCM2835_MBOX=y + # CONFIG_IOMMU_SUPPORT is not set + CONFIG_EXTCON=m +diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig +index 14ef294..24d4df6 100644 +--- a/arch/arm/configs/bcm2835_defconfig ++++ b/arch/arm/configs/bcm2835_defconfig +@@ -1065,7 +1065,6 @@ CONFIG_FB_TFT_WATTEROTT=m + CONFIG_FB_FLEX=m + CONFIG_FB_TFT_FBTFT_DEVICE=m + CONFIG_MAILBOX=y +-CONFIG_BCM2708_MBOX=y + CONFIG_BCM2835_MBOX=y + # CONFIG_IOMMU_SUPPORT is not set + CONFIG_EXTCON=m +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 7b24274..0859113 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -1071,7 +1071,6 @@ CONFIG_FB_TFT_WATTEROTT=m + CONFIG_FB_FLEX=m + CONFIG_FB_TFT_FBTFT_DEVICE=m + CONFIG_MAILBOX=y +-CONFIG_BCM2708_MBOX=y + CONFIG_BCM2835_MBOX=y + # CONFIG_IOMMU_SUPPORT is not set + CONFIG_EXTCON=m + +From 73e04a4d5c4e57aa0874fa5e79688e2b8eb6d0f8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 24 Jul 2015 19:34:31 +0200 +Subject: [PATCH 146/149] bcm2708-vcio: Remove module +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +All drivers have been converted to the new firmware API, so this +module is not needed anymore. + +Signed-off-by: Noralf Trønnes +--- + drivers/mailbox/Kconfig | 6 -- + drivers/mailbox/Makefile | 2 - + drivers/mailbox/bcm2708-vcio.c | 86 ----------------- + include/linux/platform_data/mailbox-bcm2708.h | 127 -------------------------- + 4 files changed, 221 deletions(-) + delete mode 100644 drivers/mailbox/bcm2708-vcio.c + delete mode 100644 include/linux/platform_data/mailbox-bcm2708.h + +diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig +index d1a6671..3965e10 100644 +--- a/drivers/mailbox/Kconfig ++++ b/drivers/mailbox/Kconfig +@@ -7,12 +7,6 @@ menuconfig MAILBOX + + if MAILBOX + +-config BCM2708_MBOX +- bool "Broadcom BCM2708 Mailbox (vcio)" +- depends on BCM2835_MBOX +- help +- Broadcom BCM2708 Mailbox (vcio) +- + config ARM_MHU + tristate "ARM MHU Mailbox" + depends on ARM_AMBA +diff --git a/drivers/mailbox/Makefile b/drivers/mailbox/Makefile +index c86bc91..8e6d822 100644 +--- a/drivers/mailbox/Makefile ++++ b/drivers/mailbox/Makefile +@@ -2,8 +2,6 @@ + + obj-$(CONFIG_MAILBOX) += mailbox.o + +-obj-$(CONFIG_BCM2708_MBOX) += bcm2708-vcio.o +- + obj-$(CONFIG_ARM_MHU) += arm_mhu.o + + obj-$(CONFIG_PL320_MBOX) += pl320-ipc.o +diff --git a/drivers/mailbox/bcm2708-vcio.c b/drivers/mailbox/bcm2708-vcio.c +deleted file mode 100644 +index 2e4031b..0000000 +--- a/drivers/mailbox/bcm2708-vcio.c ++++ /dev/null +@@ -1,86 +0,0 @@ +-/* +- * Copyright (C) 2010 Broadcom +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License version 2 as +- * published by the Free Software Foundation. +- * +- * This device provides a shared mechanism for writing to the mailboxes, +- * semaphores, doorbells etc. that are shared between the ARM and the +- * VideoCore processor +- */ +- +-#include +-#include +-#include +-#include +-#include +-#include +- +-#define DRIVER_NAME "bcm2708_vcio" +- +-extern int bcm_mailbox_write(unsigned chan, uint32_t data28) +-{ +- struct rpi_firmware *fw = rpi_firmware_get(NULL); +- +- if (!fw) +- return -ENODEV; +- +- return rpi_firmware_transaction(fw, chan, data28); +-} +-EXPORT_SYMBOL_GPL(bcm_mailbox_write); +- +-extern int bcm_mailbox_read(unsigned chan, uint32_t *data28) +-{ +- struct rpi_firmware *fw = rpi_firmware_get(NULL); +- +- if (!fw) +- return -ENODEV; +- +- *data28 = rpi_firmware_transaction_received(fw); +- +- return 0; +-} +-EXPORT_SYMBOL_GPL(bcm_mailbox_read); +- +-static DEFINE_MUTEX(mailbox_lock); +-extern int bcm_mailbox_property(void *data, int size) +-{ +- uint32_t success; +- dma_addr_t mem_bus; /* the memory address accessed from videocore */ +- void *mem_kern; /* the memory address accessed from driver */ +- int s = 0; +- +- mutex_lock(&mailbox_lock); +- /* allocate some memory for the messages communicating with GPU */ +- mem_kern = dma_alloc_coherent(NULL, PAGE_ALIGN(size), &mem_bus, +- GFP_KERNEL); +- if (mem_kern) { +- /* create the message */ +- memcpy(mem_kern, data, size); +- +- /* send the message */ +- wmb(); +- s = bcm_mailbox_write(MBOX_CHAN_PROPERTY, (uint32_t)mem_bus); +- if (s == 0) +- s = bcm_mailbox_read(MBOX_CHAN_PROPERTY, &success); +- if (s == 0) { +- /* copy the response */ +- rmb(); +- memcpy(data, mem_kern, size); +- } +- dma_free_coherent(NULL, PAGE_ALIGN(size), mem_kern, mem_bus); +- } else { +- s = -ENOMEM; +- } +- if (s != 0) +- pr_err(DRIVER_NAME ": %s failed (%d)\n", __func__, s); +- +- mutex_unlock(&mailbox_lock); +- return s; +-} +-EXPORT_SYMBOL_GPL(bcm_mailbox_property); +- +-MODULE_AUTHOR("Gray Girling"); +-MODULE_DESCRIPTION("ARM I/O to VideoCore processor"); +-MODULE_LICENSE("GPL"); +diff --git a/include/linux/platform_data/mailbox-bcm2708.h b/include/linux/platform_data/mailbox-bcm2708.h +deleted file mode 100644 +index d3ea839..0000000 +--- a/include/linux/platform_data/mailbox-bcm2708.h ++++ /dev/null +@@ -1,127 +0,0 @@ +-/* +- * Copyright (C) 2010 Broadcom +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- */ +-#ifndef _PLAT_MAILBOX_BCM2708_H +-#define _PLAT_MAILBOX_BCM2708_H +- +-/* Routines to handle I/O via the VideoCore "ARM control" registers +- * (semaphores, doorbells, mailboxes) +- */ +- +-/* Constants shared with the ARM identifying separate mailbox channels */ +-#define MBOX_CHAN_POWER 0 /* for use by the power management interface */ +-#define MBOX_CHAN_FB 1 /* for use by the frame buffer */ +-#define MBOX_CHAN_VCHIQ 3 /* for use by the VCHIQ interface */ +-#define MBOX_CHAN_PROPERTY 8 /* for use by the property channel */ +-#define MBOX_CHAN_COUNT 9 +- +-enum { +- VCMSG_PROCESS_REQUEST = 0x00000000 +-}; +- +-enum { +- VCMSG_REQUEST_SUCCESSFUL = 0x80000000, +- VCMSG_REQUEST_FAILED = 0x80000001 +-}; +- +-/* Mailbox property tags */ +-enum { +- VCMSG_PROPERTY_END = 0x00000000, +- VCMSG_GET_FIRMWARE_REVISION = 0x00000001, +- VCMSG_GET_BOARD_MODEL = 0x00010001, +- VCMSG_GET_BOARD_REVISION = 0x00010002, +- VCMSG_GET_BOARD_MAC_ADDRESS = 0x00010003, +- VCMSG_GET_BOARD_SERIAL = 0x00010004, +- VCMSG_GET_ARM_MEMORY = 0x00010005, +- VCMSG_GET_VC_MEMORY = 0x00010006, +- VCMSG_GET_CLOCKS = 0x00010007, +- VCMSG_GET_COMMAND_LINE = 0x00050001, +- VCMSG_GET_DMA_CHANNELS = 0x00060001, +- VCMSG_GET_POWER_STATE = 0x00020001, +- VCMSG_GET_TIMING = 0x00020002, +- VCMSG_SET_POWER_STATE = 0x00028001, +- VCMSG_GET_CLOCK_STATE = 0x00030001, +- VCMSG_SET_CLOCK_STATE = 0x00038001, +- VCMSG_GET_CLOCK_RATE = 0x00030002, +- VCMSG_SET_CLOCK_RATE = 0x00038002, +- VCMSG_GET_VOLTAGE = 0x00030003, +- VCMSG_SET_VOLTAGE = 0x00038003, +- VCMSG_GET_MAX_CLOCK = 0x00030004, +- VCMSG_GET_MAX_VOLTAGE = 0x00030005, +- VCMSG_GET_TEMPERATURE = 0x00030006, +- VCMSG_GET_MIN_CLOCK = 0x00030007, +- VCMSG_GET_MIN_VOLTAGE = 0x00030008, +- VCMSG_GET_TURBO = 0x00030009, +- VCMSG_GET_MAX_TEMPERATURE = 0x0003000a, +- VCMSG_GET_STC = 0x0003000b, +- VCMSG_SET_TURBO = 0x00038009, +- VCMSG_SET_ALLOCATE_MEM = 0x0003000c, +- VCMSG_SET_LOCK_MEM = 0x0003000d, +- VCMSG_SET_UNLOCK_MEM = 0x0003000e, +- VCMSG_SET_RELEASE_MEM = 0x0003000f, +- VCMSG_SET_EXECUTE_CODE = 0x00030010, +- VCMSG_SET_EXECUTE_QPU = 0x00030011, +- VCMSG_SET_ENABLE_QPU = 0x00030012, +- VCMSG_GET_RESOURCE_HANDLE = 0x00030014, +- VCMSG_GET_EDID_BLOCK = 0x00030020, +- VCMSG_GET_CUSTOMER_OTP = 0x00030021, +- VCMSG_SET_CUSTOMER_OTP = 0x00038021, +- VCMSG_SET_ALLOCATE_BUFFER = 0x00040001, +- VCMSG_SET_RELEASE_BUFFER = 0x00048001, +- VCMSG_SET_BLANK_SCREEN = 0x00040002, +- VCMSG_TST_BLANK_SCREEN = 0x00044002, +- VCMSG_GET_PHYSICAL_WIDTH_HEIGHT = 0x00040003, +- VCMSG_TST_PHYSICAL_WIDTH_HEIGHT = 0x00044003, +- VCMSG_SET_PHYSICAL_WIDTH_HEIGHT = 0x00048003, +- VCMSG_GET_VIRTUAL_WIDTH_HEIGHT = 0x00040004, +- VCMSG_TST_VIRTUAL_WIDTH_HEIGHT = 0x00044004, +- VCMSG_SET_VIRTUAL_WIDTH_HEIGHT = 0x00048004, +- VCMSG_GET_DEPTH = 0x00040005, +- VCMSG_TST_DEPTH = 0x00044005, +- VCMSG_SET_DEPTH = 0x00048005, +- VCMSG_GET_PIXEL_ORDER = 0x00040006, +- VCMSG_TST_PIXEL_ORDER = 0x00044006, +- VCMSG_SET_PIXEL_ORDER = 0x00048006, +- VCMSG_GET_ALPHA_MODE = 0x00040007, +- VCMSG_TST_ALPHA_MODE = 0x00044007, +- VCMSG_SET_ALPHA_MODE = 0x00048007, +- VCMSG_GET_PITCH = 0x00040008, +- VCMSG_TST_PITCH = 0x00044008, +- VCMSG_SET_PITCH = 0x00048008, +- VCMSG_GET_VIRTUAL_OFFSET = 0x00040009, +- VCMSG_TST_VIRTUAL_OFFSET = 0x00044009, +- VCMSG_SET_VIRTUAL_OFFSET = 0x00048009, +- VCMSG_GET_OVERSCAN = 0x0004000a, +- VCMSG_TST_OVERSCAN = 0x0004400a, +- VCMSG_SET_OVERSCAN = 0x0004800a, +- VCMSG_GET_PALETTE = 0x0004000b, +- VCMSG_TST_PALETTE = 0x0004400b, +- VCMSG_SET_PALETTE = 0x0004800b, +- VCMSG_GET_LAYER = 0x0004000c, +- VCMSG_TST_LAYER = 0x0004400c, +- VCMSG_SET_LAYER = 0x0004800c, +- VCMSG_GET_TRANSFORM = 0x0004000d, +- VCMSG_TST_TRANSFORM = 0x0004400d, +- VCMSG_SET_TRANSFORM = 0x0004800d, +- VCMSG_TST_VSYNC = 0x0004400e, +- VCMSG_SET_VSYNC = 0x0004800e, +- VCMSG_GET_TOUCHBUF = 0x0004000f, +- VCMSG_SET_CURSOR_INFO = 0x00008010, +- VCMSG_SET_CURSOR_STATE = 0x00008011, +-}; +- +-int bcm_mailbox_read(unsigned chan, uint32_t *data28); +-int bcm_mailbox_write(unsigned chan, uint32_t data28); +-int bcm_mailbox_property(void *data, int size); +- +-#endif + +From f69941fbc0eb961fbf580165ad5022e26095db49 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 24 Jul 2015 19:34:55 +0200 +Subject: [PATCH 147/149] Revert "firmware: bcm2835: Support legacy mailbox + API" +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This reverts commit 40aa3c4f0c430cd5c574498f4d1d5e9f0bc1cf11. + +The legacy mailbox API has been removed so this is not needed. + +Signed-off-by: Noralf Trønnes +--- + drivers/firmware/raspberrypi.c | 15 ++------------- + include/soc/bcm2835/raspberrypi-firmware.h | 2 -- + 2 files changed, 2 insertions(+), 15 deletions(-) + +diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c +index 89421a9..b980d53 100644 +--- a/drivers/firmware/raspberrypi.c ++++ b/drivers/firmware/raspberrypi.c +@@ -19,7 +19,6 @@ + #define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf)) + #define MBOX_CHAN(msg) ((msg) & 0xf) + #define MBOX_DATA28(msg) ((msg) & ~0xf) +-#define MBOX_CHAN_VCHIQ 3 + #define MBOX_CHAN_PROPERTY 8 + + struct rpi_firmware { +@@ -27,7 +26,6 @@ struct rpi_firmware { + struct mbox_chan *chan; /* The property channel. */ + struct completion c; + u32 enabled; +- u32 received; + }; + + static struct platform_device *g_pdev; +@@ -37,7 +35,6 @@ static DEFINE_MUTEX(transaction_lock); + static void response_callback(struct mbox_client *cl, void *msg) + { + struct rpi_firmware *fw = container_of(cl, struct rpi_firmware, cl); +- fw->received = *(u32 *)msg; + complete(&fw->c); + } + +@@ -45,7 +42,7 @@ static void response_callback(struct mbox_client *cl, void *msg) + * Sends a request to the firmware through the BCM2835 mailbox driver, + * and synchronously waits for the reply. + */ +-int ++static int + rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data) + { + u32 message = MBOX_MSG(chan, data); +@@ -57,8 +54,7 @@ rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data) + reinit_completion(&fw->c); + ret = mbox_send_message(fw->chan, &message); + if (ret >= 0) { +- if (chan != MBOX_CHAN_VCHIQ) +- wait_for_completion(&fw->c); ++ wait_for_completion(&fw->c); + ret = 0; + } else { + dev_err(fw->cl.dev, "mbox_send_message returned %d\n", ret); +@@ -67,13 +63,6 @@ rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data) + + return ret; + } +-EXPORT_SYMBOL(rpi_firmware_transaction); +- +-u32 rpi_firmware_transaction_received(struct rpi_firmware *fw) +-{ +- return MBOX_DATA28(fw->received); +-} +-EXPORT_SYMBOL(rpi_firmware_transaction_received); + + /** + * rpi_firmware_property_list - Submit firmware property list +diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h +index 9a08cf1..d3933af 100644 +--- a/include/soc/bcm2835/raspberrypi-firmware.h ++++ b/include/soc/bcm2835/raspberrypi-firmware.h +@@ -116,8 +116,6 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001, + }; + +-int rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data); +-u32 rpi_firmware_transaction_received(struct rpi_firmware *fw); + int rpi_firmware_property(struct rpi_firmware *fw, + u32 tag, void *data, size_t len); + int rpi_firmware_property_list(struct rpi_firmware *fw, + +From 63de8df89946ca2bf9e663941c6d9108d212d1ba Mon Sep 17 00:00:00 2001 +From: Jonathan Bell +Date: Tue, 30 Jun 2015 12:35:39 +0100 +Subject: [PATCH 148/149] pinctrl: bcm2835: Clear the event latch register when + disabling interrupts + +It's possible to hit a race condition if interrupts are generated on a GPIO +pin when the IRQ line in question is being disabled. + +If the interrupt is freed, bcm2835_gpio_irq_disable() is called which +disables the event generation sources (edge, level). If an event occurred +between the last disabling of hard IRQs and the write to the event +source registers, a bit would be set in the GPIO event detect register +(GPEDSn) which goes unacknowledged by bcm2835_gpio_irq_handler() +so Linux complains loudly. + +There is no per-GPIO mask register, so when disabling GPIO interrupts +write 1 to the relevant bit in GPEDSn to clear out any stale events. + +Signed-off-by: Jonathan Bell +Acked-by: Stephen Warren +Signed-off-by: Linus Walleij +--- + drivers/pinctrl/bcm/pinctrl-bcm2835.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +index 986779a..61ef002 100644 +--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c ++++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +@@ -503,6 +503,8 @@ static void bcm2835_gpio_irq_disable(struct irq_data *data) + + spin_lock_irqsave(&pc->irq_lock[bank], flags); + bcm2835_gpio_irq_config(pc, gpio, false); ++ /* Clear events that were latched prior to clearing event sources */ ++ bcm2835_gpio_set_bit(pc, GPEDS0, gpio); + clear_bit(offset, &pc->enabled_irq_map[bank]); + spin_unlock_irqrestore(&pc->irq_lock[bank], flags); + } + +From 8dcf91adc86b5ee16627c8fe777b4e2f5ca4efc1 Mon Sep 17 00:00:00 2001 +From: P33M +Date: Tue, 4 Aug 2015 01:15:20 +0100 +Subject: [PATCH 149/149] dwc_otg: fiq_fsm: Make high-speed isochronous strided + transfers work properly + +Certain low-bandwidth high-speed USB devices (specialist audio devices, +compressed-frame webcams) have packet intervals > 1 microframe. + +Stride these transfers in the FIQ by using the start-of-frame interrupt +to restart the channel at the right time. +--- + drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c | 17 +++++++++++++---- + drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h | 5 ++++- + drivers/usb/host/dwc_otg/dwc_otg_hcd.c | 7 ++++++- + drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 6 ++++-- + 4 files changed, 27 insertions(+), 8 deletions(-) + +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c +index 7e0c726..85d82f3 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c +@@ -615,8 +615,11 @@ static int notrace noinline fiq_fsm_do_sof(struct fiq_state *state, int num_chan + break; + + case FIQ_HS_ISOC_SLEEPING: +- state->channel[n].fsm = FIQ_HS_ISOC_TURBO; +- fiq_fsm_restart_channel(state, n, 0); ++ /* Is it time to wake this channel yet? */ ++ if (--state->channel[n].uframe_sleeps == 0) { ++ state->channel[n].fsm = FIQ_HS_ISOC_TURBO; ++ fiq_fsm_restart_channel(state, n, 0); ++ } + break; + + case FIQ_PER_SSPLIT_QUEUED: +@@ -624,7 +627,7 @@ static int notrace noinline fiq_fsm_do_sof(struct fiq_state *state, int num_chan + break; + if(!fiq_fsm_tt_in_use(state, num_channels, n)) { + if (!fiq_fsm_too_late(state, n)) { +- fiq_print(FIQDBG_INT, st, "SOF GO %01d", n); ++ fiq_print(FIQDBG_INT, state, "SOF GO %01d", n); + fiq_fsm_restart_channel(state, n, 0); + state->channel[n].fsm = FIQ_PER_SSPLIT_STARTED; + } else { +@@ -1069,8 +1072,14 @@ static int notrace noinline fiq_fsm_do_hcintr(struct fiq_state *state, int num_c + if (fiq_fsm_update_hs_isoc(state, n, hcint)) { + /* more transactions to come */ + handled = 1; +- restart = 1; + fiq_print(FIQDBG_INT, state, "HSISO M "); ++ /* For strided transfers, put ourselves to sleep */ ++ if (st->hs_isoc_info.stride > 1) { ++ st->uframe_sleeps = st->hs_isoc_info.stride - 1; ++ st->fsm = FIQ_HS_ISOC_SLEEPING; ++ } else { ++ restart = 1; ++ } + } else { + st->fsm = FIQ_HS_ISOC_DONE; + fiq_print(FIQDBG_INT, state, "HSISO F "); +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h +index 8455324..f9fddfb 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h ++++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h +@@ -260,12 +260,13 @@ struct fiq_dma_blob { + * @iso_frame: Pointer to the array of OTG URB iso_frame_descs. + * @nrframes: Total length of iso_frame_desc array + * @index: Current index (FIQ-maintained) +- * ++ * @stride: Interval in uframes between HS isoc transactions + */ + struct fiq_hs_isoc_info { + struct dwc_otg_hcd_iso_packet_desc *iso_desc; + unsigned int nrframes; + unsigned int index; ++ unsigned int stride; + }; + + /** +@@ -296,6 +297,8 @@ struct fiq_channel_state { + /* Hardware bug workaround: sometimes channel halt interrupts are + * delayed until the next SOF. Keep track of when we expected to get interrupted. */ + unsigned int expected_uframe; ++ /* number of uframes remaining (for interval > 1 HS isoc transfers) before next transfer */ ++ unsigned int uframe_sleeps; + /* in/out for communicating number of dma buffers used, or number of ISOC to do */ + unsigned int nrpackets; + struct fiq_dma_info dma_info; +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c +index 4d7c7bb..135b611 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c +@@ -1678,6 +1678,9 @@ int fiq_fsm_queue_isoc_transaction(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) + } + } + ++ st->hs_isoc_info.stride = qh->interval; ++ st->uframe_sleeps = 0; ++ + fiq_print(FIQDBG_INT, hcd->fiq_state, "FSMQ %01d ", hc->hc_num); + fiq_print(FIQDBG_INT, hcd->fiq_state, "%08x", st->hcchar_copy.d32); + fiq_print(FIQDBG_INT, hcd->fiq_state, "%08x", st->hctsiz_copy.d32); +@@ -1692,9 +1695,11 @@ int fiq_fsm_queue_isoc_transaction(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) + DWC_WRITE_REG32(&hc_regs->hcintmsk, st->hcintmsk_copy.d32); + if (hfnum.b.frrem < PERIODIC_FRREM_BACKOFF) { + /* Prevent queueing near EOF1. Bad things happen if a periodic +- * split transaction is queued very close to EOF. ++ * split transaction is queued very close to EOF. SOF interrupt handler ++ * will wake this channel at the next interrupt. + */ + st->fsm = FIQ_HS_ISOC_SLEEPING; ++ st->uframe_sleeps = 1; + } else { + st->fsm = FIQ_HS_ISOC_TURBO; + st->hcchar_copy.b.chen = 1; +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +index 3f71f29..8db3dfc 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +@@ -2297,10 +2297,10 @@ void dwc_otg_fiq_unmangle_isoc(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh, dwc_otg_qtd + dwc_urb->error_count++; + } + } ++ qh->sched_frame = dwc_frame_num_inc(qh->sched_frame, qh->interval * (nr_frames - 1)); ++ + //printk_ratelimited(KERN_INFO "%s: HS isochronous of %d/%d frames with %d errors complete\n", + // __FUNCTION__, i, dwc_urb->packet_count, dwc_urb->error_count); +- hcd->fops->complete(hcd, dwc_urb->priv, dwc_urb, 0); +- release_channel(hcd, qh->channel, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); + } + + /** +@@ -2543,6 +2543,8 @@ void dwc_otg_hcd_handle_hc_fsm(dwc_otg_hcd_t *hcd, uint32_t num) + * fail. + */ + dwc_otg_fiq_unmangle_isoc(hcd, qh, qtd, num); ++ hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, 0); ++ release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); + break; + + case FIQ_PER_SPLIT_LS_ABORTED: diff --git a/projects/WeTek_Play/linux/linux.arm.conf b/projects/WeTek_Play/linux/linux.arm.conf index ef3cf00927..a573d01e82 100644 --- a/projects/WeTek_Play/linux/linux.arm.conf +++ b/projects/WeTek_Play/linux/linux.arm.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 3.10.61 Kernel Configuration +# Linux/arm 3.10.76 Kernel Configuration # CONFIG_ARM=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y @@ -1613,19 +1613,19 @@ CONFIG_TUN=y # CONFIG_MDIO_BUS_MUX_GPIO is not set # CONFIG_MDIO_BUS_MUX_MMIOREG is not set # CONFIG_MICREL_KS8995MA is not set -CONFIG_PPP=y +CONFIG_PPP=m CONFIG_PPP_BSDCOMP=m CONFIG_PPP_DEFLATE=m # CONFIG_PPP_FILTER is not set CONFIG_PPP_MPPE=m # CONFIG_PPP_MULTILINK is not set CONFIG_PPPOE=m -CONFIG_PPPOLAC=y -CONFIG_PPPOPNS=y +CONFIG_PPPOLAC=m +CONFIG_PPPOPNS=m CONFIG_PPP_ASYNC=m # CONFIG_PPP_SYNC_TTY is not set # CONFIG_SLIP is not set -CONFIG_SLHC=y +CONFIG_SLHC=m # # USB Network Adapters diff --git a/projects/WeTek_Play/patches/linux/203-wetek-dvb-less-log-spam.patch b/projects/WeTek_Play/patches/linux/203-wetek-dvb-less-log-spam.patch new file mode 100644 index 0000000000..d3e00d1776 --- /dev/null +++ b/projects/WeTek_Play/patches/linux/203-wetek-dvb-less-log-spam.patch @@ -0,0 +1,175 @@ +From 8b7d9e995c6af7ac0a5ae231afcf02790d99b671 Mon Sep 17 00:00:00 2001 +From: Stefan Saraev +Date: Fri, 7 Aug 2015 15:03:23 +0300 +Subject: [PATCH] wetek/dvb: less log spam + +--- + drivers/amlogic/wetek/avl6211.c | 8 ++++---- + drivers/amlogic/wetek/cxd2837.c | 18 +++++++++--------- + drivers/amlogic/wetek/mn88436.c | 2 +- + drivers/amlogic/wetek/mxl603.c | 4 ++-- + 4 files changed, 16 insertions(+), 16 deletions(-) + +diff --git a/drivers/amlogic/wetek/avl6211.c b/drivers/amlogic/wetek/avl6211.c +index 0bb0f23..74eb19f 100644 +--- a/drivers/amlogic/wetek/avl6211.c ++++ b/drivers/amlogic/wetek/avl6211.c +@@ -628,7 +628,7 @@ static int av2011_lock(struct dvb_frontend* fe) + BW = 40000; + BF = (BW * 127 + 21100/2) / 21100; + +- dev_info(&state->i2c->dev, "BF is %d,BW is %d\n", BF, BW); ++ dev_dbg(&state->i2c->dev, "BF is %d,BW is %d\n", BF, BW); + + reg[5] = (u8)BF; + +@@ -1578,7 +1578,7 @@ static int avl6211_set_frontend(struct dvb_frontend* fe) + + state->locked = 0; + +- dev_info(&state->i2c->dev, ++ dev_dbg(&state->i2c->dev, + "%s: delivery_system=%d frequency=%d symbol_rate=%d\n", + __func__, c->delivery_system, c->frequency, c->symbol_rate); + +@@ -1611,7 +1611,7 @@ static int avl6211_set_frontend(struct dvb_frontend* fe) + goto err; + } + +- dev_info(&state->i2c->dev, "Tuner successfully lock!\n"); ++ dev_dbg(&state->i2c->dev, "Tuner successfully lock!\n"); + + state->flags = (CI_FLAG_IQ_NO_SWAPPED) << CI_FLAG_IQ_BIT; //Normal IQ + state->flags |= (CI_FLAG_IQ_AUTO_BIT_AUTO) << CI_FLAG_IQ_AUTO_BIT; //Enable automatic IQ swap detection +@@ -1644,7 +1644,7 @@ static int avl6211_set_frontend(struct dvb_frontend* fe) + ret = -EAGAIN; + goto err; + } +- dev_info(&state->i2c->dev, "Service locked!!!\n"); ++ dev_dbg(&state->i2c->dev, "Service locked!!!\n"); + + ret = avl6211_send_op(OP_RX_RESET_BERPER, state); + if (ret) +diff --git a/drivers/amlogic/wetek/cxd2837.c b/drivers/amlogic/wetek/cxd2837.c +index 0638f38..33658d5 100644 +--- a/drivers/amlogic/wetek/cxd2837.c ++++ b/drivers/amlogic/wetek/cxd2837.c +@@ -795,7 +795,7 @@ static int set_parameters(struct dvb_frontend *fe) + fe_status_t status; + ret = read_status(fe, &status); + if (!ret && status == 0x1F) { +- dev_info(&state->i2c->dev, "Ignoring tuning to same freq, allready locked!\n"); ++ dev_dbg(&state->i2c->dev, "Ignoring tuning to same freq, allready locked!\n"); + return 0; + } + } +@@ -1056,7 +1056,7 @@ static int get_ber_t(struct cxd_state *state, u32 *ber) + unfreeze_regst(state); + + if (!(BERRegs[0] & 0x10)) { +- dev_info(&state->i2c->dev, "%s: no valid BER data\n", __func__); ++ dev_dbg(&state->i2c->dev, "%s: no valid BER data\n", __func__); + return 0; + } + +@@ -1093,7 +1093,7 @@ static int get_ber_t2(struct cxd_state *state, u32 *ber) + unfreeze_regst(state); + + if (!(BERRegs[0] & 0x10)) { +- dev_info(&state->i2c->dev, "%s: no valid BER data\n", __func__); ++ dev_dbg(&state->i2c->dev, "%s: no valid BER data\n", __func__); + return 0; + } + +@@ -1102,7 +1102,7 @@ static int get_ber_t2(struct cxd_state *state, u32 *ber) + n_ldpc = ((plp & 0x03) == 0 ? 16200 : 64800); + + if (bitError > ((1U << periodExp) * n_ldpc)) { +- dev_info(&state->i2c->dev, "%s: invalid BER value\n", __func__); ++ dev_dbg(&state->i2c->dev, "%s: invalid BER value\n", __func__); + return -EINVAL; + } + +@@ -1142,7 +1142,7 @@ static int get_ber_c(struct cxd_state *state, u32 *ber) + + + if ((BERRegs[0] & 0x80) == 0) { +- dev_info(&state->i2c->dev, "%s: no valid BER data\n", __func__); ++ dev_dbg(&state->i2c->dev, "%s: no valid BER data\n", __func__); + return 0; + } + +@@ -1150,7 +1150,7 @@ static int get_ber_c(struct cxd_state *state, u32 *ber) + periodExp = (Scale & 0x1F); + + if ((periodExp <= 11) && (bitError > (1U << periodExp) * 204 * 8)) { +- dev_info(&state->i2c->dev, "%s: invalid BER value\n", __func__); ++ dev_dbg(&state->i2c->dev, "%s: invalid BER value\n", __func__); + return -EINVAL; + } + +@@ -1223,7 +1223,7 @@ static void GetSignalToNoiseT2(struct cxd_state *state, int *SignalToNoise) + + reg = ((u32)Data[0] << 8) | (u32)Data[1]; + if (reg == 0) { +- dev_info(&state->i2c->dev, "%s(): reg value out of range\n", __func__); ++ dev_dbg(&state->i2c->dev, "%s(): reg value out of range\n", __func__); + return; + } + if (reg > 10876) +@@ -1245,7 +1245,7 @@ static void GetSignalToNoiseT(struct cxd_state *state, int *SignalToNoise) + + reg = ((u32)Data[0] << 8) | (u32)Data[1]; + if (reg == 0) { +- dev_info(&state->i2c->dev, "%s(): reg value out of range\n", __func__); ++ dev_dbg(&state->i2c->dev, "%s(): reg value out of range\n", __func__); + return; + } + if (reg > 4996) +@@ -1272,7 +1272,7 @@ static void GetSignalToNoiseC(struct cxd_state *state, int *SignalToNoise) + + reg = ((u32)(Data[0] & 0x1F) << 8) | ((u32)Data[1]); + if (reg == 0) { +- dev_info(&state->i2c->dev, "%s(): reg value out of range\n", __func__); ++ dev_dbg(&state->i2c->dev, "%s(): reg value out of range\n", __func__); + return; + } + +diff --git a/drivers/amlogic/wetek/mn88436.c b/drivers/amlogic/wetek/mn88436.c +index 7d49d44..2ee5990 100644 +--- a/drivers/amlogic/wetek/mn88436.c ++++ b/drivers/amlogic/wetek/mn88436.c +@@ -168,7 +168,7 @@ static int mn88436_set_frontend(struct dvb_frontend* fe) + goto err; + } + +- dev_info(&state->i2c->dev, "Service locked!!!\n"); ++ dev_dbg(&state->i2c->dev, "Service locked!!!\n"); + + state->current_frequency = p->frequency; + state->current_modulation = p->modulation; +diff --git a/drivers/amlogic/wetek/mxl603.c b/drivers/amlogic/wetek/mxl603.c +index 8f18fb5..2fb2ad3 100644 +--- a/drivers/amlogic/wetek/mxl603.c ++++ b/drivers/amlogic/wetek/mxl603.c +@@ -798,7 +798,7 @@ static int mxl603_get_status(struct dvb_frontend *fe, u32 *status) + if (ret) + goto err; + +- dev_info(&state->i2c->dev, "%s%s", rf_locked ? "rf locked " : "", ++ dev_dbg(&state->i2c->dev, "%s%s", rf_locked ? "rf locked " : "", + ref_locked ? "ref locked" : ""); + + if ((rf_locked) || (ref_locked)) +@@ -827,7 +827,7 @@ static int mxl603_set_params(struct dvb_frontend *fe) + int ret; + u32 freq = c->frequency; + +- dev_info(&state->i2c->dev, ++ dev_dbg(&state->i2c->dev, + "%s: delivery_system=%d frequency=%d bandwidth_hz=%d\n", + __func__, c->delivery_system, c->frequency, c->bandwidth_hz); + +-- +1.7.10.4 + diff --git a/projects/imx6/bootloader/uEnv-udoo_quad.txt b/projects/imx6/bootloader/uEnv-udoo.txt similarity index 100% rename from projects/imx6/bootloader/uEnv-udoo_quad.txt rename to projects/imx6/bootloader/uEnv-udoo.txt diff --git a/projects/imx6/linux/linux.arm.conf b/projects/imx6/linux/linux.arm.conf index f652d3be80..0e8c89e262 100644 --- a/projects/imx6/linux/linux.arm.conf +++ b/projects/imx6/linux/linux.arm.conf @@ -1584,7 +1584,7 @@ CONFIG_BCM87XX_PHY=y # CONFIG_MDIO_BUS_MUX_GPIO is not set # CONFIG_MDIO_BUS_MUX_MMIOREG is not set # CONFIG_MICREL_KS8995MA is not set -CONFIG_PPP=y +CONFIG_PPP=m CONFIG_PPP_BSDCOMP=m CONFIG_PPP_DEFLATE=m # CONFIG_PPP_FILTER is not set @@ -1594,7 +1594,7 @@ CONFIG_PPPOE=m CONFIG_PPP_ASYNC=m # CONFIG_PPP_SYNC_TTY is not set # CONFIG_SLIP is not set -CONFIG_SLHC=y +CONFIG_SLHC=m # # USB Network Adapters diff --git a/projects/imx6/options b/projects/imx6/options index 74efdb35d6..5eba879565 100644 --- a/projects/imx6/options +++ b/projects/imx6/options @@ -43,7 +43,7 @@ # Configuration for u-boot UBOOT_CONFIG="mx6_cubox-i_config" UBOOT_CONFIG="$UBOOT_CONFIG matrix" - UBOOT_CONFIG="$UBOOT_CONFIG udoo_quad_config" + UBOOT_CONFIG="$UBOOT_CONFIG udoo_config" # Target Configfile for u-boot UBOOT_CONFIGFILE="" @@ -55,7 +55,7 @@ KERNEL_UBOOT_EXTRA_TARGET="imx6q-cubox-i.dtb imx6dl-cubox-i.dtb" KERNEL_UBOOT_EXTRA_TARGET="$KERNEL_UBOOT_EXTRA_TARGET imx6q-hummingboard.dtb imx6dl-hummingboard.dtb" KERNEL_UBOOT_EXTRA_TARGET="$KERNEL_UBOOT_EXTRA_TARGET imx6q-tbs2910.dtb" - KERNEL_UBOOT_EXTRA_TARGET="$KERNEL_UBOOT_EXTRA_TARGET imx6q-udoo.dtb" + KERNEL_UBOOT_EXTRA_TARGET="$KERNEL_UBOOT_EXTRA_TARGET imx6q-udoo.dtb imx6dl-udoo.dtb" # Additional kernel make parameters (for example to specify the u-boot loadaddress) KERNEL_MAKE_EXTRACMD="" diff --git a/projects/imx6/patches/linux/linux-331-udoo-device_tree.patch b/projects/imx6/patches/linux/linux-331-udoo-device_tree.patch index e124eff268..8cf49e3c76 100644 --- a/projects/imx6/patches/linux/linux-331-udoo-device_tree.patch +++ b/projects/imx6/patches/linux/linux-331-udoo-device_tree.patch @@ -1,111 +1,247 @@ -From 2d08dc140cc5a0db518984a558ae31779ad65ca0 Mon Sep 17 00:00:00 2001 -From: vpeter4 -Date: Thu, 18 Jun 2015 05:33:23 +0200 -Subject: [PATCH] udoo quad device tree +From 688b8f753a832b63f8933cd65486692f8e9abe76 Mon Sep 17 00:00:00 2001 +From: Peter Vicman +Date: Fri, 7 Aug 2015 14:14:37 +0200 +Subject: [PATCH] udoo device tree --- - arch/arm/boot/dts/imx6q-udoo.dts | 452 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 446 insertions(+), 6 deletions(-) + arch/arm/boot/dts/imx6dl-udoo.dts | 23 ++ + arch/arm/boot/dts/imx6q-udoo.dts | 76 +------ + arch/arm/boot/dts/imx6qdl-udoo.dtsi | 443 ++++++++++++++++++++++++++++++++++++ + 3 files changed, 471 insertions(+), 71 deletions(-) + create mode 100644 arch/arm/boot/dts/imx6dl-udoo.dts + create mode 100644 arch/arm/boot/dts/imx6qdl-udoo.dtsi -diff --git a/arch/arm/boot/dts/imx6q-udoo.dts b/arch/arm/boot/dts/imx6q-udoo.dts -index 7cc0267..26e56af 100644 ---- a/arch/arm/boot/dts/imx6q-udoo.dts -+++ b/arch/arm/boot/dts/imx6q-udoo.dts -@@ -2,6 +2,10 @@ - * Copyright 2013 Freescale Semiconductor, Inc. - * - * Author: Fabio Estevam -+ * +diff --git a/arch/arm/boot/dts/imx6dl-udoo.dts b/arch/arm/boot/dts/imx6dl-udoo.dts +new file mode 100644 +index 0000000..45b33fc +--- /dev/null ++++ b/arch/arm/boot/dts/imx6dl-udoo.dts +@@ -0,0 +1,23 @@ ++/* ++ * Copyright 2013 Freescale Semiconductor, Inc. ++ * ++ * Author: Fabio Estevam ++ * + * Copyright (C) 2014 Jasbir + * Copyright (C) 2014 udoo team + * Copyright (C) 2014 vpeter ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++/dts-v1/; ++#include "imx6dl.dtsi" ++#include "imx6qdl-udoo.dtsi" ++ ++/ { ++ model = "Udoo i.MX6 Dual-lite Board"; ++ compatible = "udoo,imx6dl-udoo", "fsl,imx6dl"; ++}; +diff --git a/arch/arm/boot/dts/imx6q-udoo.dts b/arch/arm/boot/dts/imx6q-udoo.dts +index 7cc0267..b4cd8d6 100644 +--- a/arch/arm/boot/dts/imx6q-udoo.dts ++++ b/arch/arm/boot/dts/imx6q-udoo.dts +@@ -3,6 +3,10 @@ * + * Author: Fabio Estevam + * ++ * Copyright (C) 2014 Jasbir ++ * Copyright (C) 2014 udoo team ++ * Copyright (C) 2014 vpeter ++ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as -@@ -17,12 +21,220 @@ + * published by the Free Software Foundation. +@@ -11,83 +15,13 @@ + + /dts-v1/; + #include "imx6q.dtsi" ++#include "imx6qdl-udoo.dtsi" + + / { + model = "Udoo i.MX6 Quad Board"; compatible = "udoo,imx6q-udoo", "fsl,imx6q"; - - chosen { +- +- chosen { - stdout-path = &uart2; -+ stdout-path = &uart1; - }; +- }; +- +- memory { +- reg = <0x10000000 0x40000000>; +- }; +-}; +- +-&fec { +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_enet>; +- phy-mode = "rgmii"; +- status = "okay"; +-}; +- +-&iomuxc { +- imx6q-udoo { +- pinctrl_enet: enetgrp { +- fsl,pins = < +- MX6QDL_PAD_RGMII_RXC__RGMII_RXC 0x1b0b0 +- MX6QDL_PAD_RGMII_RD0__RGMII_RD0 0x1b0b0 +- MX6QDL_PAD_RGMII_RD1__RGMII_RD1 0x1b0b0 +- MX6QDL_PAD_RGMII_RD2__RGMII_RD2 0x1b0b0 +- MX6QDL_PAD_RGMII_RD3__RGMII_RD3 0x1b0b0 +- MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b0b0 +- MX6QDL_PAD_RGMII_TXC__RGMII_TXC 0x1b0b0 +- MX6QDL_PAD_RGMII_TD0__RGMII_TD0 0x1b0b0 +- MX6QDL_PAD_RGMII_TD1__RGMII_TD1 0x1b0b0 +- MX6QDL_PAD_RGMII_TD2__RGMII_TD2 0x1b0b0 +- MX6QDL_PAD_RGMII_TD3__RGMII_TD3 0x1b0b0 +- MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL 0x1b0b0 +- MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK 0x1b0b0 +- MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0 +- MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0 +- MX6QDL_PAD_GPIO_16__ENET_REF_CLK 0x4001b0a8 +- >; +- }; +- +- pinctrl_uart2: uart2grp { +- fsl,pins = < +- MX6QDL_PAD_EIM_D26__UART2_TX_DATA 0x1b0b1 +- MX6QDL_PAD_EIM_D27__UART2_RX_DATA 0x1b0b1 +- >; +- }; +- +- pinctrl_usdhc3: usdhc3grp { +- fsl,pins = < +- MX6QDL_PAD_SD3_CMD__SD3_CMD 0x17059 +- MX6QDL_PAD_SD3_CLK__SD3_CLK 0x10059 +- MX6QDL_PAD_SD3_DAT0__SD3_DATA0 0x17059 +- MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x17059 +- MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x17059 +- MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x17059 +- >; +- }; +- }; + }; -+ aliases { -+ mxcfb0 = &mxcfb1; -+ mxcfb1 = &mxcfb2; -+ mxcfb2 = &mxcfb3; -+ mxcfb3 = &mxcfb4; -+ ssi0 = &ssi1; -+ }; + &sata { + status = "okay"; + }; +- +-&uart2 { +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_uart2>; +- status = "okay"; +-}; +- +-&usdhc3 { +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_usdhc3>; +- non-removable; +- status = "okay"; +-}; +diff --git a/arch/arm/boot/dts/imx6qdl-udoo.dtsi b/arch/arm/boot/dts/imx6qdl-udoo.dtsi +new file mode 100644 +index 0000000..f9ce5ca +--- /dev/null ++++ b/arch/arm/boot/dts/imx6qdl-udoo.dtsi +@@ -0,0 +1,443 @@ ++/* ++ * Copyright 2013 Freescale Semiconductor, Inc. ++ * ++ * Author: Fabio Estevam ++ * ++ * Copyright (C) 2014 Jasbir ++ * Copyright (C) 2014 udoo team ++ * Copyright (C) 2014 vpeter ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ + - memory { - reg = <0x10000000 0x40000000>; - }; ++/ { ++ chosen { ++ stdout-path = &uart1; ++ }; + -+ regulators { -+ compatible = "simple-bus"; ++ aliases { ++ mxcfb0 = &mxcfb1; ++ mxcfb1 = &mxcfb2; ++ mxcfb2 = &mxcfb3; ++ mxcfb3 = &mxcfb4; ++ ssi0 = &ssi1; ++ }; + -+ reg_2p5v: 2p5v { -+ compatible = "regulator-fixed"; -+ regulator-name = "2P5V"; -+ regulator-min-microvolt = <2500000>; -+ regulator-max-microvolt = <2500000>; -+ regulator-always-on; -+ }; ++ memory { ++ reg = <0x10000000 0x40000000>; ++ }; + -+ reg_3p3v: 3p3v { -+ compatible = "regulator-fixed"; -+ regulator-name = "3P3V"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-always-on; -+ }; ++ regulators { ++ compatible = "simple-bus"; + -+ aux_5v: aux5v { -+ compatible = "regulator-fixed"; -+ regulator-name = "AUX_5V"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ gpio = <&gpio6 10 1>; -+ regulator-boot-on; -+ enable-active-high; -+ }; ++ reg_2p5v: 2p5v { ++ compatible = "regulator-fixed"; ++ regulator-name = "2P5V"; ++ regulator-min-microvolt = <2500000>; ++ regulator-max-microvolt = <2500000>; ++ regulator-always-on; ++ }; + -+ reg_sensor: sensor_supply { -+ compatible = "regulator-fixed"; -+ regulator-name = "sensor-SUPPLY"; -+ enable-active-high; -+ }; ++ reg_3p3v: 3p3v { ++ compatible = "regulator-fixed"; ++ regulator-name = "3P3V"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-always-on; ++ }; + -+ reg_usb_otg_vbus: usb_otg_vbus { -+ compatible = "regulator-fixed"; -+ regulator-name = "usb_otg_vbus"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ enable-active-high; -+ }; ++ aux_5v: aux5v { ++ compatible = "regulator-fixed"; ++ regulator-name = "AUX_5V"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ gpio = <&gpio6 10 1>; ++ regulator-boot-on; ++ enable-active-high; ++ }; + -+ reg_usb_h1_vbus: usb_h1_vbus { -+ compatible = "regulator-fixed"; -+ regulator-name = "usb_h1_vbus"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ enable-active-high; -+ startup-delay-us = <2>; /* USB2415 requires a POR of 1 us minimum */ -+ gpio = <&gpio7 12 0>; -+ }; -+ }; ++ reg_sensor: sensor_supply { ++ compatible = "regulator-fixed"; ++ regulator-name = "sensor-SUPPLY"; ++ enable-active-high; ++ }; + -+ mxcfb1: fb@0 { -+ compatible = "fsl,mxc_sdc_fb"; -+ disp_dev = "hdmi"; -+ interface_pix_fmt = "RGB24"; -+ mode_str ="1920x1080M@60"; -+ default_bpp = <24>; -+ int_clk = <0>; -+ late_init = <0>; -+ status = "okay"; -+ }; ++ reg_usb_otg_vbus: usb_otg_vbus { ++ compatible = "regulator-fixed"; ++ regulator-name = "usb_otg_vbus"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ enable-active-high; ++ }; ++ ++ reg_usb_h1_vbus: usb_h1_vbus { ++ compatible = "regulator-fixed"; ++ regulator-name = "usb_h1_vbus"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ enable-active-high; ++ startup-delay-us = <2>; /* USB2415 requires a POR of 1 us minimum */ ++ gpio = <&gpio7 12 0>; ++ }; ++ }; ++ ++ mxcfb1: fb@0 { ++ compatible = "fsl,mxc_sdc_fb"; ++ disp_dev = "hdmi"; ++ interface_pix_fmt = "RGB24"; ++ mode_str ="1920x1080M@60"; ++ default_bpp = <24>; ++ int_clk = <0>; ++ late_init = <0>; ++ status = "okay"; ++ }; + + mxcfb2: fb@1 { + compatible = "fsl,mxc_sdc_fb"; @@ -118,74 +254,74 @@ index 7cc0267..26e56af 100644 + status = "okay"; + }; + -+ mxcfb3: fb@2 { -+ compatible = "fsl,mxc_sdc_fb"; -+ disp_dev = "hdmi"; -+ interface_pix_fmt = "RGB24"; -+ mode_str ="1920x1080M@60"; -+ default_bpp = <24>; -+ int_clk = <0>; -+ late_init = <0>; -+ status = "disabled"; -+ }; ++ mxcfb3: fb@2 { ++ compatible = "fsl,mxc_sdc_fb"; ++ disp_dev = "hdmi"; ++ interface_pix_fmt = "RGB24"; ++ mode_str ="1920x1080M@60"; ++ default_bpp = <24>; ++ int_clk = <0>; ++ late_init = <0>; ++ status = "disabled"; ++ }; + -+ mxcfb4: fb@3 { -+ compatible = "fsl,mxc_sdc_fb"; -+ disp_dev = "hdmi"; -+ interface_pix_fmt = "RGB24"; -+ mode_str ="1920x1080M@60"; -+ default_bpp = <24>; -+ int_clk = <0>; -+ late_init = <0>; -+ status = "disabled"; -+ }; ++ mxcfb4: fb@3 { ++ compatible = "fsl,mxc_sdc_fb"; ++ disp_dev = "hdmi"; ++ interface_pix_fmt = "RGB24"; ++ mode_str ="1920x1080M@60"; ++ default_bpp = <24>; ++ int_clk = <0>; ++ late_init = <0>; ++ status = "disabled"; ++ }; + -+ codec: vt1613 { ++ codec: vt1613 { + compatible = "via,vt1613"; -+ }; ++ }; + -+ sound { ++ sound { + compatible = "udoo,imx-vt1613-audio"; -+ ssi-controller = <&ssi1>; -+ audio-codec = <&codec>; -+ mux-int-port = <1>; -+ mux-ext-port = <6>; -+ }; ++ ssi-controller = <&ssi1>; ++ audio-codec = <&codec>; ++ mux-int-port = <1>; ++ mux-ext-port = <6>; ++ }; + -+ sound-hdmi { -+ compatible = "fsl,imx6q-audio-hdmi", -+ "fsl,imx-audio-hdmi"; -+ model = "imx-audio-hdmi"; -+ hdmi-controller = <&hdmi_audio>; -+ }; ++ sound-hdmi { ++ compatible = "fsl,imx6q-audio-hdmi", ++ "fsl,imx-audio-hdmi"; ++ model = "imx-audio-hdmi"; ++ hdmi-controller = <&hdmi_audio>; ++ }; + -+ sound-spdif { -+ compatible = "fsl,imx-audio-spdif", -+ "fsl,imx-sabreauto-spdif"; -+ model = "imx-spdif"; -+ spdif-controller = <&spdif>; -+ spdif-in; -+ status = "disabled"; -+ }; ++ sound-spdif { ++ compatible = "fsl,imx-audio-spdif", ++ "fsl,imx-sabreauto-spdif"; ++ model = "imx-spdif"; ++ spdif-controller = <&spdif>; ++ spdif-in; ++ status = "disabled"; ++ }; + -+ v4l2_out { -+ compatible = "fsl,mxc_v4l2_output"; -+ status = "okay"; -+ }; ++ v4l2_out { ++ compatible = "fsl,mxc_v4l2_output"; ++ status = "okay"; ++ }; + -+ poweroff { -+ compatible = "udoo,poweroff"; -+ sam3x_rst_gpio = <&gpio1 0 GPIO_ACTIVE_LOW>; -+ pwr_5v_gpio = <&gpio2 4 GPIO_ACTIVE_HIGH>; -+ arduino_mode = <0>; -+ }; ++ poweroff { ++ compatible = "udoo,poweroff"; ++ sam3x_rst_gpio = <&gpio1 0 GPIO_ACTIVE_LOW>; ++ pwr_5v_gpio = <&gpio2 4 GPIO_ACTIVE_HIGH>; ++ arduino_mode = <0>; ++ }; +}; + +&ldb { -+ ipu_id = <1>; -+ disp_id = <0>; -+ ext_ref = <1>; -+ mode = "sep0"; ++ ipu_id = <1>; ++ disp_id = <0>; ++ ext_ref = <1>; ++ mode = "sep0"; + sec_ipu_id = <1>; + sec_disp_id = <1>; + status = "okay"; @@ -231,54 +367,56 @@ index 7cc0267..26e56af 100644 + pinctrl-0 = <&pinctrl_i2c3_5>; + status = "okay"; + -+ touchscreen: st1232@55 { -+ compatible = "sitronix,st1232"; -+ reg = <0x55>; -+ interrupt-parent = <&gpio1>; -+ interrupts = <13 IRQ_TYPE_LEVEL_LOW>; -+ gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; -+ /* udoo poweroff driver */ -+ lcd_panel_on_gpio = <&gpio1 2 GPIO_ACTIVE_HIGH>; -+ lcd_backlight_gpio = <&gpio1 4 GPIO_ACTIVE_HIGH>; -+ }; - }; - - &fec { -@@ -33,9 +245,62 @@ - }; - - &iomuxc { ++ touchscreen: st1232@55 { ++ compatible = "sitronix,st1232"; ++ reg = <0x55>; ++ interrupt-parent = <&gpio1>; ++ interrupts = <13 IRQ_TYPE_LEVEL_LOW>; ++ gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; ++ /* udoo poweroff driver */ ++ lcd_panel_on_gpio = <&gpio1 2 GPIO_ACTIVE_HIGH>; ++ lcd_backlight_gpio = <&gpio1 4 GPIO_ACTIVE_HIGH>; ++ }; ++}; ++ ++&fec { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_enet>; ++ phy-mode = "rgmii"; ++ status = "okay"; ++}; ++ ++&iomuxc { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_hog>; + - imx6q-udoo { -- pinctrl_enet: enetgrp { ++ imx6q-udoo { + pinctrl_hog: hoggrp { + fsl,pins = < -+ MX6QDL_PAD_NANDF_D4__GPIO2_IO04 0x80000000 /* 5v enable */ -+ MX6QDL_PAD_NANDF_CS0__GPIO6_IO11 0x80000000 /* Vtt suspend */ -+ MX6QDL_PAD_SD2_DAT0__GPIO1_IO15 0x80000000 /* touch reset */ -+ MX6QDL_PAD_EIM_EB3__GPIO2_IO31 0x80000000 /* ethernet power */ ++ MX6QDL_PAD_NANDF_D4__GPIO2_IO04 0x80000000 /* 5v enable */ ++ MX6QDL_PAD_NANDF_CS0__GPIO6_IO11 0x80000000 /* Vtt suspend */ ++ MX6QDL_PAD_SD2_DAT0__GPIO1_IO15 0x80000000 /* touch reset */ ++ MX6QDL_PAD_EIM_EB3__GPIO2_IO31 0x80000000 /* ethernet power */ + -+ MX6QDL_PAD_GPIO_17__GPIO7_IO12 0x80000000 /* usb hub reset */ -+ MX6QDL_PAD_NANDF_CS2__CCM_CLKO2 0x130b0 /* clk usb hub */ -+ MX6QDL_PAD_EIM_WAIT__GPIO5_IO00 0xb0b1 /* usb otg select */ ++ MX6QDL_PAD_GPIO_17__GPIO7_IO12 0x80000000 /* usb hub reset */ ++ MX6QDL_PAD_NANDF_CS2__CCM_CLKO2 0x130b0 /* clk usb hub */ ++ MX6QDL_PAD_EIM_WAIT__GPIO5_IO00 0xb0b1 /* usb otg select */ + -+ MX6QDL_PAD_NANDF_D5__GPIO2_IO05 0x80000000 /* sdcard power */ -+ MX6QDL_PAD_SD3_DAT5__GPIO7_IO00 0x80000000 /* sd card detect */ -+ MX6QDL_PAD_DISP0_DAT5__GPIO4_IO26 0x80000000 /* select dbg uart*/ -+ MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x80000000 /* SAM3X reset */ -+ MX6QDL_PAD_DISP0_DAT0__GPIO4_IO21 0x30b1 /* SAM3X erase */ -+ MX6QDL_PAD_GPIO_16__GPIO7_IO11 0xb0b1 /* SAM3X vbus_en */ -+ MX6QDL_PAD_SD4_DAT7__GPIO2_IO15 0x80000000 /* SAM3X usb host */ -+ MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x80000000 /* panel on */ -+ MX6QDL_PAD_GPIO_4__GPIO1_IO04 0x80000000 /* backlight on */ -+ MX6QDL_PAD_CSI0_DAT19__GPIO6_IO05 0x80000000 /* camera reset */ -+ MX6QDL_PAD_CSI0_DAT18__GPIO6_IO04 0x80000000 /* camera enable */ ++ MX6QDL_PAD_NANDF_D5__GPIO2_IO05 0x80000000 /* sdcard power */ ++ MX6QDL_PAD_SD3_DAT5__GPIO7_IO00 0x80000000 /* sd card detect */ ++ MX6QDL_PAD_DISP0_DAT5__GPIO4_IO26 0x80000000 /* select dbg uart*/ ++ MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x80000000 /* SAM3X reset */ ++ MX6QDL_PAD_DISP0_DAT0__GPIO4_IO21 0x30b1 /* SAM3X erase */ ++ MX6QDL_PAD_GPIO_16__GPIO7_IO11 0xb0b1 /* SAM3X vbus_en */ ++ MX6QDL_PAD_SD4_DAT7__GPIO2_IO15 0x80000000 /* SAM3X usb host */ ++ MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x80000000 /* panel on */ ++ MX6QDL_PAD_GPIO_4__GPIO1_IO04 0x80000000 /* backlight on */ ++ MX6QDL_PAD_CSI0_DAT19__GPIO6_IO05 0x80000000 /* camera reset */ ++ MX6QDL_PAD_CSI0_DAT18__GPIO6_IO04 0x80000000 /* camera enable */ + MX6QDL_PAD_CSI0_PIXCLK__GPIO5_IO18 0x80000000 /* input mon serial*/ -+ MX6QDL_PAD_CSI0_DAT17__GPIO6_IO03 0x80000000 /* input mon serial*/ -+ MX6QDL_PAD_EIM_A19__GPIO2_IO19 0x80000000 /* writeprotect spi*/ -+ MX6QDL_PAD_GPIO_3__GPIO1_IO03 0x30b1 /* arduino pinout */ ++ MX6QDL_PAD_CSI0_DAT17__GPIO6_IO03 0x80000000 /* input mon serial*/ ++ MX6QDL_PAD_EIM_A19__GPIO2_IO19 0x80000000 /* writeprotect spi*/ ++ MX6QDL_PAD_GPIO_3__GPIO1_IO03 0x30b1 /* arduino pinout */ + >; + }; + @@ -297,53 +435,57 @@ index 7cc0267..26e56af 100644 + }; + + pinctrl_i2c3_5: i2c3grp-5 { - fsl,pins = < -+ MX6QDL_PAD_GPIO_5__I2C3_SCL 0x4001b8b1 -+ MX6QDL_PAD_GPIO_6__I2C3_SDA 0x4001b8b1 ++ fsl,pins = < ++ MX6QDL_PAD_GPIO_5__I2C3_SCL 0x4001b8b1 ++ MX6QDL_PAD_GPIO_6__I2C3_SDA 0x4001b8b1 + >; + }; -+ ++ + pinctrl_enet: enetgrp { -+ fsl,pins = < - MX6QDL_PAD_RGMII_RXC__RGMII_RXC 0x1b0b0 - MX6QDL_PAD_RGMII_RD0__RGMII_RD0 0x1b0b0 - MX6QDL_PAD_RGMII_RD1__RGMII_RD1 0x1b0b0 -@@ -51,10 +316,10 @@ - MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK 0x1b0b0 - MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0 - MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0 -- MX6QDL_PAD_GPIO_16__ENET_REF_CLK 0x4001b0a8 -+ MX6QDL_PAD_EIM_D23__GPIO3_IO23 0x80000000 /* reset */ - >; - }; -- -+ - pinctrl_uart2: uart2grp { - fsl,pins = < - MX6QDL_PAD_EIM_D26__UART2_TX_DATA 0x1b0b1 -@@ -62,19 +327,90 @@ - >; - }; - ++ fsl,pins = < ++ MX6QDL_PAD_RGMII_RXC__RGMII_RXC 0x1b0b0 ++ MX6QDL_PAD_RGMII_RD0__RGMII_RD0 0x1b0b0 ++ MX6QDL_PAD_RGMII_RD1__RGMII_RD1 0x1b0b0 ++ MX6QDL_PAD_RGMII_RD2__RGMII_RD2 0x1b0b0 ++ MX6QDL_PAD_RGMII_RD3__RGMII_RD3 0x1b0b0 ++ MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b0b0 ++ MX6QDL_PAD_RGMII_TXC__RGMII_TXC 0x1b0b0 ++ MX6QDL_PAD_RGMII_TD0__RGMII_TD0 0x1b0b0 ++ MX6QDL_PAD_RGMII_TD1__RGMII_TD1 0x1b0b0 ++ MX6QDL_PAD_RGMII_TD2__RGMII_TD2 0x1b0b0 ++ MX6QDL_PAD_RGMII_TD3__RGMII_TD3 0x1b0b0 ++ MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL 0x1b0b0 ++ MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK 0x1b0b0 ++ MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0 ++ MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0 ++ MX6QDL_PAD_EIM_D23__GPIO3_IO23 0x80000000 /* reset */ ++ >; ++ }; ++ ++ pinctrl_uart2: uart2grp { ++ fsl,pins = < ++ MX6QDL_PAD_EIM_D26__UART2_TX_DATA 0x1b0b1 ++ MX6QDL_PAD_EIM_D27__UART2_RX_DATA 0x1b0b1 ++ >; ++ }; ++ + pinctrl_uart4: uart4grp { -+ fsl,pins = < ++ fsl,pins = < + MX6QDL_PAD_KEY_COL0__UART4_TX_DATA 0x1b0b1 + MX6QDL_PAD_KEY_ROW0__UART4_RX_DATA 0x1b0b1 + >; + }; + - pinctrl_usdhc3: usdhc3grp { - fsl,pins = < -- MX6QDL_PAD_SD3_CMD__SD3_CMD 0x17059 -- MX6QDL_PAD_SD3_CLK__SD3_CLK 0x10059 -+ MX6QDL_PAD_SD3_CMD__SD3_CMD 0x17059 -+ MX6QDL_PAD_SD3_CLK__SD3_CLK 0x10059 - MX6QDL_PAD_SD3_DAT0__SD3_DATA0 0x17059 - MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x17059 - MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x17059 - MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x17059 - >; - }; ++ pinctrl_usdhc3: usdhc3grp { ++ fsl,pins = < ++ MX6QDL_PAD_SD3_CMD__SD3_CMD 0x17059 ++ MX6QDL_PAD_SD3_CLK__SD3_CLK 0x10059 ++ MX6QDL_PAD_SD3_DAT0__SD3_DATA0 0x17059 ++ MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x17059 ++ MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x17059 ++ MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x17059 ++ >; ++ }; + + pinctrl_i2c3_1: i2c3grp-1 { + fsl,pins = < @@ -366,29 +508,29 @@ index 7cc0267..26e56af 100644 + + ac97link_running: ac97link_runninggrp { + fsl,pins = < -+ MX6QDL_PAD_DI0_PIN2__AUD6_TXD 0x80000000 -+ MX6QDL_PAD_DI0_PIN3__AUD6_TXFS 0x80000000 -+ MX6QDL_PAD_DI0_PIN4__AUD6_RXD 0x80000000 -+ MX6QDL_PAD_DI0_PIN15__AUD6_TXC 0x80000000 ++ MX6QDL_PAD_DI0_PIN2__AUD6_TXD 0x80000000 ++ MX6QDL_PAD_DI0_PIN3__AUD6_TXFS 0x80000000 ++ MX6QDL_PAD_DI0_PIN4__AUD6_RXD 0x80000000 ++ MX6QDL_PAD_DI0_PIN15__AUD6_TXC 0x80000000 + >; + }; + -+ ac97link_reset: ac97link_resetgrp { ++ ac97link_reset: ac97link_resetgrp { + fsl,pins = < -+ MX6QDL_PAD_EIM_EB2__GPIO2_IO30 0x80000000 -+ MX6QDL_PAD_DI0_PIN3__GPIO4_IO19 0x80000000 -+ MX6QDL_PAD_DI0_PIN2__GPIO4_IO18 0x80000000 ++ MX6QDL_PAD_EIM_EB2__GPIO2_IO30 0x80000000 ++ MX6QDL_PAD_DI0_PIN3__GPIO4_IO19 0x80000000 ++ MX6QDL_PAD_DI0_PIN2__GPIO4_IO18 0x80000000 + >; + }; + -+ ac97link_warm_reset: ac97link_warm_resetgrp { ++ ac97link_warm_reset: ac97link_warm_resetgrp { + fsl,pins = < -+ MX6QDL_PAD_DI0_PIN3__GPIO4_IO19 0x80000000 ++ MX6QDL_PAD_DI0_PIN3__GPIO4_IO19 0x80000000 + >; + }; - }; - }; - ++ }; ++}; ++ +&audmux { + status = "okay"; +}; @@ -411,23 +553,22 @@ index 7cc0267..26e56af 100644 + status = "disabled"; +}; + - &sata { - status = "okay"; - }; -@@ -85,9 +421,33 @@ - status = "okay"; - }; - ++&uart2 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_uart2>; ++ status = "okay"; ++}; ++ +&uart4 { /* sam3x port */ + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_uart4>; -+ status = "okay"; ++ status = "okay"; +}; + - &usdhc3 { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_usdhc3>; - non-removable; ++&usdhc3 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_usdhc3>; ++ non-removable; + keep-power-in-suspend; + status = "okay"; +}; @@ -440,8 +581,8 @@ index 7cc0267..26e56af 100644 + vbus-supply = <®_usb_h1_vbus>; + clocks = <&clks 201>; + clock-names = "phy"; - status = "okay"; - }; ++ status = "okay"; ++}; + +&hdmi_cec { + /*pinctrl-names = "default"; @@ -450,3 +591,4 @@ index 7cc0267..26e56af 100644 +}; -- 1.8.1.2 + diff --git a/projects/imx6/patches/linux/linux-332-udoo-fix-st1232-driver.patch b/projects/imx6/patches/linux/linux-332-udoo-fix-st1232-driver.patch deleted file mode 100644 index fc6f91be5b..0000000000 --- a/projects/imx6/patches/linux/linux-332-udoo-fix-st1232-driver.patch +++ /dev/null @@ -1,640 +0,0 @@ -From 8a7ac9c15a3e6e25f8a3238c26a2584d84c6b38f Mon Sep 17 00:00:00 2001 -From: vpeter4 -Date: Wed, 3 Jun 2015 18:15:31 +0200 -Subject: [PATCH] update driver for st1232 touchscreen controller - -Original driver is multitouch only and Kodi doesnt understand -this input events. Driver was modified to start as singletouch -and also supports touch button in this mode. - ---- - drivers/input/touchscreen/st1232.c | 554 ++++++++++++++++++++++--------------- - 1 file changed, 331 insertions(+), 223 deletions(-) - -diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c -index 5c342b3..e1254a1 100644 ---- a/drivers/input/touchscreen/st1232.c -+++ b/drivers/input/touchscreen/st1232.c -@@ -1,12 +1,13 @@ - /* -- * ST1232 Touchscreen Controller Driver -+ * ST1232/ST1332 Touchscreen Controller Driver - * - * Copyright (C) 2010 Renesas Solutions Corp. -- * Tony SIM -+ * Tony SIM -+ * Copyright (C) 2015 Peter Vicman - * - * Using code from: - * - android.git.kernel.org: projects/kernel/common.git: synaptics_i2c_rmi.c -- * Copyright (C) 2007 Google, Inc. -+ * Copyright (C) 2007 Google, Inc. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and -@@ -30,282 +31,383 @@ - #include - #include - #include -- --#define ST1232_TS_NAME "st1232-ts" -- --#define MIN_X 0x00 --#define MIN_Y 0x00 --#define MAX_X 0x31f /* (800 - 1) */ --#define MAX_Y 0x1df /* (480 - 1) */ --#define MAX_AREA 0xff --#define MAX_FINGERS 2 -+#include -+ -+#define ST1232_TS_NAME "st1232-ts" -+#define MIN_X 0 -+#define MIN_Y 0 -+#define MAX_X (800 - 1) -+#define MAX_Y (480 - 1) -+#define MAX_AREA 0xff -+#define MAX_FINGERS 2 -+#define SAMPLE_DELAY 20 /* msecs */ -+#define REVERSE_X(x) if (reverse_x == true) { x = MAX_X - (x); } else {} -+#define REVERSE_Y(y) if (reverse_y == true) { y = MAX_Y - (y); } else {} - - struct st1232_ts_finger { -- u16 x; -- u16 y; -- u8 t; -- bool is_valid; -+ u16 x; -+ u16 y; -+ u8 t; -+ bool is_valid; - }; - - struct st1232_ts_data { -- struct i2c_client *client; -- struct input_dev *input_dev; -- struct st1232_ts_finger finger[MAX_FINGERS]; -- struct dev_pm_qos_request low_latency_req; -- int reset_gpio; -+ struct i2c_client *client; -+ struct input_dev *input_dev; -+ struct st1232_ts_finger finger[MAX_FINGERS]; -+ struct dev_pm_qos_request low_latency_req; -+ int reset_gpio; -+ struct delayed_work work; - }; - -+static bool multitouch = false; -+module_param(multitouch, bool, 0); -+MODULE_PARM_DESC(multitouch, " If multitouch is set to 1 ts acts as multitouch"); -+ -+static bool reverse_x = false; -+module_param(reverse_x, bool, 0600); -+MODULE_PARM_DESC(reverse_x, " If reverse_x is set to 1 x coordinates are reversed"); -+ -+static bool reverse_y = false; -+module_param(reverse_y, bool, 0600); -+MODULE_PARM_DESC(reverse_y, " If reverse_y is set to 1 y coordinates are reversed"); -+ -+static int offset_x = 0; -+module_param(offset_x, int, 0600); -+MODULE_PARM_DESC(offset_x, " Offset value for x axis"); -+ -+static int offset_y = 0; -+module_param(offset_y, int, 0600); -+MODULE_PARM_DESC(offset_y, " Offset value for y axis"); -+ - static int st1232_ts_read_data(struct st1232_ts_data *ts) - { -- struct st1232_ts_finger *finger = ts->finger; -- struct i2c_client *client = ts->client; -- struct i2c_msg msg[2]; -- int error; -- u8 start_reg; -- u8 buf[10]; -- -- /* read touchscreen data from ST1232 */ -- msg[0].addr = client->addr; -- msg[0].flags = 0; -- msg[0].len = 1; -- msg[0].buf = &start_reg; -- start_reg = 0x10; -- -- msg[1].addr = ts->client->addr; -- msg[1].flags = I2C_M_RD; -- msg[1].len = sizeof(buf); -- msg[1].buf = buf; -- -- error = i2c_transfer(client->adapter, msg, 2); -- if (error < 0) -- return error; -- -- /* get "valid" bits */ -- finger[0].is_valid = buf[2] >> 7; -- finger[1].is_valid = buf[5] >> 7; -- -- /* get xy coordinate */ -- if (finger[0].is_valid) { -- finger[0].x = ((buf[2] & 0x0070) << 4) | buf[3]; -- finger[0].y = ((buf[2] & 0x0007) << 8) | buf[4]; -- finger[0].t = buf[8]; -- } -- -- if (finger[1].is_valid) { -- finger[1].x = ((buf[5] & 0x0070) << 4) | buf[6]; -- finger[1].y = ((buf[5] & 0x0007) << 8) | buf[7]; -- finger[1].t = buf[9]; -- } -- -- return 0; -+ struct st1232_ts_finger *finger = ts->finger; -+ struct i2c_client *client = ts->client; -+ struct i2c_msg msg[2]; -+ int error; -+ u8 start_reg; -+ u8 buf[10]; -+ -+ /* read touchscreen data from ST1232 */ -+ msg[0].addr = client->addr; -+ msg[0].flags = 0; -+ msg[0].len = 1; -+ msg[0].buf = &start_reg; -+ start_reg = 0x10; -+ -+ msg[1].addr = ts->client->addr; -+ msg[1].flags = I2C_M_RD; -+ msg[1].len = sizeof(buf); -+ msg[1].buf = buf; -+ -+ error = i2c_transfer(client->adapter, msg, 2); -+ if (error < 0) -+ return error; -+ -+ memset(finger, 0x0, sizeof(struct st1232_ts_finger) * MAX_FINGERS); -+ -+ /* get "valid" bits from fingers -+ and combine with "valid" bits from coordinates */ -+ finger[0].is_valid = (buf[0] & 0x07); /* only 3 bits on st1332 */ -+ finger[0].is_valid &= (buf[2] >> 7); -+ finger[1].is_valid = (buf[0] & 0x07); -+ finger[1].is_valid &= (buf[5] >> 7); -+ -+ /* get xy coordinates and strength */ -+ if (finger[0].is_valid) { -+ finger[0].x = ((buf[2] & 0x0070) << 4) | buf[3]; -+ finger[0].y = ((buf[2] & 0x0007) << 8) | buf[4]; -+ finger[0].t = buf[8]; -+ -+ REVERSE_X(finger[0].x) -+ REVERSE_Y(finger[0].y) -+ -+ finger[0].x += offset_x; -+ finger[0].y += offset_y; -+ } -+ -+ if (finger[1].is_valid) { -+ finger[1].x = ((buf[5] & 0x0070) << 4) | buf[6]; -+ finger[1].y = ((buf[5] & 0x0007) << 8) | buf[7]; -+ finger[1].t = buf[9]; -+ -+ REVERSE_X(finger[1].x) -+ REVERSE_Y(finger[1].y) -+ } -+ -+ return 0; -+} -+ -+static void st1232_ts_finger_released(struct work_struct *work) -+{ -+ struct st1232_ts_data *ts = container_of(work, struct st1232_ts_data, work.work); -+ struct st1232_ts_finger *finger = ts->finger; -+ struct input_dev *input_dev = ts->input_dev; -+ int ret; -+ -+ ret = st1232_ts_read_data(ts); -+ if (ret < 0) -+ goto end; -+ -+ /* finger is a pointer to finger[0] */ -+ if (finger->is_valid) -+ goto end; /* finger (still) touched */ -+ -+ /* finger released */ -+ input_report_abs(input_dev, ABS_PRESSURE, 0); -+ input_report_key(input_dev, BTN_TOUCH, 0); -+ input_sync(input_dev); -+ -+end: -+ return; - } - - static irqreturn_t st1232_ts_irq_handler(int irq, void *dev_id) - { -- struct st1232_ts_data *ts = dev_id; -- struct st1232_ts_finger *finger = ts->finger; -- struct input_dev *input_dev = ts->input_dev; -- int count = 0; -- int i, ret; -- -- ret = st1232_ts_read_data(ts); -- if (ret < 0) -- goto end; -- -- /* multi touch protocol */ -- for (i = 0; i < MAX_FINGERS; i++) { -- if (!finger[i].is_valid) -- continue; -- -- input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, finger[i].t); -- input_report_abs(input_dev, ABS_MT_POSITION_X, finger[i].x); -- input_report_abs(input_dev, ABS_MT_POSITION_Y, finger[i].y); -- input_mt_sync(input_dev); -- count++; -- } -- -- /* SYN_MT_REPORT only if no contact */ -- if (!count) { -- input_mt_sync(input_dev); -- if (ts->low_latency_req.dev) { -- dev_pm_qos_remove_request(&ts->low_latency_req); -- ts->low_latency_req.dev = NULL; -- } -- } else if (!ts->low_latency_req.dev) { -- /* First contact, request 100 us latency. */ -- dev_pm_qos_add_ancestor_request(&ts->client->dev, -- &ts->low_latency_req, 100); -- } -- -- /* SYN_REPORT */ -- input_sync(input_dev); -+ struct st1232_ts_data *ts = dev_id; -+ struct st1232_ts_finger *finger = ts->finger; -+ struct input_dev *input_dev = ts->input_dev; -+ int count = 0; -+ int i, ret; -+ -+ if (multitouch == false) { -+ /* -+ * Cancel scheduled polling for release if we have new value -+ * available. Wait if the polling is already running. -+ */ -+ cancel_delayed_work_sync(&ts->work); -+ } -+ -+ ret = st1232_ts_read_data(ts); -+ if (ret < 0) -+ goto end; -+ -+ if (multitouch == false) { -+ if (finger->is_valid) { -+ input_report_abs(input_dev, ABS_X, finger->x); -+ input_report_abs(input_dev, ABS_Y, finger->y); -+ input_report_abs(input_dev, ABS_PRESSURE, finger->t); -+ input_report_key(input_dev, BTN_TOUCH, 1); -+ input_sync(input_dev); -+ } -+ } else { -+ /* multi touch protocol */ -+ for (i = 0; i < MAX_FINGERS; i++) { -+ if (!finger[i].is_valid) -+ continue; -+ -+ input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, finger[i].t); -+ input_report_abs(input_dev, ABS_MT_POSITION_X, finger[i].x); -+ input_report_abs(input_dev, ABS_MT_POSITION_Y, finger[i].y); -+ input_mt_sync(input_dev); -+ count++; -+ } -+ -+ /* SYN_MT_REPORT only if no contact */ -+ if (!count) { -+ input_mt_sync(input_dev); -+ if (ts->low_latency_req.dev) { -+ dev_pm_qos_remove_request(&ts->low_latency_req); -+ ts->low_latency_req.dev = NULL; -+ } -+ } else if (!ts->low_latency_req.dev) { -+ /* First contact, request 100 us latency. */ -+ dev_pm_qos_add_ancestor_request(&ts->client->dev, &ts->low_latency_req, 100); -+ } -+ -+ /* SYN_REPORT */ -+ input_sync(input_dev); -+ } - - end: -- return IRQ_HANDLED; -+ if (multitouch == false) { -+ /* start polling for st1232_ts_read_data to detect release */ -+ schedule_delayed_work(&ts->work, msecs_to_jiffies(SAMPLE_DELAY)); -+ } -+ -+ return IRQ_HANDLED; - } - - static void st1232_ts_power(struct st1232_ts_data *ts, bool poweron) - { -- if (gpio_is_valid(ts->reset_gpio)) -- gpio_direction_output(ts->reset_gpio, poweron); -+ if (gpio_is_valid(ts->reset_gpio)) -+ gpio_direction_output(ts->reset_gpio, poweron); - } - - static int st1232_ts_probe(struct i2c_client *client, -- const struct i2c_device_id *id) -+ const struct i2c_device_id *id) - { -- struct st1232_ts_data *ts; -- struct st1232_pdata *pdata = dev_get_platdata(&client->dev); -- struct input_dev *input_dev; -- int error; -- -- if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { -- dev_err(&client->dev, "need I2C_FUNC_I2C\n"); -- return -EIO; -- } -- -- if (!client->irq) { -- dev_err(&client->dev, "no IRQ?\n"); -- return -EINVAL; -- } -- -- ts = devm_kzalloc(&client->dev, sizeof(*ts), GFP_KERNEL); -- if (!ts) -- return -ENOMEM; -- -- input_dev = devm_input_allocate_device(&client->dev); -- if (!input_dev) -- return -ENOMEM; -- -- ts->client = client; -- ts->input_dev = input_dev; -- -- if (pdata) -- ts->reset_gpio = pdata->reset_gpio; -- else if (client->dev.of_node) -- ts->reset_gpio = of_get_gpio(client->dev.of_node, 0); -- else -- ts->reset_gpio = -ENODEV; -- -- if (gpio_is_valid(ts->reset_gpio)) { -- error = devm_gpio_request(&client->dev, ts->reset_gpio, NULL); -- if (error) { -- dev_err(&client->dev, -- "Unable to request GPIO pin %d.\n", -- ts->reset_gpio); -- return error; -- } -- } -- -- st1232_ts_power(ts, true); -- -- input_dev->name = "st1232-touchscreen"; -- input_dev->id.bustype = BUS_I2C; -- input_dev->dev.parent = &client->dev; -- -- __set_bit(EV_SYN, input_dev->evbit); -- __set_bit(EV_KEY, input_dev->evbit); -- __set_bit(EV_ABS, input_dev->evbit); -- -- input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, MAX_AREA, 0, 0); -- input_set_abs_params(input_dev, ABS_MT_POSITION_X, MIN_X, MAX_X, 0, 0); -- input_set_abs_params(input_dev, ABS_MT_POSITION_Y, MIN_Y, MAX_Y, 0, 0); -- -- error = devm_request_threaded_irq(&client->dev, client->irq, -- NULL, st1232_ts_irq_handler, -- IRQF_ONESHOT, -- client->name, ts); -- if (error) { -- dev_err(&client->dev, "Failed to register interrupt\n"); -- return error; -- } -- -- error = input_register_device(ts->input_dev); -- if (error) { -- dev_err(&client->dev, "Unable to register %s input device\n", -- input_dev->name); -- return error; -- } -- -- i2c_set_clientdata(client, ts); -- device_init_wakeup(&client->dev, 1); -- -- return 0; -+ struct st1232_ts_data *ts; -+ struct st1232_pdata *pdata = dev_get_platdata(&client->dev); -+ struct input_dev *input_dev; -+ int error; -+ -+ if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { -+ dev_err(&client->dev, "need I2C_FUNC_I2C\n"); -+ return -EIO; -+ } -+ -+ if (!client->irq) { -+ dev_err(&client->dev, "no IRQ?\n"); -+ return -EINVAL; -+ } -+ -+ ts = devm_kzalloc(&client->dev, sizeof(*ts), GFP_KERNEL); -+ if (!ts) -+ return -ENOMEM; -+ -+ input_dev = devm_input_allocate_device(&client->dev); -+ if (!input_dev) -+ return -ENOMEM; -+ -+ ts->client = client; -+ ts->input_dev = input_dev; -+ -+ if (pdata) -+ ts->reset_gpio = pdata->reset_gpio; -+ else if (client->dev.of_node) -+ ts->reset_gpio = of_get_gpio(client->dev.of_node, 0); -+ else -+ ts->reset_gpio = -ENODEV; -+ -+ if (gpio_is_valid(ts->reset_gpio)) { -+ error = devm_gpio_request(&client->dev, ts->reset_gpio, NULL); -+ if (error) { -+ dev_err(&client->dev, "Unable to request GPIO pin %d.\n", ts->reset_gpio); -+ return error; -+ } -+ } -+ -+ st1232_ts_power(ts, true); -+ -+ input_dev->name = ST1232_TS_NAME; -+ input_dev->id.bustype = BUS_I2C; -+ input_dev->dev.parent = &client->dev; -+ -+ if (multitouch == false) { -+ input_dev->phys = ST1232_TS_NAME"/input0"; -+ -+ __set_bit(BTN_TOUCH, input_dev->keybit); -+ __set_bit(EV_KEY, input_dev->evbit); -+ __set_bit(EV_ABS, input_dev->evbit); -+ __set_bit(ABS_X, input_dev->absbit); -+ __set_bit(ABS_Y, input_dev->absbit); -+ __set_bit(ABS_PRESSURE, input_dev->absbit); -+ -+ input_set_abs_params(input_dev, ABS_X, MIN_X, MAX_X, 0, 0); -+ input_set_abs_params(input_dev, ABS_Y, MIN_Y, MAX_Y, 0, 0); -+ input_set_abs_params(input_dev, ABS_PRESSURE, 0x0, 0xff, 0, 0); -+ -+ INIT_DELAYED_WORK(&ts->work, st1232_ts_finger_released); -+ } else { -+ __set_bit(EV_SYN, input_dev->evbit); -+ __set_bit(EV_KEY, input_dev->evbit); -+ __set_bit(EV_ABS, input_dev->evbit); -+ -+ input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, MAX_AREA, 0, 0); -+ input_set_abs_params(input_dev, ABS_MT_POSITION_X, MIN_X, MAX_X, 0, 0); -+ input_set_abs_params(input_dev, ABS_MT_POSITION_Y, MIN_Y, MAX_Y, 0, 0); -+ } -+ -+ error = devm_request_threaded_irq(&client->dev, client->irq, -+ NULL, st1232_ts_irq_handler, -+ IRQF_ONESHOT, -+ client->name, ts); -+ if (error) { -+ dev_err(&client->dev, "Failed to register interrupt\n"); -+ return error; -+ } -+ -+ error = input_register_device(ts->input_dev); -+ if (error) { -+ dev_err(&client->dev, "Unable to register %s input device\n", -+ input_dev->name); -+ return error; -+ } -+ -+ i2c_set_clientdata(client, ts); -+ device_init_wakeup(&client->dev, 1); -+ -+ return 0; - } - - static int st1232_ts_remove(struct i2c_client *client) - { -- struct st1232_ts_data *ts = i2c_get_clientdata(client); -+ struct st1232_ts_data *ts = i2c_get_clientdata(client); - -- device_init_wakeup(&client->dev, 0); -- st1232_ts_power(ts, false); -+ device_init_wakeup(&client->dev, 0); -+ st1232_ts_power(ts, false); -+ cancel_delayed_work_sync(&ts->work); - -- return 0; -+ return 0; - } - - #ifdef CONFIG_PM_SLEEP - static int st1232_ts_suspend(struct device *dev) - { -- struct i2c_client *client = to_i2c_client(dev); -- struct st1232_ts_data *ts = i2c_get_clientdata(client); -- -- if (device_may_wakeup(&client->dev)) { -- enable_irq_wake(client->irq); -- } else { -- disable_irq(client->irq); -- st1232_ts_power(ts, false); -- } -- -- return 0; -+ struct i2c_client *client = to_i2c_client(dev); -+ struct st1232_ts_data *ts = i2c_get_clientdata(client); -+ -+ if (device_may_wakeup(&client->dev)) { -+ enable_irq_wake(client->irq); -+ } else { -+ disable_irq(client->irq); -+ cancel_delayed_work_sync(&ts->work); -+ st1232_ts_power(ts, false); -+ } -+ -+ return 0; - } - - static int st1232_ts_resume(struct device *dev) - { -- struct i2c_client *client = to_i2c_client(dev); -- struct st1232_ts_data *ts = i2c_get_clientdata(client); -- -- if (device_may_wakeup(&client->dev)) { -- disable_irq_wake(client->irq); -- } else { -- st1232_ts_power(ts, true); -- enable_irq(client->irq); -- } -- -- return 0; -+ struct i2c_client *client = to_i2c_client(dev); -+ struct st1232_ts_data *ts = i2c_get_clientdata(client); -+ -+ if (device_may_wakeup(&client->dev)) { -+ disable_irq_wake(client->irq); -+ } else { -+ st1232_ts_power(ts, true); -+ schedule_delayed_work(&ts->work, HZ / 50); -+ enable_irq(client->irq); -+ } -+ -+ return 0; - } -- - #endif - - static SIMPLE_DEV_PM_OPS(st1232_ts_pm_ops, -- st1232_ts_suspend, st1232_ts_resume); -+ st1232_ts_suspend, st1232_ts_resume); - - static const struct i2c_device_id st1232_ts_id[] = { -- { ST1232_TS_NAME, 0 }, -- { } -+ { ST1232_TS_NAME, 0 }, -+ { } - }; - MODULE_DEVICE_TABLE(i2c, st1232_ts_id); - - #ifdef CONFIG_OF - static const struct of_device_id st1232_ts_dt_ids[] = { -- { .compatible = "sitronix,st1232", }, -- { } -+ { .compatible = "sitronix,st1232", }, -+ { } - }; - MODULE_DEVICE_TABLE(of, st1232_ts_dt_ids); - #endif - - static struct i2c_driver st1232_ts_driver = { -- .probe = st1232_ts_probe, -- .remove = st1232_ts_remove, -- .id_table = st1232_ts_id, -- .driver = { -- .name = ST1232_TS_NAME, -- .owner = THIS_MODULE, -- .of_match_table = of_match_ptr(st1232_ts_dt_ids), -- .pm = &st1232_ts_pm_ops, -- }, -+ .probe = st1232_ts_probe, -+ .remove = st1232_ts_remove, -+ .id_table = st1232_ts_id, -+ .driver = { -+ .name = ST1232_TS_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = of_match_ptr(st1232_ts_dt_ids), -+ .pm = &st1232_ts_pm_ops, -+ }, - }; - - module_i2c_driver(st1232_ts_driver); - --MODULE_AUTHOR("Tony SIM "); --MODULE_DESCRIPTION("SITRONIX ST1232 Touchscreen Controller Driver"); -+MODULE_AUTHOR("Tony SIM , Peter Vicman "); -+MODULE_DESCRIPTION("SITRONIX ST1232/ST1332 Touchscreen Controller Driver"); - MODULE_LICENSE("GPL"); --- -1.8.1.2 diff --git a/projects/imx6/patches/linux/linux-335-udoo-vt1613-audio-driver.patch b/projects/imx6/patches/linux/linux-335-udoo-vt1613-audio-driver.patch index e9b9ba00a3..1a1976ac71 100644 --- a/projects/imx6/patches/linux/linux-335-udoo-vt1613-audio-driver.patch +++ b/projects/imx6/patches/linux/linux-335-udoo-vt1613-audio-driver.patch @@ -675,7 +675,7 @@ index 0000000..3f2c212 + int int_port, ext_port; + int ret; + -+ if (!of_machine_is_compatible("udoo,imx6q-udoo")) ++ if (!of_machine_is_compatible("udoo,imx6q-udoo") && !of_machine_is_compatible("udoo,imx6dl-udoo")) + return -ENODEV; + + if (vt1613_modules_dep_ok) { diff --git a/projects/imx6/patches/u-boot/100-udoo_board_support.patch b/projects/imx6/patches/u-boot/100-udoo_board_support.patch old mode 100755 new mode 100644 index cb7c99a2f1..10ee125b71 --- a/projects/imx6/patches/u-boot/100-udoo_board_support.patch +++ b/projects/imx6/patches/u-boot/100-udoo_board_support.patch @@ -1,42 +1,31 @@ -From 6b8791fcb10110cec4c5bdf91babffcdcfc1a04f Mon Sep 17 00:00:00 2001 -From: vpeter4 -Date: Sat, 16 May 2015 16:44:39 +0200 +From 88ee5ba68c14d16ff8c8dcd96e94539c6b0312d5 Mon Sep 17 00:00:00 2001 +From: Peter Vicman +Date: Fri, 7 Aug 2015 21:33:31 +0200 Subject: [PATCH] udoo board support -diff between - u-boot-2013.10-rc3 - U-Boot_Unico-2013 799fb9b 15.5.2015 - -used macro MACH_TYPE_UDOO in cfb_console.c - for version_string/BOARD_INFO_STRING -L2 cache support is disabled - got error: ** No partition table - mmc 0 ** - -make udoo_quad_config -make udoo_dl_config --- - arch/arm/cpu/armv7/cpu.c | 14 + - arch/arm/imx-common/Makefile | 2 + - arch/arm/imx-common/cmd_plotmsg.c | 74 + - arch/arm/imx-common/sata.c | 33 + - arch/arm/include/asm/imx-common/sata.h | 17 + - board/boundary/nitrogen6x/nitrogen6x.c | 29 +- - board/udoo/1066mhz_4x256mx16_dl.cfg | 58 + - board/udoo/1066mhz_4x256mx16_q.cfg | 63 + - board/udoo/Makefile | 26 + - board/udoo/clocks.cfg | 31 + - board/udoo/ddr-setup_dl.cfg | 85 ++ - board/udoo/ddr-setup_q.cfg | 87 ++ - board/udoo/udoo.c | 540 ++++++++ - board/udoo/udoo.cfg | 35 + - boards.cfg | 2 + - common/Makefile | 1 + - common/cmd_multiboot.c | 312 +++++ - drivers/video/cfb_console.c | 12 + - include/configs/udoo.h | 268 ++++ - include/micrel.h | 5 + - include/video.h | 2 + - 21 files changed, 5482 insertions(+), 27 deletions(-) + arch/arm/cpu/armv7/cpu.c | 14 + + arch/arm/imx-common/Makefile | 2 + + arch/arm/imx-common/cmd_plotmsg.c | 74 ++++ + arch/arm/imx-common/sata.c | 33 ++ + arch/arm/include/asm/imx-common/sata.h | 17 + + board/udoo/1066mhz_4x256mx16_dl.cfg | 58 ++++ + board/udoo/1066mhz_4x256mx16_q.cfg | 63 ++++ + board/udoo/Makefile | 30 ++ + board/udoo/clocks.cfg | 31 ++ + board/udoo/ddr-setup_dl.cfg | 85 +++++ + board/udoo/ddr-setup_q.cfg | 87 +++++ + board/udoo/udoo.c | 607 +++++++++++++++++++++++++++++++++ + board/udoo/udoo.cfg | 41 +++ + board/udoo/udoo_spl.c | 404 ++++++++++++++++++++++ + boards.cfg | 3 + + common/Makefile | 1 + + common/cmd_multiboot.c | 312 +++++++++++++++++ + drivers/video/cfb_console.c | 12 + + include/configs/udoo.h | 302 ++++++++++++++++ + include/micrel.h | 5 + + include/video.h | 2 + + 21 files changed, 2183 insertions(+) create mode 100644 arch/arm/imx-common/cmd_plotmsg.c create mode 100644 arch/arm/imx-common/sata.c create mode 100644 arch/arm/include/asm/imx-common/sata.h @@ -48,11 +37,12 @@ make udoo_dl_config create mode 100644 board/udoo/ddr-setup_q.cfg create mode 100644 board/udoo/udoo.c create mode 100644 board/udoo/udoo.cfg + create mode 100644 board/udoo/udoo_spl.c create mode 100644 common/cmd_multiboot.c create mode 100644 include/configs/udoo.h diff --git a/arch/arm/cpu/armv7/cpu.c b/arch/arm/cpu/armv7/cpu.c -index 01cdb7e..177e0a2 100644 +index 01cdb7e..654e526 100644 --- a/arch/arm/cpu/armv7/cpu.c +++ b/arch/arm/cpu/armv7/cpu.c @@ -20,10 +20,20 @@ @@ -247,60 +237,6 @@ index 0000000..40fbf77 + +#endif + -diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c -index 2b61e5d..0c26bcb 100644 ---- a/board/boundary/nitrogen6x/nitrogen6x.c -+++ b/board/boundary/nitrogen6x/nitrogen6x.c -@@ -2,7 +2,7 @@ - * Copyright (C) 2010-2013 Freescale Semiconductor, Inc. - * Copyright (C) 2013, Boundary Devices - * -- * SPDX-License-Identifier: GPL-2.0+ -+ * SPDX-License-Identifier: GPL-2.0+ - */ - - #include -@@ -17,6 +17,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -378,32 +379,6 @@ static void setup_buttons(void) - ARRAY_SIZE(button_pads)); - } - --#ifdef CONFIG_CMD_SATA -- --int setup_sata(void) --{ -- struct iomuxc_base_regs *const iomuxc_regs -- = (struct iomuxc_base_regs *) IOMUXC_BASE_ADDR; -- int ret = enable_sata_clock(); -- if (ret) -- return ret; -- -- clrsetbits_le32(&iomuxc_regs->gpr[13], -- IOMUXC_GPR13_SATA_MASK, -- IOMUXC_GPR13_SATA_PHY_8_RXEQ_3P0DB -- |IOMUXC_GPR13_SATA_PHY_7_SATA2M -- |IOMUXC_GPR13_SATA_SPEED_3G -- |(3< ++ * Adapted for SPL support by Peter Vicman + * + * SPDX-License-Identifier: GPL-2.0+ + */ @@ -726,6 +667,34 @@ index 0000000..239f0d8 + +DECLARE_GLOBAL_DATA_PTR; + ++/* copied from u-boot-2015.07/arch/arm/include/asm/imx-common/iomux-v3.h */ ++/* macros for declaring and using pinmux array */ ++#if defined(CONFIG_MX6QDL) ++#define IOMUX_PADS(x) (MX6Q_##x), (MX6DL_##x) ++#define SETUP_IOMUX_PAD(def) \ ++if (is_cpu_type(MXC_CPU_MX6Q)) { \ ++ imx_iomux_v3_setup_multiple_pads(MX6Q_##def); \ ++} else { \ ++ imx_iomux_v3_setup_multiple_pads(MX6DL_##def); \ ++} ++#define SETUP_IOMUX_PADS(x) \ ++ spl_imx_iomux_v3_setup_multiple_pads(x, ARRAY_SIZE(x)/2) ++ ++#elif defined(CONFIG_MX6Q) || defined(CONFIG_MX6D) ++#define IOMUX_PADS(x) MX6_##x ++#define SETUP_IOMUX_PAD(def) \ ++ imx_iomux_v3_setup_pad(MX6Q_##def); ++#define SETUP_IOMUX_PADS(x) \ ++ spl_imx_iomux_v3_setup_multiple_pads(x, ARRAY_SIZE(x)) ++ ++#else ++#define IOMUX_PADS(x) MX6_##x ++#define SETUP_IOMUX_PAD(def) \ ++ imx_iomux_v3_setup_pad(MX6DL_##def); ++#define SETUP_IOMUX_PADS(x) \ ++ spl_imx_iomux_v3_setup_multiple_pads(x, ARRAY_SIZE(x)) ++#endif ++ +#define UART_PAD_CTRL (PAD_CTL_PUS_100K_UP | \ + PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | \ + PAD_CTL_SRE_FAST | PAD_CTL_HYS) @@ -740,6 +709,30 @@ index 0000000..239f0d8 +#define WDT_EN IMX_GPIO_NR(5, 4) +#define WDT_TRG IMX_GPIO_NR(3, 19) + ++/* copied from u-boot-2015.07/arch/arm/imx-common/iomux-v3.c */ ++#define MXC_CPU_MX6D 0x64 ++ ++/* configures a list of pads within declared with IOMUX_PADS macro */ ++static void spl_imx_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t const *pad_list, ++ unsigned count) ++{ ++ iomux_v3_cfg_t const *p = pad_list; ++ int stride; ++ int i; ++ ++#if defined(CONFIG_MX6QDL) ++ stride = 2; ++ if (!is_cpu_type(MXC_CPU_MX6Q) && !is_cpu_type(MXC_CPU_MX6D)) ++ p += 1; ++#else ++ stride = 1; ++#endif ++ for (i = 0; i < count; i++) { ++ imx_iomux_v3_setup_pad(*p); ++ p += stride; ++ } ++} ++ +int dram_init(void) +{ + gd->ram_size = (phys_size_t)CONFIG_DDR_MB * 1024 * 1024; @@ -748,27 +741,27 @@ index 0000000..239f0d8 +} + +static iomux_v3_cfg_t const uart2_pads[] = { -+ MX6_PAD_EIM_D26__UART2_TXD | MUX_PAD_CTRL(UART_PAD_CTRL), -+ MX6_PAD_EIM_D27__UART2_RXD | MUX_PAD_CTRL(UART_PAD_CTRL), ++ IOMUX_PADS(PAD_EIM_D26__UART2_TXD | MUX_PAD_CTRL(UART_PAD_CTRL)), ++ IOMUX_PADS(PAD_EIM_D27__UART2_RXD | MUX_PAD_CTRL(UART_PAD_CTRL)), +}; + +static iomux_v3_cfg_t const usdhc3_pads[] = { -+ MX6_PAD_SD3_CLK__USDHC3_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL), -+ MX6_PAD_SD3_CMD__USDHC3_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL), -+ MX6_PAD_SD3_DAT0__USDHC3_DAT0 | MUX_PAD_CTRL(USDHC_PAD_CTRL), -+ MX6_PAD_SD3_DAT1__USDHC3_DAT1 | MUX_PAD_CTRL(USDHC_PAD_CTRL), -+ MX6_PAD_SD3_DAT2__USDHC3_DAT2 | MUX_PAD_CTRL(USDHC_PAD_CTRL), -+ MX6_PAD_SD3_DAT3__USDHC3_DAT3 | MUX_PAD_CTRL(USDHC_PAD_CTRL), ++ IOMUX_PADS(PAD_SD3_CLK__USDHC3_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL)), ++ IOMUX_PADS(PAD_SD3_CMD__USDHC3_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL)), ++ IOMUX_PADS(PAD_SD3_DAT0__USDHC3_DAT0 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), ++ IOMUX_PADS(PAD_SD3_DAT1__USDHC3_DAT1 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), ++ IOMUX_PADS(PAD_SD3_DAT2__USDHC3_DAT2 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), ++ IOMUX_PADS(PAD_SD3_DAT3__USDHC3_DAT3 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), +}; + +static iomux_v3_cfg_t const wdog_pads[] = { -+ MX6_PAD_EIM_A24__GPIO_5_4 | MUX_PAD_CTRL(NO_PAD_CTRL), -+ MX6_PAD_EIM_D19__GPIO_3_19, ++ IOMUX_PADS(PAD_EIM_A24__GPIO_5_4 | MUX_PAD_CTRL(NO_PAD_CTRL)), ++ IOMUX_PADS(PAD_EIM_D19__GPIO_3_19), +}; + +static iomux_v3_cfg_t const lvds_pads[] = { -+ MX6_PAD_GPIO_2__GPIO_1_2 | MUX_PAD_CTRL(NO_PAD_CTRL), -+ MX6_PAD_GPIO_4__GPIO_1_4 | MUX_PAD_CTRL(NO_PAD_CTRL), ++ IOMUX_PADS(PAD_GPIO_2__GPIO_1_2 | MUX_PAD_CTRL(NO_PAD_CTRL)), ++ IOMUX_PADS(PAD_GPIO_4__GPIO_1_4 | MUX_PAD_CTRL(NO_PAD_CTRL)), +}; + +int mx6_rgmii_rework(struct phy_device *phydev) @@ -802,43 +795,43 @@ index 0000000..239f0d8 +} + +static iomux_v3_cfg_t const enet_pads1[] = { -+ MX6_PAD_ENET_MDIO__ENET_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL), -+ MX6_PAD_ENET_MDC__ENET_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL), -+ MX6_PAD_RGMII_TXC__ENET_RGMII_TXC | MUX_PAD_CTRL(ENET_PAD_CTRL), -+ MX6_PAD_RGMII_TD0__ENET_RGMII_TD0 | MUX_PAD_CTRL(ENET_PAD_CTRL), -+ MX6_PAD_RGMII_TD1__ENET_RGMII_TD1 | MUX_PAD_CTRL(ENET_PAD_CTRL), -+ MX6_PAD_RGMII_TD2__ENET_RGMII_TD2 | MUX_PAD_CTRL(ENET_PAD_CTRL), -+ MX6_PAD_RGMII_TD3__ENET_RGMII_TD3 | MUX_PAD_CTRL(ENET_PAD_CTRL), -+ MX6_PAD_RGMII_TX_CTL__RGMII_TX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL), -+ MX6_PAD_ENET_REF_CLK__ENET_TX_CLK | MUX_PAD_CTRL(ENET_PAD_CTRL), -+ MX6_PAD_RGMII_RXC__ENET_RGMII_RXC | MUX_PAD_CTRL(ENET_PAD_CTRL), ++ IOMUX_PADS(PAD_ENET_MDIO__ENET_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL)), ++ IOMUX_PADS(PAD_ENET_MDC__ENET_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL)), ++ IOMUX_PADS(PAD_RGMII_TXC__ENET_RGMII_TXC | MUX_PAD_CTRL(ENET_PAD_CTRL)), ++ IOMUX_PADS(PAD_RGMII_TD0__ENET_RGMII_TD0 | MUX_PAD_CTRL(ENET_PAD_CTRL)), ++ IOMUX_PADS(PAD_RGMII_TD1__ENET_RGMII_TD1 | MUX_PAD_CTRL(ENET_PAD_CTRL)), ++ IOMUX_PADS(PAD_RGMII_TD2__ENET_RGMII_TD2 | MUX_PAD_CTRL(ENET_PAD_CTRL)), ++ IOMUX_PADS(PAD_RGMII_TD3__ENET_RGMII_TD3 | MUX_PAD_CTRL(ENET_PAD_CTRL)), ++ IOMUX_PADS(PAD_RGMII_TX_CTL__RGMII_TX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL)), ++ IOMUX_PADS(PAD_ENET_REF_CLK__ENET_TX_CLK | MUX_PAD_CTRL(ENET_PAD_CTRL)), ++ IOMUX_PADS(PAD_RGMII_RXC__ENET_RGMII_RXC | MUX_PAD_CTRL(ENET_PAD_CTRL)), + /* RGMII reset */ -+ MX6_PAD_EIM_D23__GPIO_3_23 | MUX_PAD_CTRL(NO_PAD_CTRL), ++ IOMUX_PADS(PAD_EIM_D23__GPIO_3_23 | MUX_PAD_CTRL(NO_PAD_CTRL)), + /* alimentazione ethernet*/ -+ MX6_PAD_EIM_EB3__GPIO_2_31 | MUX_PAD_CTRL(NO_PAD_CTRL), ++ IOMUX_PADS(PAD_EIM_EB3__GPIO_2_31 | MUX_PAD_CTRL(NO_PAD_CTRL)), + /* pin 32 - 1 - (MODE0) all */ -+ MX6_PAD_RGMII_RD0__GPIO_6_25 | MUX_PAD_CTRL(NO_PAD_CTRL), ++ IOMUX_PADS(PAD_RGMII_RD0__GPIO_6_25 | MUX_PAD_CTRL(NO_PAD_CTRL)), + /* pin 31 - 1 - (MODE1) all */ -+ MX6_PAD_RGMII_RD1__GPIO_6_27 | MUX_PAD_CTRL(NO_PAD_CTRL), ++ IOMUX_PADS(PAD_RGMII_RD1__GPIO_6_27 | MUX_PAD_CTRL(NO_PAD_CTRL)), + /* pin 28 - 1 - (MODE2) all */ -+ MX6_PAD_RGMII_RD2__GPIO_6_28 | MUX_PAD_CTRL(NO_PAD_CTRL), ++ IOMUX_PADS(PAD_RGMII_RD2__GPIO_6_28 | MUX_PAD_CTRL(NO_PAD_CTRL)), + /* pin 27 - 1 - (MODE3) all */ -+ MX6_PAD_RGMII_RD3__GPIO_6_29 | MUX_PAD_CTRL(NO_PAD_CTRL), ++ IOMUX_PADS(PAD_RGMII_RD3__GPIO_6_29 | MUX_PAD_CTRL(NO_PAD_CTRL)), + /* pin 33 - 1 - (CLK125_EN) 125Mhz clockout enabled */ -+ MX6_PAD_RGMII_RX_CTL__GPIO_6_24 | MUX_PAD_CTRL(NO_PAD_CTRL), ++ IOMUX_PADS(PAD_RGMII_RX_CTL__GPIO_6_24 | MUX_PAD_CTRL(NO_PAD_CTRL)), +}; + +static iomux_v3_cfg_t const enet_pads2[] = { -+ MX6_PAD_RGMII_RD0__ENET_RGMII_RD0 | MUX_PAD_CTRL(ENET_PAD_CTRL), -+ MX6_PAD_RGMII_RD1__ENET_RGMII_RD1 | MUX_PAD_CTRL(ENET_PAD_CTRL), -+ MX6_PAD_RGMII_RD2__ENET_RGMII_RD2 | MUX_PAD_CTRL(ENET_PAD_CTRL), -+ MX6_PAD_RGMII_RD3__ENET_RGMII_RD3 | MUX_PAD_CTRL(ENET_PAD_CTRL), -+ MX6_PAD_RGMII_RX_CTL__RGMII_RX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL), ++ IOMUX_PADS(PAD_RGMII_RD0__ENET_RGMII_RD0 | MUX_PAD_CTRL(ENET_PAD_CTRL)), ++ IOMUX_PADS(PAD_RGMII_RD1__ENET_RGMII_RD1 | MUX_PAD_CTRL(ENET_PAD_CTRL)), ++ IOMUX_PADS(PAD_RGMII_RD2__ENET_RGMII_RD2 | MUX_PAD_CTRL(ENET_PAD_CTRL)), ++ IOMUX_PADS(PAD_RGMII_RD3__ENET_RGMII_RD3 | MUX_PAD_CTRL(ENET_PAD_CTRL)), ++ IOMUX_PADS(PAD_RGMII_RX_CTL__RGMII_RX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL)), +}; + +static void setup_iomux_enet(void) +{ -+ imx_iomux_v3_setup_multiple_pads(enet_pads1, ARRAY_SIZE(enet_pads1)); ++ SETUP_IOMUX_PADS(enet_pads1); + udelay(20); + gpio_direction_output(IMX_GPIO_NR(2, 31), 1); /* Power on enet */ + @@ -862,17 +855,17 @@ index 0000000..239f0d8 + gpio_free(IMX_GPIO_NR(6, 28)); + gpio_free(IMX_GPIO_NR(6, 29)); + -+ imx_iomux_v3_setup_multiple_pads(enet_pads2, ARRAY_SIZE(enet_pads2)); ++ SETUP_IOMUX_PADS(enet_pads2); +} + +static void setup_iomux_uart(void) +{ -+ imx_iomux_v3_setup_multiple_pads(uart2_pads, ARRAY_SIZE(uart2_pads)); ++ SETUP_IOMUX_PADS(uart2_pads); +} + +static void setup_iomux_wdog(void) +{ -+ imx_iomux_v3_setup_multiple_pads(wdog_pads, ARRAY_SIZE(wdog_pads)); ++ SETUP_IOMUX_PADS(wdog_pads); + gpio_direction_output(WDT_TRG, 0); + gpio_direction_output(WDT_EN, 1); + gpio_direction_input(WDT_TRG); @@ -918,7 +911,7 @@ index 0000000..239f0d8 + +int board_mmc_init(bd_t *bis) +{ -+ imx_iomux_v3_setup_multiple_pads(usdhc3_pads, ARRAY_SIZE(usdhc3_pads)); ++ SETUP_IOMUX_PADS(usdhc3_pads); + usdhc_cfg.sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK); + usdhc_cfg.max_bus_width = 4; + @@ -954,7 +947,7 @@ index 0000000..239f0d8 + +static void do_enable_lvds(struct display_info_t const *dev) +{ -+ imx_iomux_v3_setup_multiple_pads(lvds_pads, ARRAY_SIZE(lvds_pads)); ++ SETUP_IOMUX_PADS(lvds_pads); + gpio_direction_output(IMX_GPIO_NR(1, 2), 1); /* LVDS power On */ + gpio_direction_output(IMX_GPIO_NR(1, 4), 1); /* LVDS backlight On */ + return; @@ -1195,6 +1188,16 @@ index 0000000..239f0d8 + return 0; +} + ++int board_late_init(void) ++{ ++ if (is_cpu_type(MXC_CPU_MX6Q)) ++ setenv("board_rev", "MX6Q"); ++ else ++ setenv("board_rev", "MX6DL"); ++ ++ return 0; ++} ++ +int board_phy_config(struct phy_device *phydev) +{ + mx6_rgmii_rework(phydev); @@ -1222,23 +1225,27 @@ index 0000000..239f0d8 + gd->bd->bi_boot_params = PHYS_SDRAM + 0x100; + +#ifdef CONFIG_CMD_SATA -+ sata_setup(); ++ if (is_cpu_type(MXC_CPU_MX6Q)) ++ sata_setup(); +#endif + return 0; +} + +int checkboard(void) +{ -+ puts("Board: UDOO\n"); ++ if (is_cpu_type(MXC_CPU_MX6Q)) ++ puts("Board: Udoo Quad\n"); ++ else ++ puts("Board: Udoo DualLite\n"); + + return 0; +} diff --git a/board/udoo/udoo.cfg b/board/udoo/udoo.cfg new file mode 100644 -index 0000000..eb1102b +index 0000000..2519f14 --- /dev/null +++ b/board/udoo/udoo.cfg -@@ -0,0 +1,35 @@ +@@ -0,0 +1,41 @@ +/* + * Copyright (C) 2013 Seco USA Inc + * @@ -1261,10 +1268,15 @@ index 0000000..eb1102b + +#define __ASSEMBLY__ +#include ++ ++#ifndef CONFIG_SPL +#include "asm/arch/mx6-ddr.h" ++#endif ++ +#include "asm/arch/iomux.h" +#include "asm/arch/crm_regs.h" + ++#ifndef CONFIG_SPL +#if defined(CONFIG_MX6Q) +#include "ddr-setup_q.cfg" +#include "1066mhz_4x256mx16_q.cfg" @@ -1272,18 +1284,430 @@ index 0000000..eb1102b +#include "ddr-setup_dl.cfg" +#include "1066mhz_4x256mx16_dl.cfg" +#endif ++#endif + +#include "clocks.cfg" +diff --git a/board/udoo/udoo_spl.c b/board/udoo/udoo_spl.c +new file mode 100644 +index 0000000..db5044a +--- /dev/null ++++ b/board/udoo/udoo_spl.c +@@ -0,0 +1,404 @@ ++/* ++ * Author: Tungyi Lin ++ * ++ * Derived from EDM_CF_IMX6 code by TechNexion,Inc ++ * Ported to SolidRun microSOM by Rabeeh Khoury ++ * Ported to Udoo from mx6_cubox-i_spl.c by Peter Vicman ++ * ++ * SPDX-License-Identifier: GPL-2.0+ ++ */ ++#include ++#include ++#include ++#ifdef CONFIG_SPL ++#include ++#include ++#endif ++#include ++#include ++#include ++#include ++#include "asm/arch/mx6_ddr_regs.h" ++ ++#define CONFIG_SPL_STACK 0x0091FFB8 ++ ++DECLARE_GLOBAL_DATA_PTR; ++ ++#define UART_PAD_CTRL (PAD_CTL_PUS_100K_UP | \ ++ PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | \ ++ PAD_CTL_SRE_FAST | PAD_CTL_HYS) ++ ++static void spl_mx6dl_dram_setup_iomux(void) ++{ ++ volatile struct mx6sdl_iomux_ddr_regs *mx6dl_ddr_iomux; ++ volatile struct mx6sdl_iomux_grp_regs *mx6dl_grp_iomux; ++ ++ mx6dl_ddr_iomux = (struct mx6sdl_iomux_ddr_regs *) MX6SDL_IOM_DDR_BASE; ++ mx6dl_grp_iomux = (struct mx6sdl_iomux_grp_regs *) MX6SDL_IOM_GRP_BASE; ++ ++ /* ddr-setup_dl.cfg */ ++ mx6dl_ddr_iomux->dram_sdqs0 = 0x00000028; ++ mx6dl_ddr_iomux->dram_sdqs1 = 0x00000028; ++ mx6dl_ddr_iomux->dram_sdqs2 = 0x00000028; ++ mx6dl_ddr_iomux->dram_sdqs3 = 0x00000028; ++ mx6dl_ddr_iomux->dram_sdqs4 = 0x00000028; ++ mx6dl_ddr_iomux->dram_sdqs5 = 0x00000028; ++ mx6dl_ddr_iomux->dram_sdqs6 = 0x00000028; ++ mx6dl_ddr_iomux->dram_sdqs7 = 0x00000028; ++ ++ mx6dl_grp_iomux->grp_b0ds = 0x00000028; ++ mx6dl_grp_iomux->grp_b1ds = 0x00000028; ++ mx6dl_grp_iomux->grp_b2ds = 0x00000028; ++ mx6dl_grp_iomux->grp_b3ds = 0x00000028; ++ mx6dl_grp_iomux->grp_b4ds = 0x00000028; ++ mx6dl_grp_iomux->grp_b5ds = 0x00000028; ++ mx6dl_grp_iomux->grp_b6ds = 0x00000028; ++ mx6dl_grp_iomux->grp_b7ds = 0x00000028; ++ mx6dl_grp_iomux->grp_addds = 0x00000028; ++ ++ mx6dl_grp_iomux->grp_ctlds = 0x00000028; ++ ++ mx6dl_ddr_iomux->dram_dqm0 = 0x00000028; ++ mx6dl_ddr_iomux->dram_dqm1 = 0x00000028; ++ mx6dl_ddr_iomux->dram_dqm2 = 0x00000028; ++ mx6dl_ddr_iomux->dram_dqm3 = 0x00000028; ++ mx6dl_ddr_iomux->dram_dqm4 = 0x00000028; ++ mx6dl_ddr_iomux->dram_dqm5 = 0x00000028; ++ mx6dl_ddr_iomux->dram_dqm6 = 0x00000028; ++ mx6dl_ddr_iomux->dram_dqm7 = 0x00000028; ++ ++ mx6dl_ddr_iomux->dram_cas = 0x00000028; ++ mx6dl_ddr_iomux->dram_ras = 0x00000028; ++ mx6dl_ddr_iomux->dram_sdclk_0 = 0x00000028; ++ mx6dl_ddr_iomux->dram_sdclk_1 = 0x00000028; ++ ++ mx6dl_ddr_iomux->dram_reset = 0x00000028; ++ ++ mx6dl_ddr_iomux->dram_sdodt0 = 0x00000028; ++ mx6dl_ddr_iomux->dram_sdodt1 = 0x00000028; ++ ++ /* (differential input) */ ++ mx6dl_grp_iomux->grp_ddrmode_ctl = 0x00020000; ++ /* (differential input) */ ++ mx6dl_grp_iomux->grp_ddrmode = 0x00020000; ++ /* disable ddr pullups */ ++ mx6dl_grp_iomux->grp_ddrpke = 0x00000000; ++ mx6dl_ddr_iomux->dram_sdba2 = 0x00000000; ++ /* 40 Ohm drive strength for cs0/1,sdba2,cke0/1,sdwe */ ++ mx6dl_grp_iomux->grp_ddr_type = 0x000C0000; ++} ++ ++static void spl_mx6q_dram_setup_iomux(void) ++{ ++ volatile struct mx6qd_iomux_ddr_regs *mx6q_ddr_iomux; ++ volatile struct mx6qd_iomux_grp_regs *mx6q_grp_iomux; ++ ++ mx6q_ddr_iomux = (struct mx6qd_iomux_ddr_regs *) MX6DQ_IOM_DDR_BASE; ++ mx6q_grp_iomux = (struct mx6qd_iomux_grp_regs *) MX6DQ_IOM_GRP_BASE; ++ ++ /* ddr-setup_q.cfg */ ++ mx6q_ddr_iomux->dram_sdqs0 = 0x00000030; ++ mx6q_ddr_iomux->dram_sdqs1 = 0x00000030; ++ mx6q_ddr_iomux->dram_sdqs2 = 0x00000030; ++ mx6q_ddr_iomux->dram_sdqs3 = 0x00000030; ++ mx6q_ddr_iomux->dram_sdqs4 = 0x00000030; ++ mx6q_ddr_iomux->dram_sdqs5 = 0x00000030; ++ mx6q_ddr_iomux->dram_sdqs6 = 0x00000030; ++ mx6q_ddr_iomux->dram_sdqs7 = 0x00000030; ++ ++ mx6q_grp_iomux->grp_b0ds = 0x00000030; ++ mx6q_grp_iomux->grp_b1ds = 0x00000030; ++ mx6q_grp_iomux->grp_b2ds = 0x00000030; ++ mx6q_grp_iomux->grp_b3ds = 0x00000030; ++ mx6q_grp_iomux->grp_b4ds = 0x00000030; ++ mx6q_grp_iomux->grp_b5ds = 0x00000030; ++ mx6q_grp_iomux->grp_b6ds = 0x00000030; ++ mx6q_grp_iomux->grp_b7ds = 0x00000030; ++ mx6q_grp_iomux->grp_addds = 0x00000030; ++ /* 40 Ohm drive strength for cs0/1,sdba2,cke0/1,sdwe */ ++ mx6q_grp_iomux->grp_ctlds = 0x00000030; ++ ++ mx6q_ddr_iomux->dram_dqm0 = 0x00020030; ++ mx6q_ddr_iomux->dram_dqm1 = 0x00020030; ++ mx6q_ddr_iomux->dram_dqm2 = 0x00020030; ++ mx6q_ddr_iomux->dram_dqm3 = 0x00020030; ++ mx6q_ddr_iomux->dram_dqm4 = 0x00020030; ++ mx6q_ddr_iomux->dram_dqm5 = 0x00020030; ++ mx6q_ddr_iomux->dram_dqm6 = 0x00020030; ++ mx6q_ddr_iomux->dram_dqm7 = 0x00020030; ++ ++ mx6q_ddr_iomux->dram_cas = 0x00020030; ++ mx6q_ddr_iomux->dram_ras = 0x00020030; ++ mx6q_ddr_iomux->dram_sdclk_0 = 0x00020030; ++ mx6q_ddr_iomux->dram_sdclk_1 = 0x00020030; ++ ++ mx6q_ddr_iomux->dram_reset = 0x00020030; ++ mx6q_ddr_iomux->dram_sdcke0 = 0x00003000; ++ mx6q_ddr_iomux->dram_sdcke1 = 0x00003000; ++ ++ mx6q_ddr_iomux->dram_sdodt0 = 0x00003030; ++ mx6q_ddr_iomux->dram_sdodt1 = 0x00003030; ++ ++ /* (differential input) */ ++ mx6q_grp_iomux->grp_ddrmode_ctl = 0x00020000; ++ /* (differential input) */ ++ mx6q_grp_iomux->grp_ddrmode = 0x00020000; ++ /* disable ddr pullups */ ++ mx6q_grp_iomux->grp_ddrpke = 0x00000000; ++ mx6q_ddr_iomux->dram_sdba2 = 0x00000000; ++ /* 40 Ohm drive strength for cs0/1,sdba2,cke0/1,sdwe */ ++ mx6q_grp_iomux->grp_ddr_type = 0x000c0000; ++} ++ ++/* Udoo DualLite 1GByte memory ++ Micron MT41K128M16JT-125 */ ++static void spl_dram_init_mx6dl_1g(void) ++{ ++ volatile struct mmdc_p_regs *mmdc_p0; ++ volatile struct mmdc_p_regs *mmdc_p1; ++ mmdc_p0 = (struct mmdc_p_regs *) MMDC_P0_BASE_ADDR; ++ mmdc_p1 = (struct mmdc_p_regs *) MMDC_P1_BASE_ADDR; ++ ++ /* end of ddr-setup_dl.cfg */ ++ /* Read data DQ Byte0-3 delay */ ++ mmdc_p0->mprddqby0dl = 0x33333333; ++ mmdc_p0->mprddqby1dl = 0x33333333; ++ mmdc_p0->mprddqby2dl = 0x33333333; ++ mmdc_p0->mprddqby3dl = 0x33333333; ++ mmdc_p1->mprddqby0dl = 0x33333333; ++ mmdc_p1->mprddqby1dl = 0x33333333; ++ mmdc_p1->mprddqby2dl = 0x33333333; ++ mmdc_p1->mprddqby3dl = 0x33333333; ++ ++ /* 1066mhz_4x256mx16_dl.cfg */ ++ mmdc_p0->mdpdc = 0x0002002D; ++ mmdc_p0->mdotc = 0x00333040; ++ ++ mmdc_p0->mdcfg0 = 0x3F4352F3; ++ mmdc_p0->mdcfg1 = 0xB66D8B63; ++ mmdc_p0->mdcfg2 = 0x01FF00DB; ++ ++ mmdc_p0->mdmisc = 0x00001740; ++ mmdc_p0->mdscr = 0x00008000; ++ mmdc_p0->mdrwd = 0x000026D2; ++ ++ mmdc_p0->mdor = 0x00431023; ++ mmdc_p0->mdasp = 0x00000027; ++ mmdc_p0->mdctl = 0x831A0000; ++ ++ mmdc_p0->mdscr = 0x02008032; ++ mmdc_p0->mdscr = 0x00008033; ++ mmdc_p0->mdscr = 0x00048031; ++ mmdc_p0->mdscr = 0x05208030; ++ mmdc_p0->mdscr = 0x04008040; ++ ++ mmdc_p0->mpzqhwctrl = 0xa1390003; ++ mmdc_p1->mpzqhwctrl = 0xa1390003; ++ ++ mmdc_p0->mdref = 0x00007800; ++ ++ mmdc_p0->mpodtctrl = 0x00022227; ++ mmdc_p1->mpodtctrl = 0x00022227; ++ ++ mmdc_p0->mpdgctrl0 = 0x425C0251; ++ mmdc_p0->mpdgctrl1 = 0x021B021E; ++ mmdc_p1->mpdgctrl0 = 0x021B021E; ++ mmdc_p1->mpdgctrl1 = 0x01730200; ++ ++ mmdc_p0->mprddlctl = 0x45474C45; ++ mmdc_p1->mprddlctl = 0x44464744; ++ mmdc_p0->mpwrdlctl = 0x3F3F3336; ++ mmdc_p1->mpwrdlctl = 0x32383630; ++ ++ mmdc_p0->mpwldectrl0 = 0x002F0038; ++ mmdc_p0->mpwldectrl1 = 0x001F001F; ++ mmdc_p1->mpwldectrl0 = 0x001F001F; ++ mmdc_p1->mpwldectrl1 = 0x001F001F; ++ ++ mmdc_p0->mpmur0 = 0x00000000; ++ mmdc_p1->mpmur0 = 0x00000000; ++ ++ mmdc_p0->mdpdc = 0x0002556D; ++ mmdc_p0->mapsr = 0x00011006; ++ mmdc_p0->mdscr = 0x00000000; ++} ++ ++/* Udoo Quad 1GByte memory ++ Micron MT41K128M16JT-125 */ ++static void spl_dram_init_mx6q_1g(void) ++{ ++ volatile struct mmdc_p_regs *mmdc_p0; ++ volatile struct mmdc_p_regs *mmdc_p1; ++ mmdc_p0 = (struct mmdc_p_regs *) MMDC_P0_BASE_ADDR; ++ mmdc_p1 = (struct mmdc_p_regs *) MMDC_P1_BASE_ADDR; ++ ++ /* end of ddr-setup_q.cfg */ ++ /* Read data DQ Byte0-3 delay */ ++ mmdc_p0->mprddqby0dl = 0x33333333; ++ mmdc_p0->mprddqby1dl = 0x33333333; ++ mmdc_p0->mprddqby2dl = 0x33333333; ++ mmdc_p0->mprddqby3dl = 0x33333333; ++ mmdc_p1->mprddqby0dl = 0x33333333; ++ mmdc_p1->mprddqby1dl = 0x33333333; ++ mmdc_p1->mprddqby2dl = 0x33333333; ++ mmdc_p1->mprddqby3dl = 0x33333333; ++ ++ /* 1066mhz_4x256mx16_q.cfg */ ++ mmdc_p0->mdpdc = 0x00020036; ++ mmdc_p0->mdotc = 0x09444040; ++ ++ mmdc_p0->mdcfg0 = 0x54597955; ++ mmdc_p0->mdcfg1 = 0xFF328F64; ++ mmdc_p0->mdcfg2 = 0x01FF00DB; ++ ++ mmdc_p0->mdmisc = 0x00001740; ++ mmdc_p0->mdscr = 0x00008000; ++ mmdc_p0->mdrwd = 0x000026D2; ++ ++ mmdc_p0->mdor = 0x00591023; ++ mmdc_p0->mdasp = 0x00000027; ++ mmdc_p0->mdctl = 0x831A0000; ++ ++ mmdc_p0->mdscr = 0x04088032; ++ mmdc_p0->mdscr = 0x00008033; ++ mmdc_p0->mdscr = 0x00048031; ++ mmdc_p0->mdscr = 0x09408030; ++ mmdc_p0->mdscr = 0x04008040; ++ ++ mmdc_p0->mpzqhwctrl = 0xA1380003; ++ mmdc_p1->mpzqhwctrl = 0xA1380003; ++ ++ mmdc_p0->mdref = 0x00005800; ++ ++ mmdc_p0->mpodtctrl = 0x00011117; ++ mmdc_p1->mpodtctrl = 0x00011117; ++ ++ mmdc_p0->mpdgctrl0 = 0x43510360; ++ mmdc_p0->mpdgctrl1 = 0x0342033F; ++ mmdc_p1->mpdgctrl0 = 0x033F033F; ++ mmdc_p1->mpdgctrl1 = 0x03290266; ++ ++ mmdc_p0->mprddlctl = 0x4B3E4141; ++ mmdc_p1->mprddlctl = 0x47413B4A; ++ mmdc_p0->mpwrdlctl = 0x42404843; ++ mmdc_p1->mpwrdlctl = 0x4C3F4C45; ++ ++ mmdc_p0->mpwldectrl0 = 0x00350035; ++ mmdc_p0->mpwldectrl1 = 0x001F001F; ++ mmdc_p1->mpwldectrl0 = 0x00010001; ++ mmdc_p1->mpwldectrl1 = 0x00010001; ++ ++ mmdc_p0->mpmur0 = 0x00000800; ++ mmdc_p1->mpmur0 = 0x00000800; ++ ++ mmdc_p0->mdpdc = 0x00025576; ++ mmdc_p0->mapsr = 0x00011006; ++ mmdc_p0->mdscr = 0x00000000; ++} ++ ++static void spl_dram_init(void) ++{ ++ if (is_cpu_type(MXC_CPU_MX6Q)) { ++ spl_mx6q_dram_setup_iomux(); ++ spl_dram_init_mx6q_1g(); ++ } else { ++ spl_mx6dl_dram_setup_iomux(); ++ spl_dram_init_mx6dl_1g(); ++ } ++} ++ ++static void prefetch_enable(void) ++{ ++#ifdef CONFIG_SYS_PL310_BASE ++ u32 reg; ++ ++ writel(0x30000003, CONFIG_SYS_PL310_BASE + 0xf60); ++ ++ reg = readl(CONFIG_SYS_PL310_BASE + 0x104); ++ reg |= (1 << 30); ++ writel(reg, CONFIG_SYS_PL310_BASE + 0x104); ++#endif ++} ++ ++/* copied from u-boot-2015.07 */ ++static void ccgr_init(void) ++{ ++ struct mxc_ccm_reg *ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR; ++ ++ /* set the default clock gate to save power */ ++ writel(0x00C03F3F, &ccm->CCGR0); ++ writel(0x0030FC03, &ccm->CCGR1); ++ writel(0x0FFFC000, &ccm->CCGR2); ++ writel(0x3FF00000, &ccm->CCGR3); ++ writel(0x00FFF300, &ccm->CCGR4); ++ writel(0x0F0000C3, &ccm->CCGR5); ++ writel(0x000003FF, &ccm->CCGR6); ++} ++ ++/* copied from u-boot-2015.07 */ ++static void gpr_init(void) ++{ ++ struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR; ++ ++ /* enable AXI cache for VDOA/VPU/IPU */ ++ writel(0xF00000CF, &iomux->gpr[4]); ++ /* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */ ++ writel(0x007F007F, &iomux->gpr[6]); ++ writel(0x007F007F, &iomux->gpr[7]); ++} ++ ++void board_init_f(ulong dummy) ++{ ++ /* Set the stack pointer. */ ++ asm volatile("mov sp, %0\n" : : "r"(CONFIG_SPL_STACK)); ++ ++ spl_dram_init(); ++ ccgr_init(); ++ gpr_init(); ++ arch_cpu_init(); ++ ++ /* Clear the BSS. */ ++ memset(__bss_start, 0, __bss_end - __bss_start); ++ ++ /* Set global data pointer. */ ++ gd = &gdata; ++ gd->ram_size = CONFIG_DDR_MB * 1024 * 1024; /* both have 1 GB */; ++ ++ board_early_init_f(); ++ ++ timer_init(); ++ preloader_console_init(); ++ prefetch_enable(); ++ ++ board_init_r(NULL, 0); ++} ++ ++void spl_board_init(void) ++{ ++ return; /* nothing for now */ ++} ++ ++#ifdef CONFIG_SPL_OS_BOOT ++ ++int spl_start_uboot(void) ++{ ++ return 1; /* u-boot must be started */ ++} ++ ++#endif ++ ++u32 spl_boot_device(void) ++{ ++ printf("Boot Device: microSD card\n"); ++ return BOOT_DEVICE_MMC2; ++} ++ ++u32 spl_boot_mode(void) ++{ ++ return MMCSD_MODE; /* only microSD card */ ++} ++ ++void reset_cpu(ulong addr) ++{ ++ __REG16(WDOG1_BASE_ADDR) = 4; ++} diff --git a/boards.cfg b/boards.cfg -index 9480005..d20aebe 100644 +index 9480005..64c0cee 100644 --- a/boards.cfg +++ b/boards.cfg -@@ -286,6 +286,8 @@ Active arm armv7 mx5 freescale mx53smd +@@ -286,6 +286,9 @@ Active arm armv7 mx5 freescale mx53smd Active arm armv7 mx5 genesi mx51_efikamx mx51_efikamx mx51_efikamx:MACH_TYPE=MACH_TYPE_MX51_EFIKAMX,IMX_CONFIG=board/genesi/mx51_efikamx/imximage_mx.cfg - Active arm armv7 mx5 genesi mx51_efikamx mx51_efikasb mx51_efikamx:MACH_TYPE=MACH_TYPE_MX51_EFIKASB,IMX_CONFIG=board/genesi/mx51_efikamx/imximage_sb.cfg - Active arm armv7 mx5 ttcontrol vision2 vision2 vision2:IMX_CONFIG=board/ttcontrol/vision2/imximage_hynix.cfg Stefano Babic -+Active arm armv7 mx6 - udoo udoo_dl udoo:IMX_CONFIG=board/udoo/udoo.cfg,MX6DL,DDR_MB=1024 Fabio Estevam -+Active arm armv7 mx6 - udoo udoo_quad udoo:IMX_CONFIG=board/udoo/udoo.cfg,MX6Q,DDR_MB=1024 Fabio Estevam ++Active arm armv7 mx6 - udoo udoo udoo:IMX_CONFIG=board/udoo/udoo.cfg,MX6QDL,SPL,DDR_MB=1024 Fabio Estevam ++Active arm armv7 mx6 - udoo udoo_dl udoo:IMX_CONFIG=board/udoo/udoo.cfg,MX6DL,DDR_MB=1024 Fabio Estevam ++Active arm armv7 mx6 - udoo udoo_quad udoo:IMX_CONFIG=board/udoo/udoo.cfg,MX6Q,DDR_MB=1024 Fabio Estevam Active arm armv7 mx6 - wandboard wandboard_dl wandboard:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6dl.cfg,MX6DL,DDR_MB=1024 Fabio Estevam Active arm armv7 mx6 - wandboard wandboard_quad wandboard:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6q2g.cfg,MX6Q,DDR_MB=2048 Fabio Estevam Active arm armv7 mx6 - wandboard wandboard_solo wandboard:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6s.cfg,MX6S,DDR_MB=512 Fabio Estevam @@ -1650,10 +2074,10 @@ index c6f58c2..9293e8d 100644 * need to skip the video initialization. diff --git a/include/configs/udoo.h b/include/configs/udoo.h new file mode 100644 -index 0000000..e4077d4 +index 0000000..6d2c1b1 --- /dev/null +++ b/include/configs/udoo.h -@@ -0,0 +1,268 @@ +@@ -0,0 +1,302 @@ +/* + * Copyright (C) 2013 Freescale Semiconductor, Inc. + * @@ -1665,10 +2089,17 @@ index 0000000..e4077d4 +#ifndef __CONFIG_H +#define __CONFIG_H + ++#include "mx6_common.h" +#include +#include +#include + ++#ifdef CONFIG_SPL ++#include "imx6_spl.h" ++#define CONFIG_SPL_MMC_SUPPORT ++#define CONFIG_SPL_FAT_SUPPORT ++#endif ++ +#define CONFIG_MX6 +#define CONFIG_DISPLAY_CPUINFO +#define CONFIG_DISPLAY_BOARDINFO @@ -1688,6 +2119,7 @@ index 0000000..e4077d4 +#define CONFIG_SYS_MALLOC_LEN (10 * SZ_1M) + +#define CONFIG_BOARD_EARLY_INIT_F ++#define CONFIG_BOARD_LATE_INIT +#define CONFIG_MXC_GPIO + +#define CONFIG_MXC_UART @@ -1760,7 +2192,7 @@ index 0000000..e4077d4 +#define CONFIG_CMD_BMODE +#define CONFIG_CMD_SETEXPR + -+#define CONFIG_BOOTDELAY 5 ++#define CONFIG_BOOTDELAY 1 + +#define CONFIG_SYS_MEMTEST_START 0x10000000 +#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + 500 * SZ_1M) @@ -1778,101 +2210,127 @@ index 0000000..e4077d4 +#define CONFIG_BOUNCE_BUFFER +#define CONFIG_CMD_EXT2 +#define CONFIG_CMD_FAT ++#define CONFIG_CMD_EXT4 ++#define CONFIG_CMD_FS_GENERIC +#define CONFIG_DOS_PARTITION + -+#define CONFIG_DEFAULT_FDT_FILE "imx6q-udoo.dtb" ++#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG + +#define CONFIG_EXTRA_ENV_SETTINGS \ ++ "zImage=KERNEL\0" \ + "script=boot.scr\0" \ -+ "uimage=/boot/uImage\0" \ ++ "image=${zImage}\0" \ + "console=ttymxc1\0" \ + "splashpos=m,m\0" \ + "fdt_high=0xffffffff\0" \ + "initrd_high=0xffffffff\0" \ -+ "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \ -+ "fdt_addr=0x11000000\0" \ ++ "fdt_file=undefined\0" \ ++ "fdt_addr=0x18000000\0" \ + "boot_fdt=try\0" \ + "ip_dyn=yes\0" \ -+ "hdmi_patch=\0" \ ++ "optargs=\0" \ ++ "video=\0" \ + "mmcdev=0\0" \ + "mmcpart=1\0" \ -+ "mmcroot=/dev/mmcblk0p1 rootwait rw\0" \ ++ "mmcroot=/dev/mmcblk0p2 ro\0" \ ++ "mmcrootfstype=ext4 rootwait\0" \ + "update_sd_firmware_filename=u-boot.imx\0" \ + "update_sd_firmware=" \ -+ "if test ${ip_dyn} = yes; then " \ -+ "setenv get_cmd dhcp; " \ -+ "else " \ -+ "setenv get_cmd tftp; " \ -+ "fi; " \ -+ "if mmc dev ${mmcdev}; then " \ -+ "if ${get_cmd} ${update_sd_firmware_filename}; then " \ -+ "setexpr fw_sz ${filesize} / 0x200; " \ -+ "setexpr fw_sz ${fw_sz} + 1; " \ -+ "mmc write ${loadaddr} 0x2 ${fw_sz}; " \ -+ "fi; " \ -+ "fi\0" \ ++ "if test ${ip_dyn} = yes; then " \ ++ "setenv get_cmd dhcp; " \ ++ "else " \ ++ "setenv get_cmd tftp; " \ ++ "fi; " \ ++ "if mmc dev ${mmcdev}; then " \ ++ "if ${get_cmd} ${update_sd_firmware_filename}; then " \ ++ "setexpr fw_sz ${filesize} / 0x200; " \ ++ "setexpr fw_sz ${fw_sz} + 1; " \ ++ "mmc write ${loadaddr} 0x2 ${fw_sz}; " \ ++ "fi; " \ ++ "fi\0" \ + "mmcargs=setenv bootargs console=${console},${baudrate} " \ -+ "root=${mmcroot} " \ -+ "${hdmi_patch} " \ -+ "fbmem=24M video=mxcfb0:dev=hdmi,1920x1080M@60,bpp=32\0" \ ++ "${optargs} " \ ++ "root=${mmcroot} " \ ++ "rootfstype=${mmcrootfstype} " \ ++ "video=${video}\0" \ ++ "loadbootenv=load mmc ${mmcdev}:${mmcpart} ${loadaddr} uEnv.txt\0" \ ++ "importbootenv=echo Importing environment from mmc (uEnv.txt)...; " \ ++ "env import -t $loadaddr $filesize\0" \ + "loadbootscript=" \ -+ "ext2load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ ++ "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ + "bootscript=echo Running bootscript from mmc ...; " \ -+ "source\0" \ -+ "loaduimage=ext2load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \ -+ "loadfdt=ext2load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ ++ "source\0" \ ++ "loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${zImage}\0" \ ++ "loadzimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${zImage}\0" \ ++ "loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ + "mmcboot=echo Booting from mmc ...; " \ -+ "run mmcargs; " \ -+ "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ -+ "if run loadfdt; then " \ -+ "bootm ${loadaddr} - ${fdt_addr}; " \ -+ "else " \ -+ "if test ${boot_fdt} = try; then " \ -+ "bootm; " \ -+ "else " \ -+ "echo WARN: Cannot load the DT; " \ -+ "fi; " \ -+ "fi; " \ -+ "else " \ -+ "bootm; " \ -+ "fi;\0" \ ++ "run mmcargs; " \ ++ "bootz ${loadaddr} - ${fdt_addr};\0" \ ++ "mmcbootdefault=echo Booting from mmc ...; " \ ++ "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ ++ "if run loadfdt; then " \ ++ "bootz ${loadaddr} - ${fdt_addr}; " \ ++ "else " \ ++ "if test ${boot_fdt} = try; then " \ ++ "bootz ${loadaddr}; " \ ++ "else " \ ++ "echo WARN: Cannot load the DT; " \ ++ "fi; " \ ++ "fi; " \ ++ "else " \ ++ "bootz ${loadaddr}; " \ ++ "fi;\0" \ + "netargs=setenv bootargs console=${console},${baudrate} " \ -+ "root=/dev/nfs " \ -+ "${hdmi_patch} " \ ++ "root=/dev/nfs " \ + "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ -+ "netboot=echo Booting from net ...; " \ -+ "run netargs; " \ -+ "if test ${ip_dyn} = yes; then " \ -+ "setenv get_cmd dhcp; " \ -+ "else " \ -+ "setenv get_cmd tftp; " \ -+ "fi; " \ -+ "${get_cmd} ${uimage}; " \ -+ "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ -+ "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ -+ "bootm ${loadaddr} - ${fdt_addr}; " \ -+ "else " \ -+ "if test ${boot_fdt} = try; then " \ -+ "bootm; " \ -+ "else " \ -+ "echo WARN: Cannot load the DT; " \ -+ "fi; " \ -+ "fi; " \ -+ "else " \ -+ "bootm; " \ -+ "fi;\0" ++ "netboot=echo Booting from net ...; " \ ++ "run netargs; " \ ++ "if test ${ip_dyn} = yes; then " \ ++ "setenv get_cmd dhcp; " \ ++ "else " \ ++ "setenv get_cmd tftp; " \ ++ "fi; " \ ++ "${get_cmd} ${image}; " \ ++ "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ ++ "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ ++ "bootz ${loadaddr} - ${fdt_addr}; " \ ++ "else " \ ++ "if test ${boot_fdt} = try; then " \ ++ "bootz; " \ ++ "else " \ ++ "echo WARN: Cannot load the DT; " \ ++ "fi; " \ ++ "fi; " \ ++ "else " \ ++ "bootz; " \ ++ "fi;\0" \ ++ "findfdt=" \ ++ "if test $board_rev = MX6Q ; then " \ ++ "setenv fdt_file imx6q-udoo.dtb; fi; " \ ++ "if test $board_rev = MX6DL ; then " \ ++ "setenv fdt_file imx6dl-udoo.dtb; fi; " \ ++ "if test $fdt_file = undefined; then " \ ++ "echo WARNING: Could not determine dtb to use; fi; \0" + +#define CONFIG_BOOTCOMMAND \ -+ "mmc dev ${mmcdev}; if mmc rescan; then " \ -+ "if run loadbootscript; then " \ -+ "run bootscript; " \ -+ "else " \ -+ "if run loaduimage; then " \ -+ "run mmcboot; " \ -+ "else run netboot; " \ -+ "fi; " \ -+ "fi; " \ -+ "else run netboot; fi" ++ "run findfdt; " \ ++ "mmc dev ${mmcdev};" \ ++ "if mmc rescan; then " \ ++ "echo SD/MMC found on device ${mmcdev};" \ ++ "if run loadbootenv; then " \ ++ "run importbootenv;" \ ++ "fi;" \ ++ "echo Checking if uenvcmd is set ...;" \ ++ "if test -n $uenvcmd; then " \ ++ "echo Running uenvcmd ...;" \ ++ "run uenvcmd;" \ ++ "fi;" \ ++ "echo Running default loadimage ...;" \ ++ "if run loadimage; then " \ ++ "run loadfdt;" \ ++ "run mmcboot;" \ ++ "fi;" \ ++ "fi;" + +/* Miscellaneous configurable options */ +#define CONFIG_SYS_LONGHELP diff --git a/projects/imx6/patches/u-boot/101-udoo-uEnv.txt-bootz-n-fixes.patch b/projects/imx6/patches/u-boot/101-udoo-uEnv.txt-bootz-n-fixes.patch deleted file mode 100644 index bfe4f2afd9..0000000000 --- a/projects/imx6/patches/u-boot/101-udoo-uEnv.txt-bootz-n-fixes.patch +++ /dev/null @@ -1,206 +0,0 @@ -From 590891a15d4f3facafeb3186a8d3217f33343eb3 Mon Sep 17 00:00:00 2001 -From: Robert Nelson -Date: Wed, 23 Apr 2014 11:48:34 -0500 -Subject: [PATCH] udoo: uEnv.txt, bootz, n fixes - -diff -urN a/include/configs/udoo.h b/include/configs/udoo.h ---- a/include/configs/udoo.h 2014-11-29 15:55:08.877512289 +0100 -+++ b/include/configs/udoo.h 2014-11-29 16:14:42.716345900 +0100 -@@ -101,7 +101,7 @@ - #define CONFIG_CMD_BMODE - #define CONFIG_CMD_SETEXPR - --#define CONFIG_BOOTDELAY 5 -+#define CONFIG_BOOTDELAY 1 - - #define CONFIG_SYS_MEMTEST_START 0x10000000 - #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + 500 * SZ_1M) -@@ -119,101 +119,118 @@ - #define CONFIG_BOUNCE_BUFFER - #define CONFIG_CMD_EXT2 - #define CONFIG_CMD_FAT -+#define CONFIG_CMD_EXT4 -+#define CONFIG_CMD_FS_GENERIC - #define CONFIG_DOS_PARTITION - - #define CONFIG_DEFAULT_FDT_FILE "imx6q-udoo.dtb" - - #define CONFIG_EXTRA_ENV_SETTINGS \ - "script=boot.scr\0" \ -- "uimage=/boot/uImage\0" \ -+ "image=zImage\0" \ - "console=ttymxc1\0" \ - "splashpos=m,m\0" \ - "fdt_high=0xffffffff\0" \ - "initrd_high=0xffffffff\0" \ - "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \ -- "fdt_addr=0x11000000\0" \ -+ "fdt_addr=0x18000000\0" \ - "boot_fdt=try\0" \ - "ip_dyn=yes\0" \ -- "hdmi_patch=\0" \ -+ "optargs=\0" \ -+ "video=\0" \ - "mmcdev=0\0" \ - "mmcpart=1\0" \ -- "mmcroot=/dev/mmcblk0p1 rootwait rw\0" \ -+ "mmcroot=/dev/mmcblk0p2 ro\0" \ -+ "mmcrootfstype=ext4 rootwait\0" \ - "update_sd_firmware_filename=u-boot.imx\0" \ - "update_sd_firmware=" \ -- "if test ${ip_dyn} = yes; then " \ -- "setenv get_cmd dhcp; " \ -- "else " \ -- "setenv get_cmd tftp; " \ -- "fi; " \ -- "if mmc dev ${mmcdev}; then " \ -- "if ${get_cmd} ${update_sd_firmware_filename}; then " \ -- "setexpr fw_sz ${filesize} / 0x200; " \ -- "setexpr fw_sz ${fw_sz} + 1; " \ -- "mmc write ${loadaddr} 0x2 ${fw_sz}; " \ -- "fi; " \ -- "fi\0" \ -+ "if test ${ip_dyn} = yes; then " \ -+ "setenv get_cmd dhcp; " \ -+ "else " \ -+ "setenv get_cmd tftp; " \ -+ "fi; " \ -+ "if mmc dev ${mmcdev}; then " \ -+ "if ${get_cmd} ${update_sd_firmware_filename}; then " \ -+ "setexpr fw_sz ${filesize} / 0x200; " \ -+ "setexpr fw_sz ${fw_sz} + 1; " \ -+ "mmc write ${loadaddr} 0x2 ${fw_sz}; " \ -+ "fi; " \ -+ "fi\0" \ - "mmcargs=setenv bootargs console=${console},${baudrate} " \ -- "root=${mmcroot} " \ -- "${hdmi_patch} " \ -- "fbmem=24M video=mxcfb0:dev=hdmi,1920x1080M@60,bpp=32\0" \ -+ "${optargs} " \ -+ "root=${mmcroot} " \ -+ "rootfstype=${mmcrootfstype} " \ -+ "video=${video}\0" \ -+ "loadbootenv=load mmc ${mmcdev}:${mmcpart} ${loadaddr} uEnv.txt\0" \ -+ "importbootenv=echo Importing environment from mmc (uEnv.txt)...; " \ -+ "env import -t $loadaddr $filesize\0" \ - "loadbootscript=" \ -- "ext2load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ -+ "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ - "bootscript=echo Running bootscript from mmc ...; " \ -- "source\0" \ -- "loaduimage=ext2load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \ -- "loadfdt=ext2load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ -+ "source\0" \ -+ "loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} zImage\0" \ -+ "loadzimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} zImage\0" \ -+ "loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} /dtbs/${fdt_file}\0" \ - "mmcboot=echo Booting from mmc ...; " \ -- "run mmcargs; " \ -- "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ -- "if run loadfdt; then " \ -- "bootm ${loadaddr} - ${fdt_addr}; " \ -- "else " \ -- "if test ${boot_fdt} = try; then " \ -- "bootm; " \ -- "else " \ -- "echo WARN: Cannot load the DT; " \ -- "fi; " \ -- "fi; " \ -- "else " \ -- "bootm; " \ -- "fi;\0" \ -+ "run mmcargs; " \ -+ "bootz ${loadaddr} - ${fdt_addr};\0" \ -+ "mmcbootdefault=echo Booting from mmc ...; " \ -+ "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ -+ "if run loadfdt; then " \ -+ "bootz ${loadaddr} - ${fdt_addr}; " \ -+ "else " \ -+ "if test ${boot_fdt} = try; then " \ -+ "bootz ${loadaddr}; " \ -+ "else " \ -+ "echo WARN: Cannot load the DT; " \ -+ "fi; " \ -+ "fi; " \ -+ "else " \ -+ "bootz ${loadaddr}; " \ -+ "fi;\0" \ - "netargs=setenv bootargs console=${console},${baudrate} " \ -- "root=/dev/nfs " \ -- "${hdmi_patch} " \ -+ "root=/dev/nfs " \ - "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ -- "netboot=echo Booting from net ...; " \ -- "run netargs; " \ -- "if test ${ip_dyn} = yes; then " \ -- "setenv get_cmd dhcp; " \ -- "else " \ -- "setenv get_cmd tftp; " \ -- "fi; " \ -- "${get_cmd} ${uimage}; " \ -- "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ -- "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ -- "bootm ${loadaddr} - ${fdt_addr}; " \ -- "else " \ -- "if test ${boot_fdt} = try; then " \ -- "bootm; " \ -- "else " \ -- "echo WARN: Cannot load the DT; " \ -- "fi; " \ -- "fi; " \ -- "else " \ -- "bootm; " \ -- "fi;\0" -+ "netboot=echo Booting from net ...; " \ -+ "run netargs; " \ -+ "if test ${ip_dyn} = yes; then " \ -+ "setenv get_cmd dhcp; " \ -+ "else " \ -+ "setenv get_cmd tftp; " \ -+ "fi; " \ -+ "${get_cmd} ${image}; " \ -+ "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ -+ "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ -+ "bootz ${loadaddr} - ${fdt_addr}; " \ -+ "else " \ -+ "if test ${boot_fdt} = try; then " \ -+ "bootz; " \ -+ "else " \ -+ "echo WARN: Cannot load the DT; " \ -+ "fi; " \ -+ "fi; " \ -+ "else " \ -+ "bootz; " \ -+ "fi;\0" - - #define CONFIG_BOOTCOMMAND \ -- "mmc dev ${mmcdev}; if mmc rescan; then " \ -- "if run loadbootscript; then " \ -- "run bootscript; " \ -- "else " \ -- "if run loaduimage; then " \ -- "run mmcboot; " \ -- "else run netboot; " \ -- "fi; " \ -- "fi; " \ -- "else run netboot; fi" -+ "mmc dev ${mmcdev};" \ -+ "if mmc rescan; then " \ -+ "echo SD/MMC found on device ${mmcdev};" \ -+ "if run loadbootenv; then " \ -+ "run importbootenv;" \ -+ "fi;" \ -+ "echo Checking if uenvcmd is set ...;" \ -+ "if test -n $uenvcmd; then " \ -+ "echo Running uenvcmd ...;" \ -+ "run uenvcmd;" \ -+ "fi;" \ -+ "echo Running default loadimage ...;" \ -+ "if run loadimage; then " \ -+ "run loadfdt;" \ -+ "run mmcboot;" \ -+ "fi;" \ -+ "fi;" - - /* Miscellaneous configurable options */ - #define CONFIG_SYS_LONGHELP diff --git a/projects/imx6/patches/u-boot/102-udoo_zImage.patch b/projects/imx6/patches/u-boot/102-udoo_zImage.patch deleted file mode 100644 index a683e7d1e6..0000000000 --- a/projects/imx6/patches/u-boot/102-udoo_zImage.patch +++ /dev/null @@ -1,27 +0,0 @@ -diff -urN a/include/configs/udoo.h b/include/configs/udoo.h ---- a/include/configs/udoo.h 2014-11-29 18:58:38.930773257 +0100 -+++ b/include/configs/udoo.h 2014-11-29 19:04:06.005449364 +0100 -@@ -126,8 +126,9 @@ - #define CONFIG_DEFAULT_FDT_FILE "imx6q-udoo.dtb" - - #define CONFIG_EXTRA_ENV_SETTINGS \ -+ "zImage=KERNEL\0" \ - "script=boot.scr\0" \ -- "image=zImage\0" \ -+ "image=${zImage}\0" \ - "console=ttymxc1\0" \ - "splashpos=m,m\0" \ - "fdt_high=0xffffffff\0" \ -@@ -168,9 +169,9 @@ - "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ - "bootscript=echo Running bootscript from mmc ...; " \ - "source\0" \ -- "loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} zImage\0" \ -- "loadzimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} zImage\0" \ -- "loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} /dtbs/${fdt_file}\0" \ -+ "loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${zImage}\0" \ -+ "loadzimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${zImage}\0" \ -+ "loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ - "mmcboot=echo Booting from mmc ...; " \ - "run mmcargs; " \ - "bootz ${loadaddr} - ${fdt_addr};\0" \ diff --git a/projects/imx6/patches/u-boot/103-udoo_disable_lvds.patch b/projects/imx6/patches/u-boot/103-udoo_disable_lvds.patch index 6139d71c2f..efdc0fd630 100644 --- a/projects/imx6/patches/u-boot/103-udoo_disable_lvds.patch +++ b/projects/imx6/patches/u-boot/103-udoo_disable_lvds.patch @@ -1,6 +1,6 @@ -diff -aurN u-boot-imx6-144b1e9/arch/arm/cpu/armv7/cpu.c a-u/arch/arm/cpu/armv7/cpu.c ---- u-boot-imx6-144b1e9/arch/arm/cpu/armv7/cpu.c 2015-05-31 21:32:52.821314218 +0200 -+++ a-u/arch/arm/cpu/armv7/cpu.c 2015-05-31 21:27:12.292623257 +0200 +diff -aurN a/arch/arm/cpu/armv7/cpu.c b/arch/arm/cpu/armv7/cpu.c +--- a/arch/arm/cpu/armv7/cpu.c 2015-05-31 21:32:52.821314218 +0200 ++++ b/arch/arm/cpu/armv7/cpu.c 2015-05-31 21:27:12.292623257 +0200 @@ -77,7 +77,7 @@ cpu_cache_initialization(); @@ -16,7 +16,7 @@ diff -aurN u-boot-imx6-144b1e9/board/udoo/udoo.c a-u/board/udoo/udoo.c @@ -260,8 +260,8 @@ static void do_enable_lvds(struct display_info_t const *dev) { - imx_iomux_v3_setup_multiple_pads(lvds_pads, ARRAY_SIZE(lvds_pads)); + SETUP_IOMUX_PADS(lvds_pads); - gpio_direction_output(IMX_GPIO_NR(1, 2), 1); /* LVDS power On */ - gpio_direction_output(IMX_GPIO_NR(1, 4), 1); /* LVDS backlight On */ + /*gpio_direction_output(IMX_GPIO_NR(1, 2), 1);*/ /* LVDS power On */ diff --git a/scripts/checkdeps b/scripts/checkdeps index b8fa6f10b6..05b7ca1266 100755 --- a/scripts/checkdeps +++ b/scripts/checkdeps @@ -31,12 +31,12 @@ case $1 in deps_pkg="wget" ;; build) - deps="bash bc gcc g++ sed patch touch tar bzip2 gzip perl cp gawk makeinfo gperf cvs zip unzip mkfontscale mkfontdir bdftopcf diff xsltproc java" - deps_pkg="bash bc gcc g++ sed patch fileutils tar bzip2 gzip perl coreutils gawk texinfo gperf cvs zip unzip xfonts-utils xfonts-utils xfonts-utils diff xsltproc default-jre" + deps="bash bc gcc g++ sed patch touch tar bzip2 gzip perl cp gawk makeinfo gperf zip unzip mkfontscale mkfontdir bdftopcf diff xsltproc java" + deps_pkg="bash bc gcc g++ sed patch fileutils tar bzip2 gzip perl coreutils gawk texinfo gperf zip unzip xfonts-utils xfonts-utils xfonts-utils diff xsltproc default-jre" files="/usr/include/stdio.h /usr/include/ncurses.h" files_pkg="libc6-dev libncurses5-dev" if [ -f /etc/redhat-release ]; then - deps_pkg="bash bc gcc gcc-c++ sed patch fileutils tar bzip2 gzip perl coreutils gawk texinfo gperf cvs zip unzip xorg-x11-font-utils xorg-x11-font-utils diffutils libxslt java-1.7.0-openjdk" + deps_pkg="bash bc gcc gcc-c++ sed patch fileutils tar bzip2 gzip perl coreutils gawk texinfo gperf zip unzip xorg-x11-font-utils xorg-x11-font-utils diffutils libxslt java-1.7.0-openjdk" files_pkg="glibc-headers ncurses-devel" fi ;; diff --git a/scripts/image b/scripts/image index 11e3d13af6..2bd9d87645 100755 --- a/scripts/image +++ b/scripts/image @@ -80,7 +80,6 @@ fi mkdir -p $INSTALL/var mkdir -p $INSTALL/flash mkdir -p $INSTALL/storage - ln -sf /var $INSTALL/usr/var ln -sf /var/media $INSTALL/media if [ "$TARGET_ARCH" = "x86_64" -o "$TARGET_ARCH" = "powerpc64" ]; then diff --git a/tools/mkpkg/mkpkg_kodi b/tools/mkpkg/mkpkg_kodi index edc250f1d3..83a3d2fcf9 100755 --- a/tools/mkpkg/mkpkg_kodi +++ b/tools/mkpkg/mkpkg_kodi @@ -103,6 +103,10 @@ VERSION_MAJOR=$(grep ^VERSION_MAJOR version.txt | cut -d" " -f2) VERSION_MINOR=$(grep ^VERSION_MINOR version.txt | cut -d" " -f2) VERSION_TAG=$(grep ^VERSION_TAG version.txt | cut -d" " -f2 | tr A-Z a-z) PKG_VERSION="$VERSION_MAJOR.$VERSION_MINOR-$VERSION_TAG-$GIT_HASH" +# hack: empty version tag on release builds: +if [ "$VERSION_TAG" = "version_tag" ] ; then + PKG_VERSION="$VERSION_MAJOR.$VERSION_MINOR-$GIT_HASH" +fi echo $PKG_VERSION cd .. diff --git a/tools/mkpkg/mkpkg_kodi-Isengard b/tools/mkpkg/mkpkg_kodi-Isengard index 0721217e71..fc2e073ae2 100755 --- a/tools/mkpkg/mkpkg_kodi-Isengard +++ b/tools/mkpkg/mkpkg_kodi-Isengard @@ -70,7 +70,7 @@ package_sources() { } # kodi -git_clone $GIT_REPO $BRANCH $DEST_DIR.git 9ff25f8 +git_clone $GIT_REPO $BRANCH $DEST_DIR.git # kodi-platform REPO=$(cat $DEST_DIR.git/project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt | awk '{print $2}') @@ -103,6 +103,10 @@ VERSION_MAJOR=$(grep ^VERSION_MAJOR version.txt | cut -d" " -f2) VERSION_MINOR=$(grep ^VERSION_MINOR version.txt | cut -d" " -f2) VERSION_TAG=$(grep ^VERSION_TAG version.txt | cut -d" " -f2 | tr A-Z a-z) PKG_VERSION="$VERSION_MAJOR.$VERSION_MINOR-$VERSION_TAG-$GIT_HASH" +# hack: empty version tag on release builds: +if [ "$VERSION_TAG" = "version_tag" ] ; then + PKG_VERSION="$VERSION_MAJOR.$VERSION_MINOR-$GIT_HASH" +fi echo $PKG_VERSION cd ..