Merge branch 'openwrt:master' into master

This commit is contained in:
Hayzam Sherif 2023-03-20 12:30:10 +05:30 committed by GitHub
commit 1418f7d106
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
235 changed files with 4736 additions and 1469 deletions

View file

@ -541,6 +541,18 @@ config KERNEL_SOFTLOCKUP_DETECTOR
chance to run. The current stack trace is displayed upon
detection and the system will stay locked up.
config KERNEL_HARDLOCKUP_DETECTOR
bool "Compile the kernel with detect Hard Lockups"
depends on KERNEL_DEBUG_KERNEL
help
Say Y here to enable the kernel to act as a watchdog to detect
hard lockups.
Hardlockups are bugs that cause the CPU to loop in kernel mode
for more than 10 seconds, without letting other interrupts have a
chance to run. The current stack trace is displayed upon detection
and the system will stay locked up.
config KERNEL_DETECT_HUNG_TASK
bool "Compile the kernel with detect Hung Tasks"
depends on KERNEL_DEBUG_KERNEL

View file

@ -1,2 +1,2 @@
LINUX_VERSION-5.15 = .98
LINUX_KERNEL_HASH-5.15.98 = 7dc62cd3a45f95c9b60316a5886ea9406aee256308869dac1e4ec088fbb37787
LINUX_VERSION-5.15 = .102
LINUX_KERNEL_HASH-5.15.102 = 441cddfb970b97759eebdb9b142673662ce0770500e3ae8bcd4b90af369b01e6

View file

@ -45,6 +45,9 @@ linksys,ea8500)
netgear,r7800)
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x040000" "0x20000"
;;
nokia,ac400i)
ubootenv_add_uci_config "/dev/mtd20" "0x0" "0x040000" "0x20000"
;;
qcom,ipq8064-ap148|\
qcom,ipq8064-db149)
ubootenv_add_uci_config $(ubootenv_mtdinfo)

View file

@ -6,9 +6,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware/qca-wireless.git
PKG_SOURCE_DATE:=2023-02-12
PKG_SOURCE_VERSION:=c3ece63d6879e14c8d65a8dc3e32f47e0f891f27
PKG_MIRROR_HASH:=7637fb1df3ad577650284b526ffaa4c038e1ba6b196a88724d63e4d1c1ab3c53
PKG_SOURCE_DATE:=2023-03-19
PKG_SOURCE_VERSION:=31ff96d9f99f993cb43d79f0c411fe6bf55633bb
PKG_MIRROR_HASH:=8005a884059925a627024b9022ed06a36ebf4ed7a20e8aab191585afbdd6895f
PKG_FLAGS:=nonshared
@ -28,6 +28,8 @@ endef
# <https://wireless.wiki.kernel.org/en/users/drivers/ath10k/boardfiles>
ALLWIFIBOARDS:= \
8dev_habanero \
8dev_jalapeno \
aruba_ap-365 \
buffalo_wxr-5950ax12 \
devolo_magic-2-wifi-next \
@ -42,6 +44,7 @@ ALLWIFIBOARDS:= \
glinet_gl-s1300 \
linksys_ea8300 \
linksys_whw03v2 \
nokia_ac400i \
p2w_r619ac \
pakedge_wr-1 \
qnap_301w \
@ -128,6 +131,8 @@ endef
# Place files in this directory as board-<devicename>.<qca4019|qca9888|qca9889|qca9984|qca99x0|ipq8074>
# Add $(eval $(call generate-ipq-wifi-package,<devicename>,<display name>))
$(eval $(call generate-ipq-wifi-package,8dev_habanero,8devices Habanero))
$(eval $(call generate-ipq-wifi-package,8dev_jalapeno,8devices Jalapeno))
$(eval $(call generate-ipq-wifi-package,aruba_ap-365,Aruba AP-365))
$(eval $(call generate-ipq-wifi-package,buffalo_wxr-5950ax12,Buffalo WXR-5950AX12))
$(eval $(call generate-ipq-wifi-package,devolo_magic-2-wifi-next,devolo Magic 2 WiFi next))
@ -142,6 +147,7 @@ $(eval $(call generate-ipq-wifi-package,glinet_gl-ap1300,GL.iNet GL-AP1300))
$(eval $(call generate-ipq-wifi-package,glinet_gl-s1300,GL.iNet GL-S1300))
$(eval $(call generate-ipq-wifi-package,linksys_ea8300,Linksys EA8300))
$(eval $(call generate-ipq-wifi-package,linksys_whw03v2,Linksys WHW03 V2))
$(eval $(call generate-ipq-wifi-package,nokia_ac400i,Nokia AC400i))
$(eval $(call generate-ipq-wifi-package,p2w_r619ac,P&W R619AC))
$(eval $(call generate-ipq-wifi-package,pakedge_wr-1,Pakedge WR-1))
$(eval $(call generate-ipq-wifi-package,qnap_301w,QNAP 301w))

View file

@ -690,7 +690,7 @@ endef
$(eval $(call KernelPackage,mppe))
SCHED_MODULES_CORE = sch_ingress sch_hfsc sch_htb sch_tbf cls_basic cls_fw cls_route cls_flow cls_tcindex cls_u32 em_u32 act_gact act_mirred act_skbedit cls_matchall
SCHED_MODULES_CORE = sch_ingress sch_hfsc sch_htb sch_tbf cls_basic cls_fw cls_route cls_flow cls_u32 em_u32 act_gact act_mirred act_skbedit cls_matchall
SCHED_FILES_CORE = $(foreach mod,$(SCHED_MODULES_CORE),$(LINUX_DIR)/net/sched/$(mod).ko)
define KernelPackage/sched-core
@ -708,7 +708,6 @@ define KernelPackage/sched-core
CONFIG_NET_CLS_FLOW \
CONFIG_NET_CLS_FW \
CONFIG_NET_CLS_ROUTE4 \
CONFIG_NET_CLS_TCINDEX \
CONFIG_NET_CLS_U32 \
CONFIG_NET_ACT_GACT \
CONFIG_NET_ACT_MIRRED \

View file

@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=libnftnl
PKG_CPE_ID:=cpe:/a:netfilter:libnftnl
PKG_VERSION:=1.2.4
PKG_VERSION:=1.2.5
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files
PKG_HASH:=c0fe233be4cdfd703e7d5977ef8eb63fcbf1d0052b6044e1b23d47ca3562477f
PKG_HASH:=966de0a8120c8a53db859889749368bfb2cba0c4f0b4c1a30d264eccc45f1226
PKG_MAINTAINER:=Steven Barth <steven@midlink.org>
PKG_LICENSE:=GPL-2.0-or-later

View file

@ -6,12 +6,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=nftables
PKG_VERSION:=1.0.6
PKG_VERSION:=1.0.7
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files
PKG_HASH:=2407430ddd82987670e48dc2fda9e280baa8307abec04ab18d609df3db005e4c
PKG_HASH:=c12ac941fff9adaedf17367d5ce213789b98a0d314277bc22b3d71e10891f412
PKG_MAINTAINER:=
PKG_LICENSE:=GPL-2.0

View file

@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=rpcd
PKG_RELEASE:=2
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git
PKG_MIRROR_HASH:=7038ab08dc67f7440effbf04ab2f083915c819f758ab16b0fbdf846bd3b87773
PKG_SOURCE_DATE:=2023-01-21
PKG_SOURCE_VERSION:=c0df2a7af7d6284f4a446de15d0dab17124d9448
PKG_MIRROR_HASH:=d636b6e08a69578d615b2a294d6ca2c7ef73791de2a8314f1afb741655d8a143
PKG_SOURCE_DATE:=2023-03-14
PKG_SOURCE_VERSION:=d97883005ffb5be251872c3e4abe04f71732f9bd
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
PKG_LICENSE:=ISC

View file

@ -4,55 +4,82 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=uencrypt
PKG_RELEASE:=3
PKG_RELEASE:=5
PKG_FLAGS:=nonshared
PKG_LICENSE:=GPL-2.0-or-later
PKG_MAINTAINER:=Eneas U de Queiroz <cotequeiroz@gmail.com>
PKG_CONFIG_DEPENDS:=\
CONFIG_UENCRYPT_OPENSSL \
CONFIG_UENCRYPT_WOLFSSL
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
CMAKE_INSTALL:=1
CMAKE_OPTIONS+=$(if $(CONFIG_UENCRYPT_WOLFSSL),-DUSE_WOLFSSL=1)
ifeq ($(BUILD_VARIANT),mbedtls)
CMAKE_OPTIONS+=-DUSE_MBEDTLS=1
else ifeq ($(BUILD_VARIANT),wolfssl)
CMAKE_OPTIONS+=-DUSE_WOLFSSL=1
endif
define Package/uencrypt
TARGET_CFLAGS+=-Wall
define Package/uencrypt/default
SECTION:=utils
CATEGORY:=Base system
TITLE:=Decryption utility for Arcadyan WG4xx223 and TP-Link Deco S4
DEPENDS:=+UENCRYPT_WOLFSSL:libwolfssl +UENCRYPT_OPENSSL:libopenssl
TITLE:=Small Decryption utility
endef
define Package/uencrypt/description
define Package/uencrypt/default/description
This is a small encrypton/decryption program. It defaults
to AES-128-CBC, but supports any encryption provided by
the available openssl/wolfssl library. Even though it can
be used for regular encryption and decryption operations,
the crypto library. Even though it can be used for
non-critical* regular encryption and decryption operations,
it is included here to unencrypt the configuration from mtd
on Arcadyan WG430223/WG443223 and TP-Link Deco S4 routers
on some devices.
* Key and IV are exposed on cmdline
This variant uses $(1) as crypto provider
endef
define Package/uencrypt/config
if PACKAGE_uencrypt
choice
prompt "Crypto provider"
default UENCRYPT_WOLFSSL
config UENCRYPT_OPENSSL
bool "OpenSSL"
config UENCRYPT_WOLFSSL
bool "wolfSSL"
endchoice
endif
define Package/uencrypt-mbedtls
$(Package/uencrypt/default)
VARIANT:=mbedtls
TITLE+= using mbedTLS
DEPENDS:=+libmbedtls
CONFLICTS:=uencrypt-openssl uencrypt-wolfssl
endef
define Package/uencrypt/install
Package/uencrypt-mbedtls/description= \
$(call Package/uencrypt/default/description,mbedTLS)
define Package/uencrypt-openssl
$(Package/uencrypt/default)
VARIANT:=openssl
TITLE+= using OpenSSL
DEPENDS:=+libopenssl
CONFLICTS:=uencrypt-wolfssl
endef
Package/uencrypt-openssl/description= \
$(call Package/uencrypt/default/description,OpenSSL)
define Package/uencrypt-wolfssl
$(Package/uencrypt/default)
VARIANT:=wolfssl
TITLE+= using wolfSSL
DEPENDS:=+libwolfssl
endef
Package/uencrypt-wolfssl/description= \
$(call Package/uencrypt/default/description,wolfSSL)
define Package/uencrypt/default/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/uencrypt $(1)/usr/bin
endef
Package/uencrypt-openssl/install = $(Package/uencrypt/default/install)
Package/uencrypt-wolfssl/install = $(Package/uencrypt/default/install)
Package/uencrypt-mbedtls/install = $(Package/uencrypt/default/install)
$(eval $(call BuildPackage,uencrypt))
$(eval $(call BuildPackage,uencrypt-mbedtls))
$(eval $(call BuildPackage,uencrypt-openssl))
$(eval $(call BuildPackage,uencrypt-wolfssl))

View file

@ -5,16 +5,28 @@ cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
project(uencrypt LANGUAGES C)
option(USE_WOLFSSL "Use WolfSSL as crypto provider" OFF)
if (USE_WOLFSSL)
option(USE_MBEDTLS "Use mbedTLS as crypto provider" OFF)
if (USE_MBEDTLS)
if (USE_WOLFSSL)
message(WARNING "USE_MBEDTLS and USE_WOLFSSL are both set. Building with USE_MBEDTLS.")
endif()
add_definitions(-DUSE_MBEDTLS)
find_library(MBEDCRYPTO_LIBRARY mbedcrypto REQUIRED)
set(CRYPTO_LIBRARIES ${MBEDCRYPTO_LIBRARY})
set(CRYPTO_SOURCES ${PROJECT_NAME}-mbedtls.c)
else()
set(CRYPTO_SOURCES ${PROJECT_NAME}-openssl.c)
if (USE_WOLFSSL)
add_definitions(-DUSE_WOLFSSL)
find_library(WOLFSSL_LIBRARY wolfssl REQUIRED)
set(CRYPTO_LIBRARIES ${WOLFSSL_LIBRARY})
else()
else()
find_package(OpenSSL REQUIRED)
set(CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
endif()
endif()
add_executable(${PROJECT_NAME} ${PROJECT_NAME}.c ${PROJECT_NAME}.h ${CRYPTO_SOURCES})
add_executable(${PROJECT_NAME} ${PROJECT_NAME}.c)
target_link_libraries(${PROJECT_NAME} ${CRYPTO_LIBRARIES})
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)

View file

@ -0,0 +1,186 @@
/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright (C) 2023 Eneas Ulir de Queiroz
*/
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "uencrypt.h"
unsigned char *hexstr2buf(const char *str, long *len)
{
unsigned char *buf;
long inlen = strlen(str);
*len = 0;
if (inlen % 2)
return NULL;
*len = inlen >> 1;
buf = malloc(*len);
for (long x = 0; x < *len; x++)
sscanf(str + x * 2, "%2hhx", buf + x);
return buf;
}
const cipher_t *get_default_cipher(void)
{
return mbedtls_cipher_info_from_type (MBEDTLS_CIPHER_AES_128_CBC);
}
static char* upperstr(char *str) {
for (char *s = str; *s; s++)
*s = toupper((unsigned char) *s);
return str;
}
const cipher_t *get_cipher_or_print_error(char *name)
{
const mbedtls_cipher_info_t *cipher;
cipher = mbedtls_cipher_info_from_string(upperstr(name));
if (cipher)
return cipher;
fprintf(stderr, "Error: invalid cipher: %s.\n", name);
fprintf(stderr, "Supported ciphers: \n");
for (const int *list = mbedtls_cipher_list(); *list; list++) {
cipher = mbedtls_cipher_info_from_type(*list);
if (!cipher)
continue;
fprintf(stderr, "\t%s\n", cipher->name);
}
return NULL;
}
int get_cipher_ivsize(const cipher_t *cipher)
{
const mbedtls_cipher_info_t *c = cipher;
return c->iv_size;
}
int get_cipher_keysize(const cipher_t *cipher)
{
const mbedtls_cipher_info_t *c = cipher;
return c->key_bitlen >> 3;
}
ctx_t *create_ctx(const cipher_t *cipher, const unsigned char *key,
const unsigned char *iv, int enc, int padding)
{
mbedtls_cipher_context_t *ctx;
const mbedtls_cipher_info_t *cipher_info=cipher;
int ret;
ctx = malloc(sizeof (mbedtls_cipher_context_t));
if (!ctx) {
fprintf (stderr, "Error: create_ctx: out of memory.\n");
return NULL;
}
mbedtls_cipher_init(ctx);
ret = mbedtls_cipher_setup(ctx, cipher_info);
if (ret) {
fprintf(stderr, "Error: mbedtls_cipher_setup: %d\n", ret);
goto abort;
}
ret = mbedtls_cipher_setkey(ctx, key,
(int) mbedtls_cipher_get_key_bitlen(ctx),
enc ? MBEDTLS_ENCRYPT : MBEDTLS_DECRYPT);
if (ret) {
fprintf(stderr, "Error: mbedtls_cipher_setkey: %d\n", ret);
goto abort;
}
if (iv) {
ret = mbedtls_cipher_set_iv(ctx, iv, mbedtls_cipher_get_iv_size(ctx));
if (ret) {
fprintf(stderr, "Error: mbedtls_cipher_set_iv: %d\n", ret);
goto abort;
}
}
if (cipher_info->mode == MBEDTLS_MODE_CBC) {
ret = mbedtls_cipher_set_padding_mode(ctx, padding ?
MBEDTLS_PADDING_PKCS7 :
MBEDTLS_PADDING_NONE);
if (ret) {
fprintf(stderr, "Error: mbedtls_cipher_set_padding_mode: %d\n",
ret);
goto abort;
}
} else {
if (cipher_info->block_size > 1 && padding) {
fprintf(stderr,
"Error: mbedTLS only allows padding with CBC ciphers.\n");
goto abort;
}
}
ret = mbedtls_cipher_reset(ctx);
if (ret) {
fprintf(stderr, "Error: mbedtls_cipher_reset: %d\n", ret);
goto abort;
}
return ctx;
abort:
free_ctx(ctx);
return NULL;
}
int do_crypt(FILE *infile, FILE *outfile, ctx_t *ctx)
{
unsigned char inbuf[CRYPT_BUF_SIZE];
unsigned char outbuf[CRYPT_BUF_SIZE + MBEDTLS_MAX_BLOCK_LENGTH];
size_t inlen, outlen, step;
int ret;
if (mbedtls_cipher_get_cipher_mode(ctx) == MBEDTLS_MODE_ECB) {
step = mbedtls_cipher_get_block_size(ctx);
if (step > CRYPT_BUF_SIZE) {
step = CRYPT_BUF_SIZE;
}
} else {
step = CRYPT_BUF_SIZE;
}
for (;;) {
inlen = fread(inbuf, 1, step, infile);
if (inlen <= 0)
break;
ret = mbedtls_cipher_update(ctx, inbuf, inlen, outbuf, &outlen);
if (ret) {
fprintf(stderr, "Error: mbedtls_cipher_update: %d\n", ret);
return ret;
}
ret = fwrite(outbuf, 1, outlen, outfile);
if (ret != outlen) {
fprintf(stderr, "Error: cipher_update short write.\n");
return ret - outlen;
}
}
ret = mbedtls_cipher_finish(ctx, outbuf, &outlen);
if (ret) {
fprintf(stderr, "Error: mbedtls_cipher_finish: %d\n", ret);
return ret;
}
ret = fwrite(outbuf, 1, outlen, outfile);
if (ret != outlen) {
fprintf(stderr, "Error: cipher_finish short write.\n");
return ret - outlen;
}
return 0;
}
void free_ctx(ctx_t *ctx)
{
if (ctx) {
mbedtls_cipher_free(ctx);
free(ctx);
}
}

View file

@ -0,0 +1,116 @@
/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright (C) 2022-2023 Eneas Ulir de Queiroz
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "uencrypt.h"
const cipher_t *get_default_cipher(void)
{
return EVP_aes_128_cbc();
}
#ifndef USE_WOLFSSL
static void print_ciphers(const OBJ_NAME *name,void *arg) {
fprintf(arg, "\t%s\n", name->name);
}
#endif
const cipher_t *get_cipher_or_print_error(char *name)
{
const EVP_CIPHER *cipher;
if ((cipher = EVP_get_cipherbyname(name)))
return cipher;
fprintf(stderr, "Error: invalid cipher: %s.\n", name);
#ifndef USE_WOLFSSL
fprintf(stderr, "Supported ciphers: \n");
OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_CIPHER_METH, print_ciphers, stderr);
#endif
return NULL;
}
int get_cipher_ivsize(const cipher_t *cipher)
{
return EVP_CIPHER_iv_length(cipher);
}
int get_cipher_keysize(const cipher_t *cipher)
{
return EVP_CIPHER_key_length(cipher);
}
ctx_t *create_ctx(const cipher_t *cipher, const unsigned char *key,
const unsigned char *iv, int enc, int padding)
{
EVP_CIPHER_CTX *ctx;
int ret;
ctx = EVP_CIPHER_CTX_new();
if (!ctx) {
fprintf (stderr, "Error: create_ctx: out of memory.\n");
return NULL;
}
ret = EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, enc);
if (!ret) {
fprintf(stderr, "Error:EVP_CipherInit_ex: %d\n", ret);
goto abort;
}
ret = EVP_CIPHER_CTX_set_padding(ctx, padding);
if (!ret) {
fprintf(stderr, "Error:EVP_CIPHER_CTX_set_padding: %d\n", ret);
goto abort;
}
return ctx;
abort:
free_ctx(ctx);
return NULL;
}
int do_crypt(FILE *infile, FILE *outfile, ctx_t *ctx)
{
unsigned char inbuf[CRYPT_BUF_SIZE];
unsigned char outbuf[CRYPT_BUF_SIZE + EVP_MAX_BLOCK_LENGTH];
int inlen, outlen;
int ret;
for (;;) {
inlen = fread(inbuf, 1, CRYPT_BUF_SIZE, infile);
if (inlen <= 0)
break;
ret = EVP_CipherUpdate(ctx, outbuf, &outlen, inbuf, inlen);
if (!ret) {
fprintf(stderr, "Error: EVP_CipherUpdate: %d\n", ret);
return ret;
}
ret = fwrite(outbuf, 1, outlen, outfile);
if (ret != outlen) {
fprintf(stderr, "Error: CipherUpdate short write.\n");
return ret - outlen;
}
}
ret = EVP_CipherFinal_ex(ctx, outbuf, &outlen);
if (!ret) {
fprintf(stderr, "Error: EVP_CipherFinal: %d\n", ret);
return ret;
}
ret = fwrite(outbuf, 1, outlen, outfile);
if (ret != outlen) {
fprintf(stderr, "Error: CipherFinal short write.\n");
return ret - outlen;
}
return 0;
}
void free_ctx(ctx_t *ctx)
{
EVP_CIPHER_CTX_free(ctx);
}

View file

@ -1,5 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright (C) 2022 Eneas Ulir de Queiroz
* Copyright (C) 2023 Eneas Ulir de Queiroz
*/
#include <errno.h>
@ -8,43 +8,7 @@
#include <string.h>
#include <unistd.h>
#ifdef USE_WOLFSSL
# include <wolfssl/options.h>
# include <wolfssl/openssl/evp.h>
#else
# include <openssl/evp.h>
#endif
int do_crypt(FILE *infile, FILE *outfile, const EVP_CIPHER *cipher, const char *key, const char *iv,
int enc, int padding)
{
EVP_CIPHER_CTX *ctx;
unsigned char inbuf[1024], outbuf[1024 + EVP_MAX_BLOCK_LENGTH];
int inlen, outlen;
ctx = EVP_CIPHER_CTX_new();
EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, enc);
EVP_CIPHER_CTX_set_padding(ctx, padding);
for (;;) {
inlen = fread(inbuf, 1, 1024, infile);
if (inlen <= 0)
break;
if (!EVP_CipherUpdate(ctx, outbuf, &outlen, inbuf, inlen)) {
EVP_CIPHER_CTX_free(ctx);
return -1;
}
fwrite(outbuf, 1, outlen, outfile);
}
if (!EVP_CipherFinal_ex(ctx, outbuf, &outlen)) {
EVP_CIPHER_CTX_free(ctx);
return -1;
}
fwrite(outbuf, 1, outlen, outfile);
EVP_CIPHER_CTX_free(ctx);
return 0;
}
#include "uencrypt.h"
static void check_enc_dec(const int enc)
{
@ -54,50 +18,37 @@ static void check_enc_dec(const int enc)
exit(EXIT_FAILURE);
}
#ifndef USE_WOLFSSL
static void print_ciphers(const OBJ_NAME *name,void *arg) {
fprintf(arg, "\t%s\n", name->name);
}
#endif
static void check_cipher(const EVP_CIPHER *cipher)
{
if (cipher == NULL) {
fprintf(stderr, "Error: invalid cipher: %s.\n", optarg);
#ifndef USE_WOLFSSL
fprintf(stderr, "Supported ciphers: \n", optarg);
OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_CIPHER_METH, print_ciphers, stderr);
#endif
exit(EXIT_FAILURE);
}
}
static void show_usage(const char* name)
{
fprintf(stderr, "Usage: %s: [-d | -e] [-n] -k key [-i iv] [-c cipher]\n"
"-d = decrypt; -e = encrypt; -n = no padding\n", name);
}
static void uencrypt_clear_free(void *ptr, size_t len)
{
if (ptr) {
memset(ptr, 0, len);
free(ptr);
}
}
int main(int argc, char *argv[])
{
int enc = -1;
unsigned char *iv = NULL;
unsigned char *key = NULL;
long len;
long keylen = 0, ivlen = 0;
int opt;
int padding = 1;
int need_iv = 1;
const EVP_CIPHER *cipher = EVP_aes_128_cbc();
int ret;
const cipher_t *cipher = get_default_cipher();
ctx_t* ctx;
int ret = EXIT_FAILURE;
while ((opt = getopt(argc, argv, "c:dei:k:n")) != -1) {
switch (opt) {
case 'c':
cipher = EVP_get_cipherbyname(optarg);
check_cipher(cipher);
int arglen = strlen(optarg);
if (arglen > 3 && strncmp(optarg+arglen-3, "ecb", 3) == 0) //if ends with "ecb"
need_iv = 0;
if (!(cipher = get_cipher_or_print_error(optarg)))
exit(EXIT_FAILURE);
break;
case 'd':
check_enc_dec(enc);
@ -108,20 +59,22 @@ int main(int argc, char *argv[])
enc = 1;
break;
case 'i':
iv = OPENSSL_hexstr2buf((const char *)optarg, &len);
iv = hexstr2buf(optarg, &ivlen);
if (iv == NULL) {
fprintf(stderr, "Error setting IV to %s. The IV should be encoded in hex.\n",
optarg);
exit(EINVAL);
}
memset(optarg, '*', strlen(optarg));
break;
case 'k':
key = OPENSSL_hexstr2buf((const char *)optarg, &len);
key = hexstr2buf(optarg, &keylen);
if (key == NULL) {
fprintf(stderr, "Error setting key to %s. The key should be encoded in hex.\n",
optarg);
exit(EINVAL);
}
memset(optarg, '*', strlen(optarg));
break;
case 'n':
padding = 0;
@ -131,20 +84,22 @@ int main(int argc, char *argv[])
exit(EINVAL);
}
}
if (need_iv && iv == NULL) {
fprintf(stderr, "Error: iv not set.\n");
show_usage(argv[0]);
if (ivlen != get_cipher_ivsize(cipher)) {
fprintf(stderr, "Error: IV must be %d bytes; given IV is %zd bytes.\n",
get_cipher_ivsize(cipher), ivlen);
exit(EXIT_FAILURE);
}
if (key == NULL) {
fprintf(stderr, "Error: key not set.\n");
show_usage(argv[0]);
if (keylen != get_cipher_keysize(cipher)) {
fprintf(stderr, "Error: key must be %d bytes; given key is %zd bytes.\n",
get_cipher_keysize(cipher), keylen);
exit(EXIT_FAILURE);
}
ret = do_crypt(stdin, stdout, cipher, key, iv, !!enc, padding);
if (ret)
fprintf(stderr, "Error during crypt operation.\n");
OPENSSL_free(iv);
OPENSSL_free(key);
ctx = create_ctx(cipher, key, iv, !!enc, padding);
if (ctx) {
ret = do_crypt(stdin, stdout, ctx);
free_ctx(ctx);
}
uencrypt_clear_free(iv, ivlen);
uencrypt_clear_free(key, keylen);
return ret;
}

View file

@ -0,0 +1,49 @@
/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright (C) 2022-2023 Eneas Ulir de Queiroz
*/
#include <stdio.h>
#define CRYPT_BUF_SIZE 1024
#ifdef USE_MBEDTLS
# include <mbedtls/cipher.h>
# if defined(MBEDTLS_MAX_BLOCK_LENGTH) \
&& MBEDTLS_MAX_BLOCK_LENGTH > CRYPT_BUF_SIZE
# undef CRYPT_BUF_SIZE
# define CRYPT_BUF_SIZE MAX_BLOCK_LENGTH
# endif
unsigned char *hexstr2buf(const char* str, long *len);
#else /* USE_MBEDTLS */
# ifdef USE_WOLFSSL
# include <wolfssl/options.h>
# include <wolfssl/openssl/evp.h>
# else
# include <openssl/evp.h>
# endif
# if defined(EVP_MAX_BLOCK_LENGTH) \
&& EVP_MAX_BLOCK_LENGTH > CRYPT_BUF_SIZE
# undef CRYPT_BUF_SIZE
# define CRYPT_BUF_SIZE EVP_MAX_BLOCK_LENGTH
# endif
# define hexstr2buf OPENSSL_hexstr2buf
#endif /* USE_MBEDTLS */
typedef void cipher_t;
typedef void ctx_t;
const cipher_t *get_default_cipher(void);
const cipher_t *get_cipher_or_print_error(char *name);
int get_cipher_ivsize(const cipher_t *cipher);
int get_cipher_keysize(const cipher_t *cipher);
ctx_t *create_ctx(const cipher_t *cipher, const unsigned char *key,
const unsigned char *iv, int enc, int padding);
int do_crypt(FILE *infile, FILE *outfile, ctx_t *ctx);
void free_ctx(ctx_t *ctx);

View file

@ -1,6 +1,6 @@
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -308,6 +308,12 @@ config SPI_DLN2
@@ -307,6 +307,12 @@ config SPI_DLN2
This driver can also be built as a module. If so, the module
will be called spi-dln2.

View file

@ -509,7 +509,7 @@ define Device/tplink_deco-s4-v2
IMAGE_SIZE := 13824k
DEVICE_MODEL := Deco S4
DEVICE_VARIANT := v2
DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9888-ct uencrypt
DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9888-ct uencrypt-mbedtls
SUPPORTED_DEVICES += deco-s4-v2
TPLINK_BOARD_ID := DECO-S4-V2
endef

View file

@ -10,7 +10,7 @@ Signed-off-by: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -3098,6 +3098,7 @@ int spi_nor_scan(struct spi_nor *nor, co
@@ -3107,6 +3107,7 @@ int spi_nor_scan(struct spi_nor *nor, co
struct device *dev = nor->dev;
struct mtd_info *mtd = &nor->mtd;
struct device_node *np = spi_nor_get_flash_node(nor);
@ -18,7 +18,7 @@ Signed-off-by: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
int ret;
int i;
@@ -3152,7 +3153,12 @@ int spi_nor_scan(struct spi_nor *nor, co
@@ -3161,7 +3162,12 @@ int spi_nor_scan(struct spi_nor *nor, co
if (ret)
return ret;

View file

@ -45,7 +45,7 @@ Submitted-by: Christopher Hill <ch6574@gmail.com>
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -2175,6 +2175,14 @@ config RAVE_SP_CORE
@@ -2176,6 +2176,14 @@ config RAVE_SP_CORE
Select this to get support for the Supervisory Processor
device found on several devices in RAVE line of hardware.

View file

@ -17,7 +17,7 @@ Link: https://patchwork.freedesktop.org/patch/msgid/20210819135931.895976-5-maxi
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -1748,7 +1748,7 @@ static irqreturn_t vc4_cec_irq_handler(i
@@ -1749,7 +1749,7 @@ static irqreturn_t vc4_cec_irq_handler(i
return ret;
}
@ -26,7 +26,7 @@ Link: https://patchwork.freedesktop.org/patch/msgid/20210819135931.895976-5-maxi
{
struct vc4_hdmi *vc4_hdmi = cec_get_drvdata(adap);
/* clock period in microseconds */
@@ -1761,38 +1761,53 @@ static int vc4_hdmi_cec_adap_enable(stru
@@ -1762,38 +1762,53 @@ static int vc4_hdmi_cec_adap_enable(stru
val |= ((4700 / usecs) << VC4_HDMI_CEC_CNT_TO_4700_US_SHIFT) |
((4500 / usecs) << VC4_HDMI_CEC_CNT_TO_4500_US_SHIFT);

View file

@ -24,7 +24,7 @@ Link: https://patchwork.freedesktop.org/patch/msgid/20210819135931.895976-6-maxi
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -1753,8 +1753,14 @@ static int vc4_hdmi_cec_enable(struct ce
@@ -1754,8 +1754,14 @@ static int vc4_hdmi_cec_enable(struct ce
struct vc4_hdmi *vc4_hdmi = cec_get_drvdata(adap);
/* clock period in microseconds */
const u32 usecs = 1000000 / CEC_CLOCK_FREQ;
@ -40,7 +40,7 @@ Link: https://patchwork.freedesktop.org/patch/msgid/20210819135931.895976-6-maxi
val &= ~(VC4_HDMI_CEC_TX_SW_RESET | VC4_HDMI_CEC_RX_SW_RESET |
VC4_HDMI_CEC_CNT_TO_4700_US_MASK |
VC4_HDMI_CEC_CNT_TO_4500_US_MASK);
@@ -1797,6 +1803,8 @@ static int vc4_hdmi_cec_disable(struct c
@@ -1798,6 +1804,8 @@ static int vc4_hdmi_cec_disable(struct c
HDMI_WRITE(HDMI_CEC_CNTRL_5, HDMI_READ(HDMI_CEC_CNTRL_5) |
VC4_HDMI_CEC_TX_SW_RESET | VC4_HDMI_CEC_RX_SW_RESET);

View file

@ -20,7 +20,7 @@ Link: https://lore.kernel.org/r/20211025152903.1088803-9-maxime@cerno.tech
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -2386,7 +2386,7 @@ static const struct vc4_hdmi_variant bcm
@@ -2387,7 +2387,7 @@ static const struct vc4_hdmi_variant bcm
.encoder_type = VC4_ENCODER_TYPE_HDMI0,
.debugfs_name = "hdmi0_regs",
.card_name = "vc4-hdmi-0",

View file

@ -281,9 +281,9 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
}
static void vc5_hdmi_set_timings(struct vc4_hdmi *vc4_hdmi,
@@ -789,10 +856,13 @@ static void vc5_hdmi_set_timings(struct
@@ -790,10 +857,13 @@ static void vc5_hdmi_set_timings(struct
VC4_SET_FIELD(mode->crtc_vtotal -
mode->crtc_vsync_end - interlaced,
mode->crtc_vsync_end,
VC4_HDMI_VERTB_VBP));
+ unsigned long flags;
unsigned char gcp;
@ -295,7 +295,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
HDMI_WRITE(HDMI_VEC_INTERFACE_XBAR, 0x354021);
HDMI_WRITE(HDMI_HORZA,
(vsync_pos ? VC5_HDMI_HORZA_VPOS : 0) |
@@ -856,13 +926,18 @@ static void vc5_hdmi_set_timings(struct
@@ -857,13 +927,18 @@ static void vc5_hdmi_set_timings(struct
HDMI_WRITE(HDMI_MISC_CONTROL, reg);
HDMI_WRITE(HDMI_CLOCK_STOP, 0);
@ -314,7 +314,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
drift = HDMI_READ(HDMI_FIFO_CTL);
drift &= VC4_HDMI_FIFO_VALID_WRITE_MASK;
@@ -870,12 +945,20 @@ static void vc4_hdmi_recenter_fifo(struc
@@ -871,12 +946,20 @@ static void vc4_hdmi_recenter_fifo(struc
drift & ~VC4_HDMI_FIFO_CTL_RECENTER);
HDMI_WRITE(HDMI_FIFO_CTL,
drift | VC4_HDMI_FIFO_CTL_RECENTER);
@ -335,7 +335,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
ret = wait_for(HDMI_READ(HDMI_FIFO_CTL) &
VC4_HDMI_FIFO_CTL_RECENTER_DONE, 1);
WARN_ONCE(ret, "Timeout waiting for "
@@ -909,6 +992,7 @@ static void vc4_hdmi_encoder_pre_crtc_co
@@ -910,6 +993,7 @@ static void vc4_hdmi_encoder_pre_crtc_co
struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
unsigned long pixel_rate = vc4_conn_state->pixel_rate;
unsigned long bvb_rate, hsm_rate;
@ -343,7 +343,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
int ret;
/*
@@ -977,11 +1061,15 @@ static void vc4_hdmi_encoder_pre_crtc_co
@@ -978,11 +1062,15 @@ static void vc4_hdmi_encoder_pre_crtc_co
if (vc4_hdmi->variant->phy_init)
vc4_hdmi->variant->phy_init(vc4_hdmi, vc4_conn_state);
@ -359,7 +359,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
if (vc4_hdmi->variant->set_timings)
vc4_hdmi->variant->set_timings(vc4_hdmi, conn_state, mode);
@@ -1001,6 +1089,7 @@ static void vc4_hdmi_encoder_pre_crtc_en
@@ -1002,6 +1090,7 @@ static void vc4_hdmi_encoder_pre_crtc_en
struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode;
struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder);
struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
@ -367,7 +367,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
if (vc4_encoder->hdmi_monitor &&
drm_default_rgb_quant_range(mode) == HDMI_QUANTIZATION_RANGE_LIMITED) {
@@ -1015,7 +1104,9 @@ static void vc4_hdmi_encoder_pre_crtc_en
@@ -1016,7 +1105,9 @@ static void vc4_hdmi_encoder_pre_crtc_en
vc4_encoder->limited_rgb_range = false;
}
@ -377,7 +377,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
}
static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder,
@@ -1026,8 +1117,11 @@ static void vc4_hdmi_encoder_post_crtc_e
@@ -1027,8 +1118,11 @@ static void vc4_hdmi_encoder_post_crtc_e
struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder);
bool hsync_pos = mode->flags & DRM_MODE_FLAG_PHSYNC;
bool vsync_pos = mode->flags & DRM_MODE_FLAG_PVSYNC;
@ -389,7 +389,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
HDMI_WRITE(HDMI_VID_CTL,
VC4_HD_VID_CTL_ENABLE |
VC4_HD_VID_CTL_CLRRGB |
@@ -1044,6 +1138,8 @@ static void vc4_hdmi_encoder_post_crtc_e
@@ -1045,6 +1139,8 @@ static void vc4_hdmi_encoder_post_crtc_e
HDMI_READ(HDMI_SCHEDULER_CONTROL) |
VC4_HDMI_SCHEDULER_CONTROL_MODE_HDMI);
@ -398,7 +398,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
ret = wait_for(HDMI_READ(HDMI_SCHEDULER_CONTROL) &
VC4_HDMI_SCHEDULER_CONTROL_HDMI_ACTIVE, 1000);
WARN_ONCE(ret, "Timeout waiting for "
@@ -1056,6 +1152,8 @@ static void vc4_hdmi_encoder_post_crtc_e
@@ -1057,6 +1153,8 @@ static void vc4_hdmi_encoder_post_crtc_e
HDMI_READ(HDMI_SCHEDULER_CONTROL) &
~VC4_HDMI_SCHEDULER_CONTROL_MODE_HDMI);
@ -407,7 +407,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
ret = wait_for(!(HDMI_READ(HDMI_SCHEDULER_CONTROL) &
VC4_HDMI_SCHEDULER_CONTROL_HDMI_ACTIVE), 1000);
WARN_ONCE(ret, "Timeout waiting for "
@@ -1063,6 +1161,8 @@ static void vc4_hdmi_encoder_post_crtc_e
@@ -1064,6 +1162,8 @@ static void vc4_hdmi_encoder_post_crtc_e
}
if (vc4_encoder->hdmi_monitor) {
@ -416,7 +416,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
WARN_ON(!(HDMI_READ(HDMI_SCHEDULER_CONTROL) &
VC4_HDMI_SCHEDULER_CONTROL_HDMI_ACTIVE));
HDMI_WRITE(HDMI_SCHEDULER_CONTROL,
@@ -1072,6 +1172,8 @@ static void vc4_hdmi_encoder_post_crtc_e
@@ -1073,6 +1173,8 @@ static void vc4_hdmi_encoder_post_crtc_e
HDMI_WRITE(HDMI_RAM_PACKET_CONFIG,
VC4_HDMI_RAM_PACKET_ENABLE);
@ -425,7 +425,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
vc4_hdmi_set_infoframes(encoder);
}
@@ -1195,6 +1297,7 @@ static void vc4_hdmi_audio_set_mai_clock
@@ -1196,6 +1298,7 @@ static void vc4_hdmi_audio_set_mai_clock
unsigned int samplerate)
{
u32 hsm_clock = clk_get_rate(vc4_hdmi->audio_clock);
@ -433,7 +433,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
unsigned long n, m;
rational_best_approximation(hsm_clock, samplerate,
@@ -1204,9 +1307,11 @@ static void vc4_hdmi_audio_set_mai_clock
@@ -1205,9 +1308,11 @@ static void vc4_hdmi_audio_set_mai_clock
VC4_HD_MAI_SMP_M_SHIFT) + 1,
&n, &m);
@ -445,7 +445,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
}
static void vc4_hdmi_set_n_cts(struct vc4_hdmi *vc4_hdmi, unsigned int samplerate)
@@ -1217,6 +1322,8 @@ static void vc4_hdmi_set_n_cts(struct vc
@@ -1218,6 +1323,8 @@ static void vc4_hdmi_set_n_cts(struct vc
u32 n, cts;
u64 tmp;
@ -454,7 +454,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
n = 128 * samplerate / 1000;
tmp = (u64)(mode->clock * 1000) * n;
do_div(tmp, 128 * samplerate);
@@ -1246,6 +1353,7 @@ static int vc4_hdmi_audio_startup(struct
@@ -1247,6 +1354,7 @@ static int vc4_hdmi_audio_startup(struct
{
struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);
struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base;
@ -462,7 +462,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
/*
* If the HDMI encoder hasn't probed, or the encoder is
@@ -1257,12 +1365,14 @@ static int vc4_hdmi_audio_startup(struct
@@ -1258,12 +1366,14 @@ static int vc4_hdmi_audio_startup(struct
vc4_hdmi->audio.streaming = true;
@ -477,7 +477,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
if (vc4_hdmi->variant->phy_rng_enable)
vc4_hdmi->variant->phy_rng_enable(vc4_hdmi);
@@ -1274,6 +1384,7 @@ static void vc4_hdmi_audio_reset(struct
@@ -1275,6 +1385,7 @@ static void vc4_hdmi_audio_reset(struct
{
struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base;
struct device *dev = &vc4_hdmi->pdev->dev;
@ -485,7 +485,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
int ret;
vc4_hdmi->audio.streaming = false;
@@ -1281,20 +1392,29 @@ static void vc4_hdmi_audio_reset(struct
@@ -1282,20 +1393,29 @@ static void vc4_hdmi_audio_reset(struct
if (ret)
dev_err(dev, "Failed to stop audio infoframe: %d\n", ret);
@ -515,7 +515,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
if (vc4_hdmi->variant->phy_rng_disable)
vc4_hdmi->variant->phy_rng_disable(vc4_hdmi);
@@ -1349,6 +1469,7 @@ static int vc4_hdmi_audio_prepare(struct
@@ -1350,6 +1470,7 @@ static int vc4_hdmi_audio_prepare(struct
struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base;
unsigned int sample_rate = params->sample_rate;
unsigned int channels = params->channels;
@ -523,7 +523,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
u32 audio_packet_config, channel_mask;
u32 channel_map;
u32 mai_audio_format;
@@ -1357,14 +1478,15 @@ static int vc4_hdmi_audio_prepare(struct
@@ -1358,14 +1479,15 @@ static int vc4_hdmi_audio_prepare(struct
dev_dbg(dev, "%s: %u Hz, %d bit, %d channels\n", __func__,
sample_rate, params->sample_width, channels);
@ -541,7 +541,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
mai_sample_rate = sample_rate_to_mai_fmt(sample_rate);
if (params->iec.status[0] & IEC958_AES0_NONAUDIO &&
params->channels == 8)
@@ -1402,8 +1524,11 @@ static int vc4_hdmi_audio_prepare(struct
@@ -1403,8 +1525,11 @@ static int vc4_hdmi_audio_prepare(struct
channel_map = vc4_hdmi->variant->channel_map(vc4_hdmi, channel_mask);
HDMI_WRITE(HDMI_MAI_CHANNEL_MAP, channel_map);
HDMI_WRITE(HDMI_AUDIO_PACKET_CONFIG, audio_packet_config);
@ -553,7 +553,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
memcpy(&vc4_hdmi->audio.infoframe, &params->cea, sizeof(params->cea));
vc4_hdmi_set_audio_infoframe(encoder);
@@ -1677,6 +1802,8 @@ static void vc4_cec_read_msg(struct vc4_
@@ -1678,6 +1803,8 @@ static void vc4_cec_read_msg(struct vc4_
struct cec_msg *msg = &vc4_hdmi->cec_rx_msg;
unsigned int i;
@ -562,7 +562,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
msg->len = 1 + ((cntrl1 & VC4_HDMI_CEC_REC_WRD_CNT_MASK) >>
VC4_HDMI_CEC_REC_WRD_CNT_SHIFT);
@@ -1695,11 +1822,12 @@ static void vc4_cec_read_msg(struct vc4_
@@ -1696,11 +1823,12 @@ static void vc4_cec_read_msg(struct vc4_
}
}
@ -577,7 +577,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
cntrl1 = HDMI_READ(HDMI_CEC_CNTRL_1);
vc4_hdmi->cec_tx_ok = cntrl1 & VC4_HDMI_CEC_TX_STATUS_GOOD;
cntrl1 &= ~VC4_HDMI_CEC_START_XMIT_BEGIN;
@@ -1708,11 +1836,24 @@ static irqreturn_t vc4_cec_irq_handler_t
@@ -1709,11 +1837,24 @@ static irqreturn_t vc4_cec_irq_handler_t
return IRQ_WAKE_THREAD;
}
@ -603,7 +603,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
vc4_hdmi->cec_rx_msg.len = 0;
cntrl1 = HDMI_READ(HDMI_CEC_CNTRL_1);
vc4_cec_read_msg(vc4_hdmi, cntrl1);
@@ -1725,6 +1866,18 @@ static irqreturn_t vc4_cec_irq_handler_r
@@ -1726,6 +1867,18 @@ static irqreturn_t vc4_cec_irq_handler_r
return IRQ_WAKE_THREAD;
}
@ -622,7 +622,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
static irqreturn_t vc4_cec_irq_handler(int irq, void *priv)
{
struct vc4_hdmi *vc4_hdmi = priv;
@@ -1735,14 +1888,17 @@ static irqreturn_t vc4_cec_irq_handler(i
@@ -1736,14 +1889,17 @@ static irqreturn_t vc4_cec_irq_handler(i
if (!(stat & VC4_HDMI_CPU_CEC))
return IRQ_NONE;
@ -642,7 +642,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
return ret;
}
@@ -1751,6 +1907,7 @@ static int vc4_hdmi_cec_enable(struct ce
@@ -1752,6 +1908,7 @@ static int vc4_hdmi_cec_enable(struct ce
struct vc4_hdmi *vc4_hdmi = cec_get_drvdata(adap);
/* clock period in microseconds */
const u32 usecs = 1000000 / CEC_CLOCK_FREQ;
@ -650,7 +650,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
u32 val;
int ret;
@@ -1758,6 +1915,8 @@ static int vc4_hdmi_cec_enable(struct ce
@@ -1759,6 +1916,8 @@ static int vc4_hdmi_cec_enable(struct ce
if (ret)
return ret;
@ -659,7 +659,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
val = HDMI_READ(HDMI_CEC_CNTRL_5);
val &= ~(VC4_HDMI_CEC_TX_SW_RESET | VC4_HDMI_CEC_RX_SW_RESET |
VC4_HDMI_CEC_CNT_TO_4700_US_MASK |
@@ -1788,12 +1947,17 @@ static int vc4_hdmi_cec_enable(struct ce
@@ -1789,12 +1948,17 @@ static int vc4_hdmi_cec_enable(struct ce
if (!vc4_hdmi->variant->external_irq_controller)
HDMI_WRITE(HDMI_CEC_CPU_MASK_CLEAR, VC4_HDMI_CPU_CEC);
@ -677,7 +677,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
if (!vc4_hdmi->variant->external_irq_controller)
HDMI_WRITE(HDMI_CEC_CPU_MASK_SET, VC4_HDMI_CPU_CEC);
@@ -1801,6 +1965,8 @@ static int vc4_hdmi_cec_disable(struct c
@@ -1802,6 +1966,8 @@ static int vc4_hdmi_cec_disable(struct c
HDMI_WRITE(HDMI_CEC_CNTRL_5, HDMI_READ(HDMI_CEC_CNTRL_5) |
VC4_HDMI_CEC_TX_SW_RESET | VC4_HDMI_CEC_RX_SW_RESET);
@ -686,7 +686,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
pm_runtime_put(&vc4_hdmi->pdev->dev);
return 0;
@@ -1817,10 +1983,14 @@ static int vc4_hdmi_cec_adap_enable(stru
@@ -1818,10 +1984,14 @@ static int vc4_hdmi_cec_adap_enable(stru
static int vc4_hdmi_cec_adap_log_addr(struct cec_adapter *adap, u8 log_addr)
{
struct vc4_hdmi *vc4_hdmi = cec_get_drvdata(adap);
@ -701,7 +701,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
return 0;
}
@@ -1829,6 +1999,7 @@ static int vc4_hdmi_cec_adap_transmit(st
@@ -1830,6 +2000,7 @@ static int vc4_hdmi_cec_adap_transmit(st
{
struct vc4_hdmi *vc4_hdmi = cec_get_drvdata(adap);
struct drm_device *dev = vc4_hdmi->connector.dev;
@ -709,7 +709,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
u32 val;
unsigned int i;
@@ -1837,6 +2008,8 @@ static int vc4_hdmi_cec_adap_transmit(st
@@ -1838,6 +2009,8 @@ static int vc4_hdmi_cec_adap_transmit(st
return -ENOMEM;
}
@ -718,7 +718,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
for (i = 0; i < msg->len; i += 4)
HDMI_WRITE(HDMI_CEC_TX_DATA_1 + (i >> 2),
(msg->msg[i]) |
@@ -1852,6 +2025,9 @@ static int vc4_hdmi_cec_adap_transmit(st
@@ -1853,6 +2026,9 @@ static int vc4_hdmi_cec_adap_transmit(st
val |= VC4_HDMI_CEC_START_XMIT_BEGIN;
HDMI_WRITE(HDMI_CEC_CNTRL_1, val);
@ -728,7 +728,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
return 0;
}
@@ -1866,6 +2042,7 @@ static int vc4_hdmi_cec_init(struct vc4_
@@ -1867,6 +2043,7 @@ static int vc4_hdmi_cec_init(struct vc4_
struct cec_connector_info conn_info;
struct platform_device *pdev = vc4_hdmi->pdev;
struct device *dev = &pdev->dev;
@ -736,7 +736,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
u32 value;
int ret;
@@ -1886,10 +2063,12 @@ static int vc4_hdmi_cec_init(struct vc4_
@@ -1887,10 +2064,12 @@ static int vc4_hdmi_cec_init(struct vc4_
cec_fill_conn_info_from_drm(&conn_info, &vc4_hdmi->connector);
cec_s_conn_info(vc4_hdmi->cec_adap, &conn_info);
@ -749,7 +749,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
vc4_hdmi_cec_update_clk_div(vc4_hdmi);
@@ -1908,7 +2087,9 @@ static int vc4_hdmi_cec_init(struct vc4_
@@ -1909,7 +2088,9 @@ static int vc4_hdmi_cec_init(struct vc4_
if (ret)
goto err_remove_cec_rx_handler;
} else {
@ -759,7 +759,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
ret = request_threaded_irq(platform_get_irq(pdev, 0),
vc4_cec_irq_handler,
@@ -2178,6 +2359,7 @@ static int vc4_hdmi_bind(struct device *
@@ -2179,6 +2360,7 @@ static int vc4_hdmi_bind(struct device *
vc4_hdmi = devm_kzalloc(dev, sizeof(*vc4_hdmi), GFP_KERNEL);
if (!vc4_hdmi)
return -ENOMEM;

View file

@ -169,7 +169,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
}
static void vc4_hdmi_encoder_disable(struct drm_encoder *encoder)
@@ -995,6 +1024,8 @@ static void vc4_hdmi_encoder_pre_crtc_co
@@ -996,6 +1025,8 @@ static void vc4_hdmi_encoder_pre_crtc_co
unsigned long flags;
int ret;
@ -178,7 +178,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
/*
* As stated in RPi's vc4 firmware "HDMI state machine (HSM) clock must
* be faster than pixel clock, infinitesimally faster, tested in
@@ -1015,13 +1046,13 @@ static void vc4_hdmi_encoder_pre_crtc_co
@@ -1016,13 +1047,13 @@ static void vc4_hdmi_encoder_pre_crtc_co
ret = clk_set_min_rate(vc4_hdmi->hsm_clock, hsm_rate);
if (ret) {
DRM_ERROR("Failed to set HSM clock rate: %d\n", ret);
@ -194,7 +194,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
}
ret = clk_set_rate(vc4_hdmi->pixel_clock, pixel_rate);
@@ -1073,13 +1104,16 @@ static void vc4_hdmi_encoder_pre_crtc_co
@@ -1074,13 +1105,16 @@ static void vc4_hdmi_encoder_pre_crtc_co
if (vc4_hdmi->variant->set_timings)
vc4_hdmi->variant->set_timings(vc4_hdmi, conn_state, mode);
@ -212,7 +212,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
return;
}
@@ -1091,6 +1125,8 @@ static void vc4_hdmi_encoder_pre_crtc_en
@@ -1092,6 +1126,8 @@ static void vc4_hdmi_encoder_pre_crtc_en
struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
unsigned long flags;
@ -221,7 +221,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
if (vc4_encoder->hdmi_monitor &&
drm_default_rgb_quant_range(mode) == HDMI_QUANTIZATION_RANGE_LIMITED) {
if (vc4_hdmi->variant->csc_setup)
@@ -1107,6 +1143,8 @@ static void vc4_hdmi_encoder_pre_crtc_en
@@ -1108,6 +1144,8 @@ static void vc4_hdmi_encoder_pre_crtc_en
spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
HDMI_WRITE(HDMI_FIFO_CTL, VC4_HDMI_FIFO_CTL_MASTER_SLAVE_N);
spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags);
@ -230,7 +230,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
}
static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder,
@@ -1120,6 +1158,8 @@ static void vc4_hdmi_encoder_post_crtc_e
@@ -1121,6 +1159,8 @@ static void vc4_hdmi_encoder_post_crtc_e
unsigned long flags;
int ret;
@ -239,7 +239,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
HDMI_WRITE(HDMI_VID_CTL,
@@ -1179,6 +1219,8 @@ static void vc4_hdmi_encoder_post_crtc_e
@@ -1180,6 +1220,8 @@ static void vc4_hdmi_encoder_post_crtc_e
vc4_hdmi_recenter_fifo(vc4_hdmi);
vc4_hdmi_enable_scrambling(encoder);
@ -248,7 +248,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
}
static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder)
@@ -1322,6 +1364,7 @@ static void vc4_hdmi_set_n_cts(struct vc
@@ -1323,6 +1365,7 @@ static void vc4_hdmi_set_n_cts(struct vc
u32 n, cts;
u64 tmp;
@ -256,7 +256,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
lockdep_assert_held(&vc4_hdmi->hw_lock);
n = 128 * samplerate / 1000;
@@ -1355,13 +1398,17 @@ static int vc4_hdmi_audio_startup(struct
@@ -1356,13 +1399,17 @@ static int vc4_hdmi_audio_startup(struct
struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base;
unsigned long flags;
@ -275,7 +275,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
vc4_hdmi->audio.streaming = true;
@@ -1377,6 +1424,8 @@ static int vc4_hdmi_audio_startup(struct
@@ -1378,6 +1425,8 @@ static int vc4_hdmi_audio_startup(struct
if (vc4_hdmi->variant->phy_rng_enable)
vc4_hdmi->variant->phy_rng_enable(vc4_hdmi);
@ -284,7 +284,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
return 0;
}
@@ -1387,6 +1436,8 @@ static void vc4_hdmi_audio_reset(struct
@@ -1388,6 +1437,8 @@ static void vc4_hdmi_audio_reset(struct
unsigned long flags;
int ret;
@ -293,7 +293,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
vc4_hdmi->audio.streaming = false;
ret = vc4_hdmi_stop_packet(encoder, HDMI_INFOFRAME_TYPE_AUDIO, false);
if (ret)
@@ -1406,6 +1457,8 @@ static void vc4_hdmi_audio_shutdown(stru
@@ -1407,6 +1458,8 @@ static void vc4_hdmi_audio_shutdown(stru
struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);
unsigned long flags;
@ -302,7 +302,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
HDMI_WRITE(HDMI_MAI_CTL,
@@ -1420,6 +1473,8 @@ static void vc4_hdmi_audio_shutdown(stru
@@ -1421,6 +1474,8 @@ static void vc4_hdmi_audio_shutdown(stru
vc4_hdmi->audio.streaming = false;
vc4_hdmi_audio_reset(vc4_hdmi);
@ -311,7 +311,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
}
static int sample_rate_to_mai_fmt(int samplerate)
@@ -1478,6 +1533,8 @@ static int vc4_hdmi_audio_prepare(struct
@@ -1479,6 +1534,8 @@ static int vc4_hdmi_audio_prepare(struct
dev_dbg(dev, "%s: %u Hz, %d bit, %d channels\n", __func__,
sample_rate, params->sample_width, channels);
@ -320,7 +320,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
vc4_hdmi_audio_set_mai_clock(vc4_hdmi, sample_rate);
spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
@@ -1532,6 +1589,8 @@ static int vc4_hdmi_audio_prepare(struct
@@ -1533,6 +1590,8 @@ static int vc4_hdmi_audio_prepare(struct
memcpy(&vc4_hdmi->audio.infoframe, &params->cea, sizeof(params->cea));
vc4_hdmi_set_audio_infoframe(encoder);
@ -329,7 +329,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
return 0;
}
@@ -1574,7 +1633,9 @@ static int vc4_hdmi_audio_get_eld(struct
@@ -1575,7 +1634,9 @@ static int vc4_hdmi_audio_get_eld(struct
struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);
struct drm_connector *connector = &vc4_hdmi->connector;
@ -339,7 +339,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
return 0;
}
@@ -1911,6 +1972,17 @@ static int vc4_hdmi_cec_enable(struct ce
@@ -1912,6 +1973,17 @@ static int vc4_hdmi_cec_enable(struct ce
u32 val;
int ret;
@ -357,7 +357,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
ret = pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev);
if (ret)
return ret;
@@ -1957,6 +2029,17 @@ static int vc4_hdmi_cec_disable(struct c
@@ -1958,6 +2030,17 @@ static int vc4_hdmi_cec_disable(struct c
struct vc4_hdmi *vc4_hdmi = cec_get_drvdata(adap);
unsigned long flags;
@ -375,7 +375,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
if (!vc4_hdmi->variant->external_irq_controller)
@@ -1985,6 +2068,17 @@ static int vc4_hdmi_cec_adap_log_addr(st
@@ -1986,6 +2069,17 @@ static int vc4_hdmi_cec_adap_log_addr(st
struct vc4_hdmi *vc4_hdmi = cec_get_drvdata(adap);
unsigned long flags;
@ -393,7 +393,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
HDMI_WRITE(HDMI_CEC_CNTRL_1,
(HDMI_READ(HDMI_CEC_CNTRL_1) & ~VC4_HDMI_CEC_ADDR_MASK) |
@@ -2003,6 +2097,17 @@ static int vc4_hdmi_cec_adap_transmit(st
@@ -2004,6 +2098,17 @@ static int vc4_hdmi_cec_adap_transmit(st
u32 val;
unsigned int i;
@ -411,7 +411,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
if (msg->len > 16) {
drm_err(dev, "Attempting to transmit too much data (%d)\n", msg->len);
return -ENOMEM;
@@ -2359,6 +2464,7 @@ static int vc4_hdmi_bind(struct device *
@@ -2360,6 +2465,7 @@ static int vc4_hdmi_bind(struct device *
vc4_hdmi = devm_kzalloc(dev, sizeof(*vc4_hdmi), GFP_KERNEL);
if (!vc4_hdmi)
return -ENOMEM;

View file

@ -73,7 +73,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
return;
if (delayed_work_pending(&vc4_hdmi->scrambling_work))
@@ -1017,8 +1019,8 @@ static void vc4_hdmi_encoder_pre_crtc_co
@@ -1018,8 +1020,8 @@ static void vc4_hdmi_encoder_pre_crtc_co
vc4_hdmi_encoder_get_connector_state(encoder, state);
struct vc4_hdmi_connector_state *vc4_conn_state =
conn_state_to_vc4_hdmi_conn_state(conn_state);
@ -83,7 +83,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
unsigned long pixel_rate = vc4_conn_state->pixel_rate;
unsigned long bvb_rate, hsm_rate;
unsigned long flags;
@@ -1120,9 +1122,9 @@ out:
@@ -1121,9 +1123,9 @@ out:
static void vc4_hdmi_encoder_pre_crtc_enable(struct drm_encoder *encoder,
struct drm_atomic_state *state)
{
@ -95,7 +95,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
unsigned long flags;
mutex_lock(&vc4_hdmi->mutex);
@@ -1150,8 +1152,8 @@ static void vc4_hdmi_encoder_pre_crtc_en
@@ -1151,8 +1153,8 @@ static void vc4_hdmi_encoder_pre_crtc_en
static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder,
struct drm_atomic_state *state)
{
@ -105,7 +105,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder);
bool hsync_pos = mode->flags & DRM_MODE_FLAG_PHSYNC;
bool vsync_pos = mode->flags & DRM_MODE_FLAG_PVSYNC;
@@ -1227,6 +1229,19 @@ static void vc4_hdmi_encoder_enable(stru
@@ -1228,6 +1230,19 @@ static void vc4_hdmi_encoder_enable(stru
{
}
@ -125,7 +125,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
#define WIFI_2_4GHz_CH1_MIN_FREQ 2400000000ULL
#define WIFI_2_4GHz_CH1_MAX_FREQ 2422000000ULL
@@ -1305,6 +1320,7 @@ vc4_hdmi_encoder_mode_valid(struct drm_e
@@ -1306,6 +1321,7 @@ vc4_hdmi_encoder_mode_valid(struct drm_e
static const struct drm_encoder_helper_funcs vc4_hdmi_encoder_helper_funcs = {
.atomic_check = vc4_hdmi_encoder_atomic_check,
@ -133,7 +133,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
.mode_valid = vc4_hdmi_encoder_mode_valid,
.disable = vc4_hdmi_encoder_disable,
.enable = vc4_hdmi_encoder_enable,
@@ -1358,9 +1374,7 @@ static void vc4_hdmi_audio_set_mai_clock
@@ -1359,9 +1375,7 @@ static void vc4_hdmi_audio_set_mai_clock
static void vc4_hdmi_set_n_cts(struct vc4_hdmi *vc4_hdmi, unsigned int samplerate)
{

View file

@ -19,7 +19,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -1406,20 +1406,36 @@ static inline struct vc4_hdmi *dai_to_hd
@@ -1407,20 +1407,36 @@ static inline struct vc4_hdmi *dai_to_hd
return snd_soc_card_get_drvdata(card);
}
@ -63,7 +63,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
mutex_unlock(&vc4_hdmi->mutex);
return -ENODEV;
}
@@ -1549,6 +1565,11 @@ static int vc4_hdmi_audio_prepare(struct
@@ -1550,6 +1566,11 @@ static int vc4_hdmi_audio_prepare(struct
mutex_lock(&vc4_hdmi->mutex);

View file

@ -32,7 +32,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
}
static void vc4_hdmi_csc_setup(struct vc4_hdmi *vc4_hdmi, bool enable)
@@ -1227,6 +1232,11 @@ static void vc4_hdmi_encoder_post_crtc_e
@@ -1228,6 +1233,11 @@ static void vc4_hdmi_encoder_post_crtc_e
static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder)
{
@ -44,7 +44,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
}
static void vc4_hdmi_encoder_atomic_mode_set(struct drm_encoder *encoder,
@@ -1408,14 +1418,12 @@ static inline struct vc4_hdmi *dai_to_hd
@@ -1409,14 +1419,12 @@ static inline struct vc4_hdmi *dai_to_hd
static bool vc4_hdmi_audio_can_stream(struct vc4_hdmi *vc4_hdmi)
{

View file

@ -69,7 +69,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
if (delayed_work_pending(&vc4_hdmi->scrambling_work))
cancel_delayed_work_sync(&vc4_hdmi->scrambling_work);
@@ -2522,6 +2516,14 @@ static int vc4_hdmi_bind(struct device *
@@ -2523,6 +2517,14 @@ static int vc4_hdmi_bind(struct device *
vc4_hdmi->pdev = pdev;
vc4_hdmi->variant = variant;

View file

@ -109,7 +109,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
*/
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -525,11 +525,6 @@ static void vc4_plane_calc_load(struct d
@@ -527,11 +527,6 @@ static void vc4_plane_calc_load(struct d
struct vc4_plane_state *vc4_state;
struct drm_crtc_state *crtc_state;
unsigned int vscale_factor;

View file

@ -44,7 +44,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -1801,10 +1801,11 @@ static void vc4_hdmi_audio_exit(struct v
@@ -1802,10 +1802,11 @@ static void vc4_hdmi_audio_exit(struct v
static irqreturn_t vc4_hdmi_hpd_irq_thread(int irq, void *priv)
{
struct vc4_hdmi *vc4_hdmi = priv;

View file

@ -20,7 +20,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
@@ -378,7 +378,7 @@ static const struct gpio_chip bcm2835_gp
@@ -376,7 +376,7 @@ static const struct gpio_chip bcm2835_gp
.get = bcm2835_gpio_get,
.set = bcm2835_gpio_set,
.set_config = gpiochip_generic_config,
@ -29,7 +29,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
.ngpio = BCM2835_NUM_GPIOS,
.can_sleep = false,
.of_gpio_ranges_fallback = bcm2835_of_gpio_ranges_fallback,
@@ -395,7 +395,7 @@ static const struct gpio_chip bcm2711_gp
@@ -393,7 +393,7 @@ static const struct gpio_chip bcm2711_gp
.get = bcm2835_gpio_get,
.set = bcm2835_gpio_set,
.set_config = gpiochip_generic_config,

View file

@ -18,7 +18,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -2608,7 +2608,7 @@ static void bcmgenet_init_tx_ring(struct
@@ -2616,7 +2616,7 @@ static void bcmgenet_init_tx_ring(struct
bcmgenet_tdma_ring_writel(priv, index, 0, TDMA_PROD_INDEX);
bcmgenet_tdma_ring_writel(priv, index, 0, TDMA_CONS_INDEX);
@ -27,7 +27,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
/* Disable rate control for now */
bcmgenet_tdma_ring_writel(priv, index, flow_period_val,
TDMA_FLOW_PERIOD);
@@ -4075,9 +4075,12 @@ static int bcmgenet_probe(struct platfor
@@ -4083,9 +4083,12 @@ static int bcmgenet_probe(struct platfor
netif_set_real_num_rx_queues(priv->dev, priv->hw_params->rx_queues + 1);
/* Set default coalescing parameters */

View file

@ -20,7 +20,7 @@ Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
@@ -293,6 +293,8 @@ int bcmgenet_mii_probe(struct net_device
@@ -286,6 +286,8 @@ int bcmgenet_mii_probe(struct net_device
/* Communicate the integrated PHY revision */
if (priv->internal_phy)
phy_flags = priv->gphy_rev;

View file

@ -37,7 +37,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
static inline void bcmgenet_writel(u32 value, void __iomem *offset)
{
@@ -2439,6 +2442,11 @@ static void reset_umac(struct bcmgenet_p
@@ -2447,6 +2450,11 @@ static void reset_umac(struct bcmgenet_p
bcmgenet_rbuf_ctrl_set(priv, 0);
udelay(10);

View file

@ -14,7 +14,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
@@ -1339,7 +1339,7 @@ static int bcm2835_pinctrl_probe(struct
@@ -1337,7 +1337,7 @@ static int bcm2835_pinctrl_probe(struct
girq->default_type = IRQ_TYPE_NONE;
girq->handler = handle_level_irq;

View file

@ -24,7 +24,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -3257,7 +3257,7 @@ static void bcmgenet_get_hw_addr(struct
@@ -3265,7 +3265,7 @@ static void bcmgenet_get_hw_addr(struct
}
/* Returns a reusable dma control register value */
@ -33,7 +33,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
{
unsigned int i;
u32 reg;
@@ -3282,6 +3282,14 @@ static u32 bcmgenet_dma_disable(struct b
@@ -3290,6 +3290,14 @@ static u32 bcmgenet_dma_disable(struct b
udelay(10);
bcmgenet_umac_writel(priv, 0, UMAC_TX_FLUSH);
@ -48,7 +48,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
return dma_ctrl;
}
@@ -3345,8 +3353,8 @@ static int bcmgenet_open(struct net_devi
@@ -3353,8 +3361,8 @@ static int bcmgenet_open(struct net_devi
bcmgenet_set_hw_addr(priv, dev->dev_addr);
@ -59,7 +59,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
/* Reinitialize TDMA and RDMA and SW housekeeping */
ret = bcmgenet_init_dma(priv);
@@ -4204,7 +4212,7 @@ static int bcmgenet_resume(struct device
@@ -4212,7 +4220,7 @@ static int bcmgenet_resume(struct device
bcmgenet_hfb_create_rxnfc_filter(priv, rule);
/* Disable RX/TX DMA and flush TX queues */

View file

@ -169,7 +169,7 @@ Signed-off-by: Joerg Quinten <aBUGSworstnightmare@gmail.com>
}, {
--- a/drivers/gpu/drm/vc4/vc4_dpi.c
+++ b/drivers/gpu/drm/vc4/vc4_dpi.c
@@ -165,10 +165,20 @@ static void vc4_dpi_encoder_enable(struc
@@ -167,10 +167,20 @@ static void vc4_dpi_encoder_enable(struc
dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_2,
DPI_FORMAT);
break;
@ -188,7 +188,7 @@ Signed-off-by: Joerg Quinten <aBUGSworstnightmare@gmail.com>
+ dpi_c |= VC4_SET_FIELD(DPI_ORDER_BGR, DPI_ORDER);
+ break;
case MEDIA_BUS_FMT_RGB565_1X16:
dpi_c |= VC4_SET_FIELD(DPI_FORMAT_16BIT_565_RGB_3,
dpi_c |= VC4_SET_FIELD(DPI_FORMAT_16BIT_565_RGB_1,
DPI_FORMAT);
--- a/include/uapi/linux/media-bus-format.h
+++ b/include/uapi/linux/media-bus-format.h

View file

@ -26,7 +26,7 @@ Link: https://lore.kernel.org/r/20211215091739.135042-3-maxime@cerno.tech
} hvs_formats[] = {
{
.drm = DRM_FORMAT_XRGB8888,
@@ -128,6 +129,12 @@ static const struct hvs_format {
@@ -130,6 +131,12 @@ static const struct hvs_format {
.hvs = HVS_PIXEL_FORMAT_YCBCR_YUV422_2PLANE,
.pixel_order = HVS_PIXEL_ORDER_XYCRCB,
},
@ -39,7 +39,7 @@ Link: https://lore.kernel.org/r/20211215091739.135042-3-maxime@cerno.tech
};
static const struct hvs_format *vc4_get_hvs_format(u32 drm_format)
@@ -758,47 +765,90 @@ static int vc4_plane_mode_set(struct drm
@@ -760,47 +767,90 @@ static int vc4_plane_mode_set(struct drm
case DRM_FORMAT_MOD_BROADCOM_SAND128:
case DRM_FORMAT_MOD_BROADCOM_SAND256: {
uint32_t param = fourcc_mod_broadcom_param(fb->modifier);
@ -157,7 +157,7 @@ Link: https://lore.kernel.org/r/20211215091739.135042-3-maxime@cerno.tech
}
pitch0 = VC4_SET_FIELD(param, SCALER_TILE_HEIGHT);
@@ -951,7 +1001,8 @@ static int vc4_plane_mode_set(struct drm
@@ -953,7 +1003,8 @@ static int vc4_plane_mode_set(struct drm
/* Pitch word 1/2 */
for (i = 1; i < num_planes; i++) {
@ -167,7 +167,7 @@ Link: https://lore.kernel.org/r/20211215091739.135042-3-maxime@cerno.tech
vc4_dlist_write(vc4_state,
VC4_SET_FIELD(fb->pitches[i],
SCALER_SRC_PITCH));
@@ -1311,6 +1362,13 @@ static bool vc4_format_mod_supported(str
@@ -1313,6 +1364,13 @@ static bool vc4_format_mod_supported(str
default:
return false;
}
@ -181,7 +181,7 @@ Link: https://lore.kernel.org/r/20211215091739.135042-3-maxime@cerno.tech
case DRM_FORMAT_RGBX1010102:
case DRM_FORMAT_BGRX1010102:
case DRM_FORMAT_RGBA1010102:
@@ -1343,8 +1401,11 @@ struct drm_plane *vc4_plane_init(struct
@@ -1345,8 +1403,11 @@ struct drm_plane *vc4_plane_init(struct
struct drm_plane *plane = NULL;
struct vc4_plane *vc4_plane;
u32 formats[ARRAY_SIZE(hvs_formats)];
@ -193,7 +193,7 @@ Link: https://lore.kernel.org/r/20211215091739.135042-3-maxime@cerno.tech
static const uint64_t modifiers[] = {
DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED,
DRM_FORMAT_MOD_BROADCOM_SAND128,
@@ -1359,13 +1420,17 @@ struct drm_plane *vc4_plane_init(struct
@@ -1361,13 +1422,17 @@ struct drm_plane *vc4_plane_init(struct
if (!vc4_plane)
return ERR_PTR(-ENOMEM);

View file

@ -21,7 +21,7 @@ Link: https://lore.kernel.org/r/20211215091739.135042-4-maxime@cerno.tech
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -619,6 +619,51 @@ static int vc4_plane_allocate_lbm(struct
@@ -621,6 +621,51 @@ static int vc4_plane_allocate_lbm(struct
return 0;
}
@ -73,7 +73,7 @@ Link: https://lore.kernel.org/r/20211215091739.135042-4-maxime@cerno.tech
/* Writes out a full display list for an active plane to the plane's
* private dlist state.
*/
@@ -1013,9 +1058,20 @@ static int vc4_plane_mode_set(struct drm
@@ -1015,9 +1060,20 @@ static int vc4_plane_mode_set(struct drm
/* Colorspace conversion words */
if (vc4_state->is_yuv) {
@ -97,7 +97,7 @@ Link: https://lore.kernel.org/r/20211215091739.135042-4-maxime@cerno.tech
}
vc4_state->lbm_offset = 0;
@@ -1444,6 +1500,15 @@ struct drm_plane *vc4_plane_init(struct
@@ -1446,6 +1502,15 @@ struct drm_plane *vc4_plane_init(struct
DRM_MODE_REFLECT_X |
DRM_MODE_REFLECT_Y);
@ -115,7 +115,7 @@ Link: https://lore.kernel.org/r/20211215091739.135042-4-maxime@cerno.tech
--- a/drivers/gpu/drm/vc4/vc4_regs.h
+++ b/drivers/gpu/drm/vc4/vc4_regs.h
@@ -983,7 +983,10 @@ enum hvs_pixel_format {
@@ -989,7 +989,10 @@ enum hvs_pixel_format {
#define SCALER_CSC0_COEF_CR_OFS_SHIFT 0
#define SCALER_CSC0_ITR_R_601_5 0x00f00000
#define SCALER_CSC0_ITR_R_709_3 0x00f00000
@ -126,7 +126,7 @@ Link: https://lore.kernel.org/r/20211215091739.135042-4-maxime@cerno.tech
/* S2.8 contribution of Cb to Green */
#define SCALER_CSC1_COEF_CB_GRN_MASK VC4_MASK(31, 22)
@@ -998,8 +1001,11 @@ enum hvs_pixel_format {
@@ -1004,8 +1007,11 @@ enum hvs_pixel_format {
#define SCALER_CSC1_COEF_CR_BLU_MASK VC4_MASK(1, 0)
#define SCALER_CSC1_COEF_CR_BLU_SHIFT 0
#define SCALER_CSC1_ITR_R_601_5 0xe73304a8
@ -140,7 +140,7 @@ Link: https://lore.kernel.org/r/20211215091739.135042-4-maxime@cerno.tech
/* S2.8 contribution of Cb to Red */
#define SCALER_CSC2_COEF_CB_RED_MASK VC4_MASK(29, 20)
@@ -1010,9 +1016,12 @@ enum hvs_pixel_format {
@@ -1016,9 +1022,12 @@ enum hvs_pixel_format {
/* S2.8 contribution of Cb to Blue */
#define SCALER_CSC2_COEF_CB_BLU_MASK VC4_MASK(19, 10)
#define SCALER_CSC2_COEF_CB_BLU_SHIFT 10

View file

@ -59,7 +59,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
/* The filter kernel is composed of dwords each containing 3 9-bit
* signed integers packed next to each other.
*/
@@ -728,6 +767,8 @@ static int vc4_hvs_bind(struct device *d
@@ -739,6 +778,8 @@ static int vc4_hvs_bind(struct device *d
vc4_debugfs_add_regset32(drm, "hvs_regs", &hvs->regset);
vc4_debugfs_add_file(drm, "hvs_underrun", vc4_hvs_debugfs_underrun,
NULL);

View file

@ -29,7 +29,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
return 0;
}
@@ -2369,6 +2375,7 @@ static int vc5_hdmi_init_resources(struc
@@ -2370,6 +2376,7 @@ static int vc5_hdmi_init_resources(struc
struct platform_device *pdev = vc4_hdmi->pdev;
struct device *dev = &pdev->dev;
struct resource *res;
@ -37,7 +37,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hdmi");
if (!res)
@@ -2465,6 +2472,38 @@ static int vc5_hdmi_init_resources(struc
@@ -2466,6 +2473,38 @@ static int vc5_hdmi_init_resources(struc
return PTR_ERR(vc4_hdmi->reset);
}

View file

@ -21,9 +21,9 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
--- a/drivers/gpu/drm/vc4/vc4_dpi.c
+++ b/drivers/gpu/drm/vc4/vc4_dpi.c
@@ -188,8 +188,8 @@ static void vc4_dpi_encoder_enable(struc
break;
}
@@ -198,8 +198,8 @@ static void vc4_dpi_encoder_enable(struc
if (connector->display_info.bus_flags & DRM_BUS_FLAG_DE_LOW)
dpi_c |= DPI_OUTPUT_ENABLE_INVERT;
} else {
- /* Default to 24bit if no connector found. */
- dpi_c |= VC4_SET_FIELD(DPI_FORMAT_24BIT_888_RGB, DPI_FORMAT);

View file

@ -15,7 +15,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -1011,30 +1011,15 @@ static void vc4_hdmi_recenter_fifo(struc
@@ -1012,30 +1012,15 @@ static void vc4_hdmi_recenter_fifo(struc
"VC4_HDMI_FIFO_CTL_RECENTER_DONE");
}

View file

@ -13,7 +13,7 @@ Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
--- a/drivers/media/i2c/imx219.c
+++ b/drivers/media/i2c/imx219.c
@@ -674,7 +674,7 @@ static void imx219_set_default_format(st
@@ -584,7 +584,7 @@ static void imx219_set_default_format(st
fmt = &imx219->fmt;
fmt->code = MEDIA_BUS_FMT_SRGGB10_1X10;
@ -22,7 +22,7 @@ Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
fmt->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(fmt->colorspace);
fmt->quantization = V4L2_MAP_QUANTIZATION_DEFAULT(true,
fmt->colorspace,
@@ -844,7 +844,7 @@ static int imx219_enum_frame_size(struct
@@ -754,7 +754,7 @@ static int imx219_enum_frame_size(struct
static void imx219_reset_colorspace(struct v4l2_mbus_framefmt *fmt)
{

View file

@ -241,7 +241,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
/* Unsetting DISPBKGND_GAMMA skips the gamma lut step
--- a/drivers/gpu/drm/vc4/vc4_regs.h
+++ b/drivers/gpu/drm/vc4/vc4_regs.h
@@ -499,6 +499,28 @@
@@ -505,6 +505,28 @@
#define SCALER_DLIST_START 0x00002000
#define SCALER_DLIST_SIZE 0x00004000

View file

@ -102,7 +102,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
/* The filter kernel is composed of dwords each containing 3 9-bit
* signed integers packed next to each other.
*/
@@ -848,6 +926,9 @@ static int vc4_hvs_bind(struct device *d
@@ -859,6 +937,9 @@ static int vc4_hvs_bind(struct device *d
NULL);
vc4_debugfs_add_file(drm, "hvs_dlists", vc4_hvs_debugfs_dlist,
NULL);

View file

@ -20,7 +20,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -2557,7 +2557,8 @@ static int vc4_hdmi_bind(struct device *
@@ -2558,7 +2558,8 @@ static int vc4_hdmi_bind(struct device *
* vc4_hdmi_disable_scrambling() will thus run at boot, make
* sure it's disabled, and avoid any inconsistency.
*/

View file

@ -22,7 +22,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
int ret;
/* Look up the connector attached to DPI so we can get the
@@ -192,15 +192,22 @@ static void vc4_dpi_encoder_enable(struc
@@ -202,15 +202,22 @@ static void vc4_dpi_encoder_enable(struc
dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_1, DPI_FORMAT);
}

View file

@ -36,7 +36,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
connected = true;
}
@@ -1355,6 +1349,18 @@ static u32 vc5_hdmi_channel_map(struct v
@@ -1356,6 +1350,18 @@ static u32 vc5_hdmi_channel_map(struct v
return channel_map;
}
@ -55,7 +55,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
/* HDMI audio codec callbacks */
static void vc4_hdmi_audio_set_mai_clock(struct vc4_hdmi *vc4_hdmi,
unsigned int samplerate)
@@ -2777,6 +2783,7 @@ static const struct vc4_hdmi_variant bcm
@@ -2778,6 +2784,7 @@ static const struct vc4_hdmi_variant bcm
.phy_rng_disable = vc5_hdmi_phy_rng_disable,
.channel_map = vc5_hdmi_channel_map,
.supports_hdr = true,
@ -63,7 +63,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
};
static const struct vc4_hdmi_variant bcm2711_hdmi1_variant = {
@@ -2805,6 +2812,7 @@ static const struct vc4_hdmi_variant bcm
@@ -2806,6 +2813,7 @@ static const struct vc4_hdmi_variant bcm
.phy_rng_disable = vc5_hdmi_phy_rng_disable,
.channel_map = vc5_hdmi_channel_map,
.supports_hdr = true,

View file

@ -22,7 +22,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -2193,7 +2193,6 @@ static int vc4_hdmi_cec_init(struct vc4_
@@ -2194,7 +2194,6 @@ static int vc4_hdmi_cec_init(struct vc4_
struct platform_device *pdev = vc4_hdmi->pdev;
struct device *dev = &pdev->dev;
unsigned long flags;
@ -30,7 +30,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
int ret;
if (!of_find_property(dev->of_node, "interrupts", NULL)) {
@@ -2213,15 +2212,6 @@ static int vc4_hdmi_cec_init(struct vc4_
@@ -2214,15 +2213,6 @@ static int vc4_hdmi_cec_init(struct vc4_
cec_fill_conn_info_from_drm(&conn_info, &vc4_hdmi->connector);
cec_s_conn_info(vc4_hdmi->cec_adap, &conn_info);
@ -46,7 +46,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
if (vc4_hdmi->variant->external_irq_controller) {
ret = request_threaded_irq(platform_get_irq_byname(pdev, "cec-rx"),
vc4_cec_irq_handler_rx_bare,
@@ -2284,6 +2274,29 @@ static void vc4_hdmi_cec_exit(struct vc4
@@ -2285,6 +2275,29 @@ static void vc4_hdmi_cec_exit(struct vc4
cec_unregister_adapter(vc4_hdmi->cec_adap);
}
@ -76,7 +76,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
#else
static int vc4_hdmi_cec_init(struct vc4_hdmi *vc4_hdmi)
{
@@ -2292,6 +2305,10 @@ static int vc4_hdmi_cec_init(struct vc4_
@@ -2293,6 +2306,10 @@ static int vc4_hdmi_cec_init(struct vc4_
static void vc4_hdmi_cec_exit(struct vc4_hdmi *vc4_hdmi) {};
@ -87,7 +87,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
#endif
static int vc4_hdmi_build_regset(struct vc4_hdmi *vc4_hdmi,
@@ -2526,6 +2543,15 @@ static int vc4_hdmi_runtime_resume(struc
@@ -2527,6 +2544,15 @@ static int vc4_hdmi_runtime_resume(struc
if (ret)
return ret;

View file

@ -1,114 +0,0 @@
From e664a91ea54b3488d6c08dd82dac2af1239c3275 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Thu, 2 Dec 2021 18:21:46 +0000
Subject: [PATCH] drm/vc4: dpi: Add option for inverting pixel clock
and output enable
DRM provides flags for inverting pixel clock and output enable
signals, but these were not mapped to the relevant registers.
Add those mappings.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/gpu/drm/vc4/vc4_dpi.c | 89 ++++++++++++++++++++---------------
1 file changed, 51 insertions(+), 38 deletions(-)
--- a/drivers/gpu/drm/vc4/vc4_dpi.c
+++ b/drivers/gpu/drm/vc4/vc4_dpi.c
@@ -148,45 +148,58 @@ static void vc4_dpi_encoder_enable(struc
}
drm_connector_list_iter_end(&conn_iter);
- if (connector && connector->display_info.num_bus_formats) {
- u32 bus_format = connector->display_info.bus_formats[0];
+ if (connector) {
+ if (connector->display_info.num_bus_formats) {
+ u32 bus_format = connector->display_info.bus_formats[0];
- switch (bus_format) {
- case MEDIA_BUS_FMT_RGB888_1X24:
- dpi_c |= VC4_SET_FIELD(DPI_FORMAT_24BIT_888_RGB,
- DPI_FORMAT);
- break;
- case MEDIA_BUS_FMT_BGR888_1X24:
- dpi_c |= VC4_SET_FIELD(DPI_FORMAT_24BIT_888_RGB,
- DPI_FORMAT);
- dpi_c |= VC4_SET_FIELD(DPI_ORDER_BGR, DPI_ORDER);
- break;
- case MEDIA_BUS_FMT_RGB666_1X24_CPADHI:
- dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_2,
- DPI_FORMAT);
- break;
- case MEDIA_BUS_FMT_BGR666_1X24_CPADHI:
- dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_2,
- DPI_FORMAT);
- dpi_c |= VC4_SET_FIELD(DPI_ORDER_BGR, DPI_ORDER);
- break;
- case MEDIA_BUS_FMT_RGB666_1X18:
- dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_1,
- DPI_FORMAT);
- break;
- case MEDIA_BUS_FMT_BGR666_1X18:
- dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_1,
- DPI_FORMAT);
- dpi_c |= VC4_SET_FIELD(DPI_ORDER_BGR, DPI_ORDER);
- break;
- case MEDIA_BUS_FMT_RGB565_1X16:
- dpi_c |= VC4_SET_FIELD(DPI_FORMAT_16BIT_565_RGB_3,
- DPI_FORMAT);
- break;
- default:
- DRM_ERROR("Unknown media bus format %d\n", bus_format);
- break;
+ switch (bus_format) {
+ case MEDIA_BUS_FMT_RGB888_1X24:
+ dpi_c |= VC4_SET_FIELD(DPI_FORMAT_24BIT_888_RGB,
+ DPI_FORMAT);
+ break;
+ case MEDIA_BUS_FMT_BGR888_1X24:
+ dpi_c |= VC4_SET_FIELD(DPI_FORMAT_24BIT_888_RGB,
+ DPI_FORMAT);
+ dpi_c |= VC4_SET_FIELD(DPI_ORDER_BGR,
+ DPI_ORDER);
+ break;
+ case MEDIA_BUS_FMT_RGB666_1X24_CPADHI:
+ dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_2,
+ DPI_FORMAT);
+ break;
+ case MEDIA_BUS_FMT_BGR666_1X24_CPADHI:
+ dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_2,
+ DPI_FORMAT);
+ dpi_c |= VC4_SET_FIELD(DPI_ORDER_BGR,
+ DPI_ORDER);
+ break;
+ case MEDIA_BUS_FMT_RGB666_1X18:
+ dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_1,
+ DPI_FORMAT);
+ break;
+ case MEDIA_BUS_FMT_BGR666_1X18:
+ dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_1,
+ DPI_FORMAT);
+ dpi_c |= VC4_SET_FIELD(DPI_ORDER_BGR,
+ DPI_ORDER);
+ break;
+ case MEDIA_BUS_FMT_RGB565_1X16:
+ dpi_c |= VC4_SET_FIELD(DPI_FORMAT_16BIT_565_RGB_3,
+ DPI_FORMAT);
+ break;
+ default:
+ DRM_ERROR("Unknown media bus format %d\n",
+ bus_format);
+ break;
+ }
}
+
+ if (connector->display_info.bus_flags &
+ DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE)
+ dpi_c |= DPI_PIXEL_CLK_INVERT;
+
+ if (connector->display_info.bus_flags & DRM_BUS_FLAG_DE_LOW)
+ dpi_c |= DPI_OUTPUT_ENABLE_INVERT;
} else {
/* Default to 18bit if no connector found. */
dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_1, DPI_FORMAT);

View file

@ -15,9 +15,9 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
--- a/drivers/gpu/drm/vc4/vc4_dpi.c
+++ b/drivers/gpu/drm/vc4/vc4_dpi.c
@@ -173,6 +173,10 @@ static void vc4_dpi_encoder_enable(struc
dpi_c |= VC4_SET_FIELD(DPI_ORDER_BGR,
DPI_ORDER);
@@ -172,6 +172,10 @@ static void vc4_dpi_encoder_enable(struc
DPI_FORMAT);
dpi_c |= VC4_SET_FIELD(DPI_ORDER_BGR, DPI_ORDER);
break;
+ default:
+ DRM_ERROR("Unknown media bus format %d\n",
@ -26,8 +26,8 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
case MEDIA_BUS_FMT_RGB666_1X18:
dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_1,
DPI_FORMAT);
@@ -187,11 +191,12 @@ static void vc4_dpi_encoder_enable(struc
dpi_c |= VC4_SET_FIELD(DPI_FORMAT_16BIT_565_RGB_3,
@@ -185,11 +189,12 @@ static void vc4_dpi_encoder_enable(struc
dpi_c |= VC4_SET_FIELD(DPI_FORMAT_16BIT_565_RGB_1,
DPI_FORMAT);
break;
- default:
@ -42,4 +42,4 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
+
}
if (connector->display_info.bus_flags &
if (connector->display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE)

View file

@ -22,7 +22,7 @@ Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
--- a/drivers/media/i2c/imx219.c
+++ b/drivers/media/i2c/imx219.c
@@ -118,6 +118,16 @@
@@ -124,6 +124,16 @@
#define IMX219_PIXEL_ARRAY_WIDTH 3280U
#define IMX219_PIXEL_ARRAY_HEIGHT 2464U
@ -39,7 +39,7 @@ Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
struct imx219_reg {
u16 address;
u8 val;
@@ -538,7 +548,7 @@ static const struct imx219_mode supporte
@@ -448,7 +458,7 @@ static const struct imx219_mode supporte
struct imx219 {
struct v4l2_subdev sd;
@ -48,7 +48,7 @@ Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
struct v4l2_mbus_framefmt fmt;
@@ -688,18 +698,26 @@ static void imx219_set_default_format(st
@@ -598,18 +608,26 @@ static void imx219_set_default_format(st
static int imx219_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
{
struct imx219 *imx219 = to_imx219(sd);
@ -83,7 +83,7 @@ Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
/* Initialize try_crop rectangle. */
try_crop = v4l2_subdev_get_try_crop(sd, fh->state, 0);
@@ -808,12 +826,21 @@ static int imx219_enum_mbus_code(struct
@@ -718,12 +736,21 @@ static int imx219_enum_mbus_code(struct
{
struct imx219 *imx219 = to_imx219(sd);
@ -109,7 +109,7 @@ Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
return 0;
}
@@ -823,21 +850,30 @@ static int imx219_enum_frame_size(struct
@@ -733,21 +760,30 @@ static int imx219_enum_frame_size(struct
struct v4l2_subdev_frame_size_enum *fse)
{
struct imx219 *imx219 = to_imx219(sd);
@ -151,7 +151,7 @@ Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
return 0;
}
@@ -852,9 +888,9 @@ static void imx219_reset_colorspace(stru
@@ -762,9 +798,9 @@ static void imx219_reset_colorspace(stru
fmt->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(fmt->colorspace);
}
@ -164,7 +164,7 @@ Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
{
fmt->format.width = mode->width;
fmt->format.height = mode->height;
@@ -862,21 +898,39 @@ static void imx219_update_pad_format(str
@@ -772,21 +808,39 @@ static void imx219_update_pad_format(str
imx219_reset_colorspace(&fmt->format);
}
@ -208,7 +208,7 @@ Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
}
return 0;
@@ -906,51 +960,74 @@ static int imx219_set_pad_format(struct
@@ -816,51 +870,74 @@ static int imx219_set_pad_format(struct
int exposure_max, exposure_def, hblank;
unsigned int i;
@ -326,7 +326,7 @@ Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
}
mutex_unlock(&imx219->mutex);
@@ -1037,9 +1114,11 @@ static int imx219_start_streaming(struct
@@ -976,9 +1053,11 @@ static int imx219_start_streaming(struct
const struct imx219_reg_list *reg_list;
int ret;
@ -338,9 +338,9 @@ Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
return ret;
+ }
/* Apply default values of current mode */
reg_list = &imx219->mode->reg_list;
@@ -1133,21 +1212,22 @@ err_unlock:
/* Send all registers that are common to all modes */
ret = imx219_write_regs(imx219, imx219_common_regs, ARRAY_SIZE(imx219_common_regs));
@@ -1086,21 +1165,22 @@ err_unlock:
/* Power/clock management functions */
static int imx219_power_on(struct device *dev)
{
@ -366,7 +366,7 @@ Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
__func__);
goto reg_off;
}
@@ -1166,7 +1246,8 @@ reg_off:
@@ -1119,7 +1199,8 @@ reg_off:
static int imx219_power_off(struct device *dev)
{
@ -376,7 +376,7 @@ Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
struct imx219 *imx219 = to_imx219(sd);
gpiod_set_value_cansleep(imx219->reset_gpio, 0);
@@ -1178,7 +1259,8 @@ static int imx219_power_off(struct devic
@@ -1131,7 +1212,8 @@ static int imx219_power_off(struct devic
static int __maybe_unused imx219_suspend(struct device *dev)
{
@ -386,7 +386,7 @@ Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
struct imx219 *imx219 = to_imx219(sd);
if (imx219->streaming)
@@ -1189,7 +1271,8 @@ static int __maybe_unused imx219_suspend
@@ -1142,7 +1224,8 @@ static int __maybe_unused imx219_suspend
static int __maybe_unused imx219_resume(struct device *dev)
{
@ -396,7 +396,7 @@ Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
struct imx219 *imx219 = to_imx219(sd);
int ret;
@@ -1525,13 +1608,14 @@ static int imx219_probe(struct i2c_clien
@@ -1478,13 +1561,14 @@ static int imx219_probe(struct i2c_clien
V4L2_SUBDEV_FL_HAS_EVENTS;
imx219->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;

View file

@ -38,7 +38,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
static void vc4_hdmi_csc_setup(struct vc4_hdmi *vc4_hdmi, bool enable)
{
unsigned long flags;
@@ -1219,15 +1211,6 @@ static void vc4_hdmi_encoder_post_crtc_e
@@ -1220,15 +1212,6 @@ static void vc4_hdmi_encoder_post_crtc_e
mutex_unlock(&vc4_hdmi->mutex);
}
@ -54,7 +54,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
static void vc4_hdmi_encoder_atomic_mode_set(struct drm_encoder *encoder,
struct drm_crtc_state *crtc_state,
struct drm_connector_state *conn_state)
@@ -1321,8 +1304,6 @@ static const struct drm_encoder_helper_f
@@ -1322,8 +1305,6 @@ static const struct drm_encoder_helper_f
.atomic_check = vc4_hdmi_encoder_atomic_check,
.atomic_mode_set = vc4_hdmi_encoder_atomic_mode_set,
.mode_valid = vc4_hdmi_encoder_mode_valid,
@ -63,7 +63,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
};
static u32 vc4_hdmi_channel_map(struct vc4_hdmi *vc4_hdmi, u32 channel_mask)
@@ -1422,16 +1403,10 @@ static bool vc4_hdmi_audio_can_stream(st
@@ -1423,16 +1404,10 @@ static bool vc4_hdmi_audio_can_stream(st
lockdep_assert_held(&vc4_hdmi->mutex);
/*

View file

@ -14,7 +14,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -2280,7 +2280,7 @@ static int vc4_hdmi_cec_init(struct vc4_
@@ -2281,7 +2281,7 @@ static int vc4_hdmi_cec_init(struct vc4_
static void vc4_hdmi_cec_exit(struct vc4_hdmi *vc4_hdmi) {};

View file

@ -23,7 +23,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
HDMI_WRITE(HDMI_RAM_PACKET_CONFIG, 0);
@@ -1201,6 +1202,7 @@ static void vc4_hdmi_encoder_post_crtc_e
@@ -1202,6 +1203,7 @@ static void vc4_hdmi_encoder_post_crtc_e
VC4_HDMI_RAM_PACKET_ENABLE);
spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags);
@ -31,7 +31,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
vc4_hdmi_set_infoframes(encoder);
}
@@ -1606,7 +1608,8 @@ static int vc4_hdmi_audio_prepare(struct
@@ -1607,7 +1609,8 @@ static int vc4_hdmi_audio_prepare(struct
spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags);
memcpy(&vc4_hdmi->audio.infoframe, &params->cea, sizeof(params->cea));

View file

@ -26,7 +26,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -5743,13 +5743,13 @@ static const u32 hdmi_colorimetry_val[]
@@ -5746,13 +5746,13 @@ static const u32 hdmi_colorimetry_val[]
#undef ACE
/**
@ -43,7 +43,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
const struct drm_connector_state *conn_state)
{
u32 colorimetry_val;
@@ -5768,7 +5768,7 @@ drm_hdmi_avi_infoframe_colorspace(struct
@@ -5771,7 +5771,7 @@ drm_hdmi_avi_infoframe_colorspace(struct
frame->extended_colorimetry = (colorimetry_val >> 2) &
EXTENDED_COLORIMETRY_MASK;
}

View file

@ -31,7 +31,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
static int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused)
{
struct drm_info_node *node = (struct drm_info_node *)m->private;
@@ -1116,8 +1125,7 @@ static void vc4_hdmi_encoder_pre_crtc_en
@@ -1117,8 +1126,7 @@ static void vc4_hdmi_encoder_pre_crtc_en
mutex_lock(&vc4_hdmi->mutex);

View file

@ -79,7 +79,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
/* CEA VICs other than #1 requre limited range RGB
* output unless overridden by an AVI infoframe.
* Apply a colorspace conversion to squash 0-255 down
@@ -1120,22 +1121,12 @@ static void vc4_hdmi_encoder_pre_crtc_en
@@ -1121,22 +1122,12 @@ static void vc4_hdmi_encoder_pre_crtc_en
{
struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
struct drm_display_mode *mode = &vc4_hdmi->saved_adjusted_mode;

View file

@ -24,7 +24,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
if (!vc4_hdmi_is_full_range_rgb(vc4_hdmi, mode)) {
/* CEA VICs other than #1 requre limited range RGB
* output unless overridden by an AVI infoframe.
@@ -906,7 +908,6 @@ static void vc5_hdmi_set_timings(struct
@@ -907,7 +909,6 @@ static void vc5_hdmi_set_timings(struct
spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);

View file

@ -30,7 +30,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
--- a/drivers/gpu/drm/vc4/vc4_regs.h
+++ b/drivers/gpu/drm/vc4/vc4_regs.h
@@ -804,6 +804,9 @@ enum {
@@ -810,6 +810,9 @@ enum {
# define VC4_HD_CSC_CTL_RGB2YCC BIT(1)
# define VC4_HD_CSC_CTL_ENABLE BIT(0)

View file

@ -33,7 +33,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
const struct drm_display_mode *mode)
{
unsigned long flags;
@@ -1141,13 +1143,16 @@ static void vc4_hdmi_encoder_pre_crtc_en
@@ -1142,13 +1144,16 @@ static void vc4_hdmi_encoder_pre_crtc_en
struct drm_atomic_state *state)
{
struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);

View file

@ -14,7 +14,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -1251,6 +1251,19 @@ static void vc4_hdmi_encoder_atomic_mode
@@ -1252,6 +1252,19 @@ static void vc4_hdmi_encoder_atomic_mode
mutex_unlock(&vc4_hdmi->mutex);
}
@ -34,7 +34,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
#define WIFI_2_4GHz_CH1_MIN_FREQ 2400000000ULL
#define WIFI_2_4GHz_CH1_MAX_FREQ 2422000000ULL
@@ -1295,10 +1308,7 @@ static int vc4_hdmi_encoder_atomic_check
@@ -1296,10 +1309,7 @@ static int vc4_hdmi_encoder_atomic_check
if (mode->flags & DRM_MODE_FLAG_DBLCLK)
pixel_rate = pixel_rate * 2;
@ -46,7 +46,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
return -EINVAL;
vc4_state->pixel_rate = pixel_rate;
@@ -1318,13 +1328,7 @@ vc4_hdmi_encoder_mode_valid(struct drm_e
@@ -1319,13 +1329,7 @@ vc4_hdmi_encoder_mode_valid(struct drm_e
(mode->hsync_end % 2) || (mode->htotal % 2)))
return MODE_H_ILLEGAL;

View file

@ -15,7 +15,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -1264,6 +1264,35 @@ vc4_hdmi_encoder_clock_valid(const struc
@@ -1265,6 +1265,35 @@ vc4_hdmi_encoder_clock_valid(const struc
return MODE_OK;
}
@ -51,7 +51,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
#define WIFI_2_4GHz_CH1_MIN_FREQ 2400000000ULL
#define WIFI_2_4GHz_CH1_MAX_FREQ 2422000000ULL
@@ -1276,6 +1305,7 @@ static int vc4_hdmi_encoder_atomic_check
@@ -1277,6 +1306,7 @@ static int vc4_hdmi_encoder_atomic_check
struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
unsigned long long pixel_rate = mode->clock * 1000;
unsigned long long tmds_rate;
@ -59,7 +59,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
if (vc4_hdmi->variant->unsupported_odd_h_timings &&
!(mode->flags & DRM_MODE_FLAG_DBLCLK) &&
@@ -1297,21 +1327,10 @@ static int vc4_hdmi_encoder_atomic_check
@@ -1298,21 +1328,10 @@ static int vc4_hdmi_encoder_atomic_check
pixel_rate = mode->clock * 1000;
}

View file

@ -19,7 +19,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -1255,12 +1255,18 @@ static enum drm_mode_status
@@ -1256,12 +1256,18 @@ static enum drm_mode_status
vc4_hdmi_encoder_clock_valid(const struct vc4_hdmi *vc4_hdmi,
unsigned long long clock)
{

View file

@ -57,7 +57,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
return;
drm_scdc_set_high_tmds_clock_ratio(vc4_hdmi->ddc, true);
@@ -1245,6 +1253,7 @@ static void vc4_hdmi_encoder_atomic_mode
@@ -1246,6 +1254,7 @@ static void vc4_hdmi_encoder_atomic_mode
struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
mutex_lock(&vc4_hdmi->mutex);

View file

@ -38,7 +38,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
bool hsync_pos = mode->flags & DRM_MODE_FLAG_PHSYNC;
bool vsync_pos = mode->flags & DRM_MODE_FLAG_PVSYNC;
bool interlaced = mode->flags & DRM_MODE_FLAG_INTERLACE;
@@ -961,7 +964,7 @@ static void vc5_hdmi_set_timings(struct
@@ -962,7 +965,7 @@ static void vc5_hdmi_set_timings(struct
HDMI_WRITE(HDMI_VERTB0, vertb_even);
HDMI_WRITE(HDMI_VERTB1, vertb);
@ -47,7 +47,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
case 12:
gcp = 6;
gcp_en = true;
@@ -1251,9 +1254,11 @@ static void vc4_hdmi_encoder_atomic_mode
@@ -1252,9 +1255,11 @@ static void vc4_hdmi_encoder_atomic_mode
struct drm_connector_state *conn_state)
{
struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
@ -60,7 +60,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
memcpy(&vc4_hdmi->saved_adjusted_mode,
&crtc_state->adjusted_mode,
sizeof(vc4_hdmi->saved_adjusted_mode));
@@ -1308,6 +1313,38 @@ vc4_hdmi_encoder_compute_clock(const str
@@ -1309,6 +1314,38 @@ vc4_hdmi_encoder_compute_clock(const str
return 0;
}
@ -99,7 +99,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
#define WIFI_2_4GHz_CH1_MIN_FREQ 2400000000ULL
#define WIFI_2_4GHz_CH1_MAX_FREQ 2422000000ULL
@@ -1342,8 +1379,7 @@ static int vc4_hdmi_encoder_atomic_check
@@ -1343,8 +1380,7 @@ static int vc4_hdmi_encoder_atomic_check
pixel_rate = mode->clock * 1000;
}

View file

@ -234,7 +234,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
HDMI_WRITE(HDMI_CSC_CTL, csc_ctl);
spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags);
@@ -980,6 +1093,15 @@ static void vc5_hdmi_set_timings(struct
@@ -981,6 +1094,15 @@ static void vc5_hdmi_set_timings(struct
break;
}
@ -250,7 +250,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
reg = HDMI_READ(HDMI_DEEP_COLOR_CONFIG_1);
reg &= ~(VC5_HDMI_DEEP_COLOR_CONFIG_1_INIT_PACK_PHASE_MASK |
VC5_HDMI_DEEP_COLOR_CONFIG_1_COLOR_DEPTH_MASK);
@@ -1259,12 +1381,97 @@ static void vc4_hdmi_encoder_atomic_mode
@@ -1260,12 +1382,97 @@ static void vc4_hdmi_encoder_atomic_mode
mutex_lock(&vc4_hdmi->mutex);
vc4_hdmi->output_bpc = vc4_state->output_bpc;
@ -348,7 +348,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
static enum drm_mode_status
vc4_hdmi_encoder_clock_valid(const struct vc4_hdmi *vc4_hdmi,
unsigned long long clock)
@@ -1286,13 +1493,17 @@ vc4_hdmi_encoder_clock_valid(const struc
@@ -1287,13 +1494,17 @@ vc4_hdmi_encoder_clock_valid(const struc
static unsigned long long
vc4_hdmi_encoder_compute_mode_clock(const struct drm_display_mode *mode,
@ -367,7 +367,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
return clock * bpc / 8;
}
@@ -1300,11 +1511,11 @@ static int
@@ -1301,11 +1512,11 @@ static int
vc4_hdmi_encoder_compute_clock(const struct vc4_hdmi *vc4_hdmi,
struct vc4_hdmi_connector_state *vc4_state,
const struct drm_display_mode *mode,
@ -381,7 +381,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
if (vc4_hdmi_encoder_clock_valid(vc4_hdmi, clock) != MODE_OK)
return -EINVAL;
@@ -1314,10 +1525,55 @@ vc4_hdmi_encoder_compute_clock(const str
@@ -1315,10 +1526,55 @@ vc4_hdmi_encoder_compute_clock(const str
}
static int
@ -437,7 +437,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
struct drm_connector_state *conn_state = &vc4_state->base;
unsigned int max_bpc = clamp_t(unsigned int, conn_state->max_bpc, 8, 12);
unsigned int bpc;
@@ -1326,17 +1582,18 @@ vc4_hdmi_encoder_compute_config(const st
@@ -1327,17 +1583,18 @@ vc4_hdmi_encoder_compute_config(const st
for (bpc = max_bpc; bpc >= 8; bpc -= 2) {
drm_dbg(dev, "Trying with a %d bpc output\n", bpc);
@ -548,7 +548,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
static inline
--- a/drivers/gpu/drm/vc4/vc4_regs.h
+++ b/drivers/gpu/drm/vc4/vc4_regs.h
@@ -804,11 +804,27 @@ enum {
@@ -810,11 +810,27 @@ enum {
# define VC4_HD_CSC_CTL_RGB2YCC BIT(1)
# define VC4_HD_CSC_CTL_ENABLE BIT(0)

View file

@ -17,7 +17,7 @@ Signed-off-by: Matthias Reichl <hias@horus.com>
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -1415,9 +1415,6 @@ vc4_hdmi_sink_supports_format_bpc(const
@@ -1416,9 +1416,6 @@ vc4_hdmi_sink_supports_format_bpc(const
case VC4_HDMI_OUTPUT_RGB:
drm_dbg(dev, "RGB Format, checking the constraints.\n");

View file

@ -14,7 +14,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -664,6 +664,48 @@ static const u32 colorspace_coeffs[2][DR
@@ -666,6 +666,48 @@ static const u32 colorspace_coeffs[2][DR
}
};
@ -63,7 +63,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
/* Writes out a full display list for an active plane to the plane's
* private dlist state.
*/
@@ -946,13 +988,8 @@ static int vc4_plane_mode_set(struct drm
@@ -948,13 +990,8 @@ static int vc4_plane_mode_set(struct drm
/* Position Word 2: Source Image Size, Alpha */
vc4_state->pos2_offset = vc4_state->dlist_count;
vc4_dlist_write(vc4_state,
@ -78,7 +78,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
VC4_SET_FIELD(vc4_state->src_w[0],
SCALER_POS2_WIDTH) |
VC4_SET_FIELD(vc4_state->src_h[0],
@@ -997,14 +1034,9 @@ static int vc4_plane_mode_set(struct drm
@@ -999,14 +1036,9 @@ static int vc4_plane_mode_set(struct drm
vc4_dlist_write(vc4_state,
VC4_SET_FIELD(state->alpha >> 4,
SCALER5_CTL2_ALPHA) |
@ -95,7 +95,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
);
/* Position Word 1: Scaled Image Dimensions. */
@@ -1494,6 +1526,10 @@ struct drm_plane *vc4_plane_init(struct
@@ -1496,6 +1528,10 @@ struct drm_plane *vc4_plane_init(struct
drm_plane_helper_add(plane, &vc4_plane_helper_funcs);
drm_plane_create_alpha_property(plane);

View file

@ -18,7 +18,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -1496,7 +1496,7 @@ vc4_hdmi_encoder_compute_mode_clock(cons
@@ -1497,7 +1497,7 @@ vc4_hdmi_encoder_compute_mode_clock(cons
unsigned int bpc,
enum vc4_hdmi_output_format fmt)
{

View file

@ -18,7 +18,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1093,6 +1093,16 @@ config MFD_SPMI_PMIC
@@ -1094,6 +1094,16 @@ config MFD_SPMI_PMIC
Say M here if you want to include support for the SPMI PMIC
series as a module. The module will be called "qcom-spmi-pmic".

View file

@ -167,7 +167,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
drm_connector_attach_encoder(connector, encoder);
return 0;
@@ -1385,6 +1487,7 @@ static void vc4_hdmi_encoder_atomic_mode
@@ -1386,6 +1488,7 @@ static void vc4_hdmi_encoder_atomic_mode
mutex_lock(&vc4_hdmi->mutex);
vc4_hdmi->output_bpc = vc4_state->output_bpc;
vc4_hdmi->output_format = vc4_state->output_format;

View file

@ -14,7 +14,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -135,6 +135,34 @@ static const struct hvs_format {
@@ -137,6 +137,34 @@ static const struct hvs_format {
.pixel_order = HVS_PIXEL_ORDER_XYCBCR,
.hvs5_only = true,
},

View file

@ -18,8 +18,8 @@ Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
--- a/drivers/gpu/drm/vc4/vc4_dpi.c
+++ b/drivers/gpu/drm/vc4/vc4_dpi.c
@@ -191,6 +191,10 @@ static void vc4_dpi_encoder_enable(struc
dpi_c |= VC4_SET_FIELD(DPI_FORMAT_16BIT_565_RGB_3,
@@ -189,6 +189,10 @@ static void vc4_dpi_encoder_enable(struc
dpi_c |= VC4_SET_FIELD(DPI_FORMAT_16BIT_565_RGB_1,
DPI_FORMAT);
break;
+ case MEDIA_BUS_FMT_RGB565_1X24_CPADHI:

View file

@ -15,44 +15,44 @@ Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
--- a/drivers/media/i2c/imx219.c
+++ b/drivers/media/i2c/imx219.c
@@ -153,6 +153,9 @@ struct imx219_mode {
@@ -162,6 +162,9 @@ struct imx219_mode {
/* Default register values */
struct imx219_reg_list reg_list;
/* 2x2 binning is used */
bool binning;
+
+ /* Relative pixel clock rate factor for the mode. */
+ unsigned int rate_factor;
};
/*
@@ -495,6 +498,7 @@ static const struct imx219_mode supporte
.num_of_regs = ARRAY_SIZE(mode_3280x2464_regs),
static const struct imx219_reg imx219_common_regs[] = {
@@ -402,6 +405,7 @@ static const struct imx219_mode supporte
.regs = mode_3280x2464_regs,
},
.binning = false,
+ .rate_factor = 1,
},
{
/* 1080P 30fps cropped */
@@ -511,6 +515,7 @@ static const struct imx219_mode supporte
.num_of_regs = ARRAY_SIZE(mode_1920_1080_regs),
@@ -419,6 +423,7 @@ static const struct imx219_mode supporte
.regs = mode_1920_1080_regs,
},
.binning = false,
+ .rate_factor = 1,
},
{
/* 2x2 binned 30fps mode */
@@ -527,6 +532,7 @@ static const struct imx219_mode supporte
.num_of_regs = ARRAY_SIZE(mode_1640_1232_regs),
@@ -436,6 +441,7 @@ static const struct imx219_mode supporte
.regs = mode_1640_1232_regs,
},
.binning = true,
+ .rate_factor = 1,
},
{
/* 640x480 30fps mode */
@@ -543,6 +549,11 @@ static const struct imx219_mode supporte
.num_of_regs = ARRAY_SIZE(mode_640_480_regs),
@@ -453,6 +459,11 @@ static const struct imx219_mode supporte
.regs = mode_640_480_regs,
},
.binning = true,
+ /*
+ * This mode uses a special 2x2 binning that doubles the
+ * the internal pixel clock rate.
@ -61,7 +61,7 @@ Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
},
};
@@ -765,7 +776,8 @@ static int imx219_set_ctrl(struct v4l2_c
@@ -675,7 +686,8 @@ static int imx219_set_ctrl(struct v4l2_c
break;
case V4L2_CID_EXPOSURE:
ret = imx219_write_reg(imx219, IMX219_REG_EXPOSURE,
@ -71,7 +71,7 @@ Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
break;
case V4L2_CID_DIGITAL_GAIN:
ret = imx219_write_reg(imx219, IMX219_REG_DIGITAL_GAIN,
@@ -785,7 +797,8 @@ static int imx219_set_ctrl(struct v4l2_c
@@ -695,7 +707,8 @@ static int imx219_set_ctrl(struct v4l2_c
case V4L2_CID_VBLANK:
ret = imx219_write_reg(imx219, IMX219_REG_VTS,
IMX219_REG_VALUE_16BIT,
@ -81,7 +81,7 @@ Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
break;
case V4L2_CID_TEST_PATTERN_RED:
ret = imx219_write_reg(imx219, IMX219_REG_TESTP_RED,
@@ -957,7 +970,7 @@ static int imx219_set_pad_format(struct
@@ -867,7 +880,7 @@ static int imx219_set_pad_format(struct
struct imx219 *imx219 = to_imx219(sd);
const struct imx219_mode *mode;
struct v4l2_mbus_framefmt *framefmt;
@ -90,7 +90,7 @@ Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
unsigned int i;
if (fmt->pad >= NUM_PADS)
@@ -1018,6 +1031,12 @@ static int imx219_set_pad_format(struct
@@ -928,6 +941,12 @@ static int imx219_set_pad_format(struct
hblank = IMX219_PPL_DEFAULT - mode->width;
__v4l2_ctrl_modify_range(imx219->hblank, hblank, hblank,
1, hblank);
@ -103,7 +103,7 @@ Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
}
} else {
if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
@@ -1362,7 +1381,7 @@ static int imx219_init_controls(struct i
@@ -1315,7 +1334,7 @@ static int imx219_init_controls(struct i
struct v4l2_ctrl_handler *ctrl_hdlr;
unsigned int height = imx219->mode->height;
struct v4l2_fwnode_device_properties props;
@ -112,7 +112,7 @@ Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
int i, ret;
ctrl_hdlr = &imx219->ctrl_handler;
@@ -1374,11 +1393,11 @@ static int imx219_init_controls(struct i
@@ -1327,11 +1346,11 @@ static int imx219_init_controls(struct i
ctrl_hdlr->lock = &imx219->mutex;
/* By default, PIXEL_RATE is read only */

View file

@ -1,25 +0,0 @@
From 4626e370de018aed097d54247bae5a29391198ee Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Mon, 14 Feb 2022 15:34:51 +0000
Subject: [PATCH] drm/vc4: For DPI, MEDIA_BUS_FMT_RGB565_1X16 is mode
1, not 3.
The mapping is incorrect for RGB565_1X16 as it should be
DPI_FORMAT_18BIT_666_RGB_1 instead of DPI_FORMAT_18BIT_666_RGB_3.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/gpu/drm/vc4/vc4_dpi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/gpu/drm/vc4/vc4_dpi.c
+++ b/drivers/gpu/drm/vc4/vc4_dpi.c
@@ -188,7 +188,7 @@ static void vc4_dpi_encoder_enable(struc
DPI_ORDER);
break;
case MEDIA_BUS_FMT_RGB565_1X16:
- dpi_c |= VC4_SET_FIELD(DPI_FORMAT_16BIT_565_RGB_3,
+ dpi_c |= VC4_SET_FIELD(DPI_FORMAT_16BIT_565_RGB_1,
DPI_FORMAT);
break;
case MEDIA_BUS_FMT_RGB565_1X24_CPADHI:

View file

@ -399,7 +399,7 @@ Signed-off-by: Maxime Ripard <maxime@cerno.tech>
* overwrite the setup from the bootloader (just 128b out of
--- a/drivers/gpu/drm/vc4/vc4_regs.h
+++ b/drivers/gpu/drm/vc4/vc4_regs.h
@@ -234,6 +234,7 @@
@@ -240,6 +240,7 @@
# define SCALER_DISPCTRL_DSPEIEOLN(x) BIT(8 + ((x) * 2))
/* Enables Display 0 EOF contribution to SCALER_DISPSTAT_IRQDISP0 */
# define SCALER_DISPCTRL_DSPEIEOF(x) BIT(7 + ((x) * 2))

View file

@ -88,7 +88,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
if (ret)
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -1573,9 +1573,14 @@ struct drm_plane *vc4_plane_init(struct
@@ -1575,9 +1575,14 @@ struct drm_plane *vc4_plane_init(struct
DRM_COLOR_YCBCR_BT709,
DRM_COLOR_YCBCR_LIMITED_RANGE);
@ -103,7 +103,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
int vc4_plane_create_additional_planes(struct drm_device *drm)
{
struct drm_plane *cursor_plane;
@@ -1591,7 +1596,7 @@ int vc4_plane_create_additional_planes(s
@@ -1593,7 +1598,7 @@ int vc4_plane_create_additional_planes(s
* modest number of planes to expose, that should hopefully
* still cover any sane usecase.
*/
@ -112,7 +112,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
struct drm_plane *plane =
vc4_plane_init(drm, DRM_PLANE_TYPE_OVERLAY);
@@ -1600,17 +1605,28 @@ int vc4_plane_create_additional_planes(s
@@ -1602,17 +1607,28 @@ int vc4_plane_create_additional_planes(s
plane->possible_crtcs =
GENMASK(drm->mode_config.num_crtc - 1, 0);

View file

@ -23,7 +23,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
u32 src_w[2], src_h[2];
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -179,9 +179,9 @@ static const struct hvs_format *vc4_get_
@@ -181,9 +181,9 @@ static const struct hvs_format *vc4_get_
static enum vc4_scaling_mode vc4_get_scaling_mode(u32 src, u32 dst)
{
@ -35,7 +35,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
return VC4_SCALING_PPF;
else
return VC4_SCALING_TPZ;
@@ -388,15 +388,10 @@ static int vc4_plane_setup_clipping_and_
@@ -390,15 +390,10 @@ static int vc4_plane_setup_clipping_and_
for (i = 0; i < num_planes; i++)
vc4_state->offsets[i] = bo->paddr + fb->offsets[i];
@ -55,7 +55,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
vc4_state->crtc_x = state->dst.x1;
vc4_state->crtc_y = state->dst.y1;
@@ -449,7 +444,7 @@ static void vc4_write_tpz(struct vc4_pla
@@ -451,7 +446,7 @@ static void vc4_write_tpz(struct vc4_pla
{
u32 scale, recip;
@ -64,7 +64,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
/* The specs note that while the reciprocal would be defined
* as (1<<32)/scale, ~0 is close enough.
@@ -495,7 +490,7 @@ static u32 vc4_lbm_size(struct drm_plane
@@ -497,7 +492,7 @@ static u32 vc4_lbm_size(struct drm_plane
if (vc4_state->x_scaling[0] == VC4_SCALING_TPZ)
pix_per_line = vc4_state->crtc_w;
else
@ -73,7 +73,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
if (!vc4_state->is_yuv) {
if (vc4_state->y_scaling[0] == VC4_SCALING_TPZ)
@@ -586,7 +581,8 @@ static void vc4_plane_calc_load(struct d
@@ -588,7 +583,8 @@ static void vc4_plane_calc_load(struct d
for (i = 0; i < fb->format->num_planes; i++) {
/* Even if the bandwidth/plane required for a single frame is
*
@ -83,7 +83,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
*
* when downscaling, we have to read more pixels per line in
* the time frame reserved for a single line, so the bandwidth
@@ -595,11 +591,11 @@ static void vc4_plane_calc_load(struct d
@@ -597,11 +593,11 @@ static void vc4_plane_calc_load(struct d
* load by this number. We're likely over-estimating the read
* demand, but that's better than under-estimating it.
*/
@ -99,7 +99,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
vc4_state->hvs_load += vc4_state->crtc_h * vc4_state->crtc_w;
}
@@ -752,7 +748,8 @@ static int vc4_plane_mode_set(struct drm
@@ -754,7 +750,8 @@ static int vc4_plane_mode_set(struct drm
bool mix_plane_alpha;
bool covers_screen;
u32 scl0, scl1, pitch0;
@ -109,7 +109,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
u32 hvs_format = format->hvs;
unsigned int rotation;
int ret, i;
@@ -764,6 +761,9 @@ static int vc4_plane_mode_set(struct drm
@@ -766,6 +763,9 @@ static int vc4_plane_mode_set(struct drm
if (ret)
return ret;
@ -119,7 +119,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
/* SCL1 is used for Cb/Cr scaling of planar formats. For RGB
* and 4:4:4, scl1 should be set to scl0 so both channels of
* the scaler do the same thing. For YUV, the Y plane needs
@@ -784,9 +784,11 @@ static int vc4_plane_mode_set(struct drm
@@ -786,9 +786,11 @@ static int vc4_plane_mode_set(struct drm
DRM_MODE_REFLECT_Y);
/* We must point to the last line when Y reflection is enabled. */
@ -133,7 +133,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
switch (base_format_mod) {
case DRM_FORMAT_MOD_LINEAR:
@@ -801,7 +803,7 @@ static int vc4_plane_mode_set(struct drm
@@ -803,7 +805,7 @@ static int vc4_plane_mode_set(struct drm
(i ? v_subsample : 1) *
fb->pitches[i];
@ -142,7 +142,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
(i ? h_subsample : 1) *
fb->format->cpp[i];
}
@@ -824,7 +826,7 @@ static int vc4_plane_mode_set(struct drm
@@ -826,7 +828,7 @@ static int vc4_plane_mode_set(struct drm
* pitch * tile_h == tile_size * tiles_per_row
*/
u32 tiles_w = fb->pitches[0] >> (tile_size_shift - tile_h_shift);
@ -151,7 +151,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
u32 tiles_r = tiles_w - tiles_l;
u32 tiles_t = src_y >> tile_h_shift;
/* Intra-tile offsets, which modify the base address (the
@@ -834,7 +836,7 @@ static int vc4_plane_mode_set(struct drm
@@ -836,7 +838,7 @@ static int vc4_plane_mode_set(struct drm
u32 tile_y = (src_y >> 4) & 1;
u32 subtile_y = (src_y >> 2) & 3;
u32 utile_y = src_y & 3;
@ -160,7 +160,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
u32 y_off = src_y & tile_h_mask;
/* When Y reflection is requested we must set the
@@ -930,7 +932,7 @@ static int vc4_plane_mode_set(struct drm
@@ -932,7 +934,7 @@ static int vc4_plane_mode_set(struct drm
* of the 12-pixels in that 128-bit word is the
* first pixel to be used
*/
@ -169,7 +169,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
u32 aligned = remaining_pixels / 12;
u32 last_bits = remaining_pixels % 12;
@@ -952,12 +954,12 @@ static int vc4_plane_mode_set(struct drm
@@ -954,12 +956,12 @@ static int vc4_plane_mode_set(struct drm
return -EINVAL;
}
pix_per_tile = tile_w / fb->format->cpp[0];
@ -184,7 +184,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
vc4_state->offsets[i] += param * tile_w * tile;
vc4_state->offsets[i] += src_y /
@@ -1018,10 +1020,8 @@ static int vc4_plane_mode_set(struct drm
@@ -1020,10 +1022,8 @@ static int vc4_plane_mode_set(struct drm
vc4_dlist_write(vc4_state,
(mix_plane_alpha ? SCALER_POS2_ALPHA_MIX : 0) |
vc4_hvs4_get_alpha_blend_mode(state) |
@ -197,7 +197,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
/* Position Word 3: Context. Written by the HVS. */
vc4_dlist_write(vc4_state, 0xc0c0c0c0);
@@ -1079,10 +1079,8 @@ static int vc4_plane_mode_set(struct drm
@@ -1081,10 +1081,8 @@ static int vc4_plane_mode_set(struct drm
/* Position Word 2: Source Image Size */
vc4_state->pos2_offset = vc4_state->dlist_count;
vc4_dlist_write(vc4_state,

View file

@ -11,7 +11,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -458,14 +458,47 @@ static void vc4_write_tpz(struct vc4_pla
@@ -460,14 +460,47 @@ static void vc4_write_tpz(struct vc4_pla
VC4_SET_FIELD(recip, SCALER_TPZ1_RECIP));
}
@ -62,7 +62,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
}
static u32 vc4_lbm_size(struct drm_plane_state *state)
@@ -524,13 +557,13 @@ static void vc4_write_scaling_parameters
@@ -526,13 +559,13 @@ static void vc4_write_scaling_parameters
/* Ch0 H-PPF Word 0: Scaling Parameters */
if (vc4_state->x_scaling[channel] == VC4_SCALING_PPF) {
vc4_write_ppf(vc4_state,
@ -78,7 +78,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
vc4_dlist_write(vc4_state, 0xc0c0c0c0);
}
@@ -978,6 +1011,24 @@ static int vc4_plane_mode_set(struct drm
@@ -980,6 +1013,24 @@ static int vc4_plane_mode_set(struct drm
return -EINVAL;
}

View file

@ -10,7 +10,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -461,17 +461,18 @@ static void vc4_write_tpz(struct vc4_pla
@@ -463,17 +463,18 @@ static void vc4_write_tpz(struct vc4_pla
/* phase magnitude bits */
#define PHASE_BITS 6
@ -31,7 +31,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
offset += -(1 << PHASE_BITS >> 2);
} else {
/* the phase is relative to scale_src->x, so shift it for display list's x value */
@@ -557,13 +558,15 @@ static void vc4_write_scaling_parameters
@@ -559,13 +560,15 @@ static void vc4_write_scaling_parameters
/* Ch0 H-PPF Word 0: Scaling Parameters */
if (vc4_state->x_scaling[channel] == VC4_SCALING_PPF) {
vc4_write_ppf(vc4_state,
@ -49,7 +49,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
vc4_dlist_write(vc4_state, 0xc0c0c0c0);
}
@@ -1622,6 +1625,8 @@ struct drm_plane *vc4_plane_init(struct
@@ -1624,6 +1627,8 @@ struct drm_plane *vc4_plane_init(struct
DRM_COLOR_YCBCR_BT709,
DRM_COLOR_YCBCR_LIMITED_RANGE);

View file

@ -13,7 +13,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
@@ -910,9 +910,12 @@ static int bcm2835_pmx_free(struct pinct
@@ -908,9 +908,12 @@ static int bcm2835_pmx_free(struct pinct
unsigned offset)
{
struct bcm2835_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev);
@ -28,7 +28,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
return 0;
}
@@ -954,10 +957,7 @@ static void bcm2835_pmx_gpio_disable_fre
@@ -952,10 +955,7 @@ static void bcm2835_pmx_gpio_disable_fre
struct pinctrl_gpio_range *range,
unsigned offset)
{

View file

@ -332,7 +332,7 @@ This reverts commit e99a1b69da07ee3b89a6b8005b854e6c04bfb450.
* overwrite the setup from the bootloader (just 128b out of
--- a/drivers/gpu/drm/vc4/vc4_regs.h
+++ b/drivers/gpu/drm/vc4/vc4_regs.h
@@ -234,7 +234,6 @@
@@ -240,7 +240,6 @@
# define SCALER_DISPCTRL_DSPEIEOLN(x) BIT(8 + ((x) * 2))
/* Enables Display 0 EOF contribution to SCALER_DISPSTAT_IRQDISP0 */
# define SCALER_DISPCTRL_DSPEIEOF(x) BIT(7 + ((x) * 2))

View file

@ -25,7 +25,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -1809,6 +1809,9 @@ static int vc4_hdmi_encoder_atomic_check
@@ -1810,6 +1810,9 @@ static int vc4_hdmi_encoder_atomic_check
struct vc4_hdmi_connector_state *vc4_state = conn_state_to_vc4_hdmi_conn_state(conn_state);
struct drm_display_mode *mode = &crtc_state->adjusted_mode;
struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
@ -35,7 +35,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
unsigned long long pixel_rate = mode->clock * 1000;
unsigned long long tmds_rate;
int ret;
@@ -1837,6 +1840,11 @@ static int vc4_hdmi_encoder_atomic_check
@@ -1838,6 +1841,11 @@ static int vc4_hdmi_encoder_atomic_check
if (ret)
return ret;

View file

@ -14,7 +14,7 @@ Signed-off-by: Dom Cobley <popcornmix@gmail.com>
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -1551,9 +1551,6 @@ static void vc4_hdmi_encoder_post_crtc_e
@@ -1552,9 +1552,6 @@ static void vc4_hdmi_encoder_post_crtc_e
WARN_ON(!(HDMI_READ(HDMI_SCHEDULER_CONTROL) &
VC4_HDMI_SCHEDULER_CONTROL_HDMI_ACTIVE));

Some files were not shown because too many files have changed in this diff Show more