Merge Official Source

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2022-05-20 17:36:46 +08:00
commit 4687da56ee
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
1251 changed files with 79812 additions and 35868 deletions

View File

@ -81,6 +81,11 @@ config KERNEL_PROFILING
Enable the extended profiling support mechanisms used by profilers such
as OProfile.
config KERNEL_RPI_AXIPERF
bool "Compile the kernel with RaspberryPi AXI Performance monitors"
default y
depends on KERNEL_PERF_EVENTS && TARGET_bcm27xx
config KERNEL_UBSAN
bool "Compile the kernel with undefined behaviour sanity checker"
help
@ -368,6 +373,34 @@ config KERNEL_DEBUG_INFO
help
This will compile your kernel and modules with debug information.
config KERNEL_DEBUG_INFO_BTF
bool "Enable additional BTF type information"
default n
depends on !HOST_OS_MACOS
depends on KERNEL_DEBUG_INFO && !KERNEL_DEBUG_INFO_REDUCED
select DWARVES
help
Generate BPF Type Format (BTF) information from DWARF debug info.
Turning this on expects presence of pahole tool, which will convert
DWARF type info into equivalent deduplicated BTF type info.
Required to run BPF CO-RE applications.
config KERNEL_DEBUG_INFO_REDUCED
bool "Reduce debugging information"
default y
depends on KERNEL_DEBUG_INFO
help
If you say Y here gcc is instructed to generate less debugging
information for structure types. This means that tools that
need full debugging information (like kgdb or systemtap) won't
be happy. But if you merely need debugging information to
resolve line numbers there is no loss. Advantage is that
build directory object sizes shrink dramatically over a full
DEBUG_INFO build and compile times are reduced too.
Only works with newer gcc versions.
config KERNEL_DEBUG_LL_UART_NONE
bool
default n
@ -422,10 +455,20 @@ config KERNEL_KPROBE_EVENTS
bool
default y if KERNEL_KPROBES
config KERNEL_BPF_EVENTS
bool "Compile the kernel with BPF event support"
default n
select KERNEL_KPROBES
help
Allows to attach BPF programs to kprobe, uprobe and tracepoint events.
This is required to use BPF maps of type BPF_MAP_TYPE_PERF_EVENT_ARRAY
for sending data from BPF programs to user-space for post-processing
or logging.
config KERNEL_BPF_KPROBE_OVERRIDE
bool
depends on KERNEL_KPROBES
default n
depends on KERNEL_KPROBES
config KERNEL_AIO
bool "Compile the kernel with asynchronous IO support"

View File

@ -162,7 +162,6 @@ define BuildKernel
$(LINUX_RECONF_CMD) > $(LINUX_DIR)/.config
$(_SINGLE)$(KERNEL_MAKE) \
$(if $(findstring Darwin,$(HOST_OS)), \
HOST_LOADLIBES="-L$(STAGING_DIR_HOST)/lib -lncurses" \
HOSTLDLIBS_mconf="-L$(STAGING_DIR_HOST)/lib -lncurses" \
filechk_conf_cfg=" :" \
) \

View File

@ -110,8 +110,7 @@ KERNEL_MAKE_FLAGS = \
KBUILD_BUILD_HOST="$(call qstrip,$(CONFIG_KERNEL_BUILD_DOMAIN))" \
KBUILD_BUILD_TIMESTAMP="$(KBUILD_BUILD_TIMESTAMP)" \
KBUILD_BUILD_VERSION="0" \
HOST_LOADLIBES="-L$(STAGING_DIR_HOST)/lib" \
KBUILD_HOSTLDLIBS="-L$(STAGING_DIR_HOST)/lib" \
KBUILD_HOSTLDFLAGS="-L$(STAGING_DIR_HOST)/lib" \
CONFIG_SHELL="$(BASH)" \
$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \
$(if $(PKG_BUILD_ID),LDFLAGS_MODULE=--build-id=0x$(PKG_BUILD_ID)) \

View File

@ -32,10 +32,6 @@ ALLWIFIBOARDS:= \
glinet_gl-b2200 \
glinet_gl-s1300 \
linksys_ea8300 \
mikrotik_cap-ac \
mikrotik_hap-ac2 \
mikrotik_hap-ac3 \
mikrotik_sxtsq-5-ac \
p2w_r619ac \
qxwlan_e2600ac-c1 \
qxwlan_e2600ac-c2 \
@ -107,10 +103,6 @@ $(eval $(call generate-ipq-wifi-package,glinet_gl-ap1300,GL.iNet GL-AP1300))
$(eval $(call generate-ipq-wifi-package,glinet_gl-b2200,GL.iNet GL-B2200))
$(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,mikrotik_cap-ac,Mikrotik cAP ac))
$(eval $(call generate-ipq-wifi-package,mikrotik_hap-ac2,Mikrotik hAP ac2))
$(eval $(call generate-ipq-wifi-package,mikrotik_hap-ac3,Mikrotik hAP ac3))
$(eval $(call generate-ipq-wifi-package,mikrotik_sxtsq-5-ac,MikroTik SXTsq 5 ac))
$(eval $(call generate-ipq-wifi-package,p2w_r619ac,P&W R619AC))
$(eval $(call generate-ipq-wifi-package,qxwlan_e2600ac-c1,Qxwlan E2600AC C1))
$(eval $(call generate-ipq-wifi-package,qxwlan_e2600ac-c2,Qxwlan E2600AC C2))

View File

@ -8,9 +8,9 @@ PKG_LICENSE_FILES:=
PKG_SOURCE_URL:=https://github.com/greearb/ath10k-ct.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2021-11-28
PKG_SOURCE_VERSION:=dc350bbf41d987c5b2db54405bcc9ef3cd66d5db
PKG_MIRROR_HASH:=92422485c7b92be840a40bf8d157bb6731d14d3811907b6cb4e4cfab0777b60d
PKG_SOURCE_DATE:=2022-05-13
PKG_SOURCE_VERSION:=f808496fcc6b1f68942914117aebf8b3f8d52bb3
PKG_MIRROR_HASH:=39527b3408696594eda5579521a9fb798417be4dda73fa08e8b3a8c7b0d3f3d9
# Build the 5.15 ath10k-ct driver version.
# Probably this should match as closely as

View File

@ -34,7 +34,7 @@ Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
#include <asm/byteorder.h>
#include <linux/ctype.h>
@@ -988,7 +989,8 @@ static int ath10k_core_get_board_id_from
@@ -1005,7 +1006,8 @@ static int ath10k_core_get_board_id_from
}
if (ar->cal_mode == ATH10K_PRE_CAL_MODE_DT ||
@ -44,7 +44,7 @@ Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
bmi_board_id_param = BMI_PARAM_GET_FLASH_BOARD_ID;
else
bmi_board_id_param = BMI_PARAM_GET_EEPROM_BOARD_ID;
@@ -2087,7 +2089,8 @@ static int ath10k_download_and_run_otp(s
@@ -2115,7 +2117,8 @@ static int ath10k_download_and_run_otp(s
/* As of now pre-cal is valid for 10_4 variants */
if (ar->cal_mode == ATH10K_PRE_CAL_MODE_DT ||
@ -54,7 +54,7 @@ Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
bmi_otp_exe_param = BMI_PARAM_FLASH_SECTION_ALL;
ret = ath10k_bmi_execute(ar, address, bmi_otp_exe_param, &result);
@@ -2221,6 +2224,39 @@ struct ath10k_bss_rom_ie {
@@ -2249,6 +2252,39 @@ struct ath10k_bss_rom_ie {
__le32 rom_len;
} __packed;
@ -94,7 +94,7 @@ Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name,
struct ath10k_fw_file *fw_file)
{
@@ -2597,6 +2633,18 @@ static int ath10k_core_pre_cal_download(
@@ -2625,6 +2661,18 @@ static int ath10k_core_pre_cal_download(
{
int ret;
@ -113,7 +113,7 @@ Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
ret = ath10k_download_cal_file(ar, ar->pre_cal_file);
if (ret == 0) {
ar->cal_mode = ATH10K_PRE_CAL_MODE_FILE;
@@ -2663,6 +2711,18 @@ static int ath10k_download_cal_data(stru
@@ -2691,6 +2739,18 @@ static int ath10k_download_cal_data(stru
"pre cal download procedure failed, try cal file: %d\n",
ret);

View File

@ -129,7 +129,7 @@ v13:
.patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL,
@@ -141,6 +143,7 @@ static const struct ath10k_hw_params ath
@@ -143,6 +145,7 @@ static const struct ath10k_hw_params ath
.dev_id = QCA9887_1_0_DEVICE_ID,
.bus = ATH10K_BUS_PCI,
.name = "qca9887 hw1.0",
@ -137,7 +137,7 @@ v13:
.patch_load_addr = QCA9887_HW_1_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL,
@@ -352,6 +355,7 @@ static const struct ath10k_hw_params ath
@@ -360,6 +363,7 @@ static const struct ath10k_hw_params ath
.dev_id = QCA99X0_2_0_DEVICE_ID,
.bus = ATH10K_BUS_PCI,
.name = "qca99x0 hw2.0",
@ -145,7 +145,7 @@ v13:
.patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.otp_exe_param = 0x00000700,
@@ -393,6 +397,7 @@ static const struct ath10k_hw_params ath
@@ -402,6 +406,7 @@ static const struct ath10k_hw_params ath
.dev_id = QCA9984_1_0_DEVICE_ID,
.bus = ATH10K_BUS_PCI,
.name = "qca9984/qca9994 hw1.0",
@ -153,7 +153,7 @@ v13:
.patch_load_addr = QCA9984_HW_1_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH,
@@ -441,6 +446,7 @@ static const struct ath10k_hw_params ath
@@ -451,6 +456,7 @@ static const struct ath10k_hw_params ath
.dev_id = QCA9888_2_0_DEVICE_ID,
.bus = ATH10K_BUS_PCI,
.name = "qca9888 hw2.0",
@ -161,7 +161,7 @@ v13:
.patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH,
@@ -3942,6 +3948,10 @@ int ath10k_core_start(struct ath10k *ar,
@@ -3977,6 +3983,10 @@ int ath10k_core_start(struct ath10k *ar,
ath10k_wmi_check_apply_board_power_ctl_table(ar);
}
@ -172,7 +172,7 @@ v13:
return 0;
err_hif_stop:
@@ -4203,9 +4213,18 @@ static void ath10k_core_register_work(st
@@ -4238,9 +4248,18 @@ static void ath10k_core_register_work(st
goto err_spectral_destroy;
}
@ -191,7 +191,7 @@ v13:
err_spectral_destroy:
ath10k_spectral_destroy(ar);
err_debug_destroy:
@@ -4265,6 +4284,8 @@ void ath10k_core_unregister(struct ath10
@@ -4300,6 +4319,8 @@ void ath10k_core_unregister(struct ath10
if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags))
return;
@ -456,7 +456,7 @@ v13:
static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map = {
--- a/ath10k-5.15/wmi.c
+++ b/ath10k-5.15/wmi.c
@@ -8409,6 +8409,49 @@ ath10k_wmi_op_gen_peer_set_param(struct
@@ -8413,6 +8413,49 @@ ath10k_wmi_op_gen_peer_set_param(struct
return skb;
}
@ -506,7 +506,7 @@ v13:
static struct sk_buff *
ath10k_wmi_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id,
enum wmi_sta_ps_mode psmode)
@@ -10240,6 +10283,9 @@ static const struct wmi_ops wmi_ops = {
@@ -10244,6 +10287,9 @@ static const struct wmi_ops wmi_ops = {
.fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill,
.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
.gen_echo = ath10k_wmi_op_gen_echo,
@ -516,7 +516,7 @@ v13:
/* .gen_bcn_tmpl not implemented */
/* .gen_prb_tmpl not implemented */
/* .gen_p2p_go_bcn_ie not implemented */
@@ -10310,6 +10356,8 @@ static const struct wmi_ops wmi_10_1_ops
@@ -10314,6 +10360,8 @@ static const struct wmi_ops wmi_10_1_ops
.fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill,
.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
.gen_echo = ath10k_wmi_op_gen_echo,
@ -525,7 +525,7 @@ v13:
/* .gen_bcn_tmpl not implemented */
/* .gen_prb_tmpl not implemented */
/* .gen_p2p_go_bcn_ie not implemented */
@@ -10389,6 +10437,8 @@ static const struct wmi_ops wmi_10_2_ops
@@ -10393,6 +10441,8 @@ static const struct wmi_ops wmi_10_2_ops
.gen_delba_send = ath10k_wmi_op_gen_delba_send,
.fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill,
.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
@ -534,7 +534,7 @@ v13:
/* .gen_pdev_enable_adaptive_cca not implemented */
};
@@ -10460,6 +10510,8 @@ static const struct wmi_ops wmi_10_2_4_o
@@ -10464,6 +10514,8 @@ static const struct wmi_ops wmi_10_2_4_o
ath10k_wmi_op_gen_pdev_enable_adaptive_cca,
.get_vdev_subtype = ath10k_wmi_10_2_4_op_get_vdev_subtype,
.gen_bb_timing = ath10k_wmi_10_2_4_op_gen_bb_timing,
@ -543,7 +543,7 @@ v13:
/* .gen_bcn_tmpl not implemented */
/* .gen_prb_tmpl not implemented */
/* .gen_p2p_go_bcn_ie not implemented */
@@ -10542,6 +10594,8 @@ static const struct wmi_ops wmi_10_4_ops
@@ -10546,6 +10598,8 @@ static const struct wmi_ops wmi_10_4_ops
.gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info,
.gen_echo = ath10k_wmi_op_gen_echo,
.gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config,

View File

@ -42,7 +42,7 @@ Signed-off-by: Mathias Kresin <dev@kresin.me>
if (ret)
--- a/ath10k-5.15/mac.c
+++ b/ath10k-5.15/mac.c
@@ -11521,7 +11521,7 @@ int ath10k_mac_register(struct ath10k *a
@@ -11544,7 +11544,7 @@ int ath10k_mac_register(struct ath10k *a
ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER;
#ifdef CPTCFG_MAC80211_LEDS

View File

@ -2,8 +2,8 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=bcm27xx-gpu-fw
PKG_VERSION:=2021-08-19
PKG_RELEASE:=25e2b597ebfb2495eab4816a276758dcc6ea21f1
PKG_VERSION:=2022-05-16
PKG_RELEASE:=3673be308132de102fdff491d1333d9d0f823557
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)/rpi-firmware-$(PKG_RELEASE)
@ -26,7 +26,7 @@ define Download/bootcode_bin
FILE:=$(RPI_FIRMWARE_FILE)-bootcode.bin
URL:=$(RPI_FIRMWARE_URL)
URL_FILE:=bootcode.bin
HASH:=36fba28838867f26670a0cd1de340da62e13171cfdec0e7822737e849b3c0681
HASH:=69309823da13dc96b89e3d82b44f820e4f84efa79d207adad2c8784559794f03
endef
$(eval $(call Download,bootcode_bin))
@ -34,7 +34,7 @@ define Download/fixup_dat
FILE:=$(RPI_FIRMWARE_FILE)-fixup.dat
URL:=$(RPI_FIRMWARE_URL)
URL_FILE:=fixup.dat
HASH:=b06aa43aa668d6982de66044299d1b0dd6b449ec321dd83742aa1eb68774e15b
HASH:=921f56c62ad1995addb984b156c869202dc5d46bbe9ebcbd02c20f0def9058e3
endef
$(eval $(call Download,fixup_dat))
@ -42,7 +42,7 @@ define Download/fixup_cd_dat
FILE:=$(RPI_FIRMWARE_FILE)-fixup_cd.dat
URL:=$(RPI_FIRMWARE_URL)
URL_FILE:=fixup_cd.dat
HASH:=fff4fd9fbb691100be46269f554acd866eac8cfef39082e03ac12f70fbfe9d95
HASH:=83a985aa0d73844786f3b3bf674826c520212f6f72fc6a890f2ebb5f87de5d8c
endef
$(eval $(call Download,fixup_cd_dat))
@ -50,7 +50,7 @@ define Download/fixup_x_dat
FILE:=$(RPI_FIRMWARE_FILE)-fixup_x.dat
URL:=$(RPI_FIRMWARE_URL)
URL_FILE:=fixup_x.dat
HASH:=d74f97ae37cd476e6d4c8e466c3013be49e891e63b9aabc0c9b7637d85068cd0
HASH:=8b00b00678adafe01e087240d156dbc87822e745b269be4f282596b69265cd1e
endef
$(eval $(call Download,fixup_x_dat))
@ -58,7 +58,7 @@ define Download/fixup4_dat
FILE:=$(RPI_FIRMWARE_FILE)-fixup4.dat
URL:=$(RPI_FIRMWARE_URL)
URL_FILE:=fixup4.dat
HASH:=a607f4dc3000c188f8daaa3417c70a9e5ecc039fae36ba46807c00294f89cd24
HASH:=ef2b5d2a0a95ca48e00a1ce78b7650ee9e947cc1c588704c8ae30c1623122e2f
endef
$(eval $(call Download,fixup4_dat))
@ -66,7 +66,7 @@ define Download/fixup4cd_dat
FILE:=$(RPI_FIRMWARE_FILE)-fixup4cd.dat
URL:=$(RPI_FIRMWARE_URL)
URL_FILE:=fixup4cd.dat
HASH:=fff4fd9fbb691100be46269f554acd866eac8cfef39082e03ac12f70fbfe9d95
HASH:=83a985aa0d73844786f3b3bf674826c520212f6f72fc6a890f2ebb5f87de5d8c
endef
$(eval $(call Download,fixup4cd_dat))
@ -74,7 +74,7 @@ define Download/fixup4x_dat
FILE:=$(RPI_FIRMWARE_FILE)-fixup4x.dat
URL:=$(RPI_FIRMWARE_URL)
URL_FILE:=fixup4x.dat
HASH:=14ba09cba83d82a158481a7267fad06ada73c26c3a27dfd34694955f11ba6e27
HASH:=a6c4e30ada5a00fe7de83c460638ca824647651bb4a3644b8c65d7ba1d9f2d2b
endef
$(eval $(call Download,fixup4x_dat))
@ -82,7 +82,7 @@ define Download/start_elf
FILE:=$(RPI_FIRMWARE_FILE)-start.elf
URL:=$(RPI_FIRMWARE_URL)
URL_FILE:=start.elf
HASH:=8bee170c56529bf1666ad4afdd18ae18c7123e7a2fd30e2992cd0d9a01fa63ee
HASH:=5455c148f4b8b04c553809bd22b995ee49ba5279ca3848df8bde6f80a388f7e0
endef
$(eval $(call Download,start_elf))
@ -90,7 +90,7 @@ define Download/start_cd_elf
FILE:=$(RPI_FIRMWARE_FILE)-start_cd.elf
URL:=$(RPI_FIRMWARE_URL)
URL_FILE:=start_cd.elf
HASH:=27d9354ff1af79a521527a288fe736f7337f91bca12bbc177c80e29dbbef0ffd
HASH:=168c0a9178d5a3b4bd89ef770826a85b4ea3132560ba3600c212c0cec4c575c6
endef
$(eval $(call Download,start_cd_elf))
@ -98,7 +98,7 @@ define Download/start_x_elf
FILE:=$(RPI_FIRMWARE_FILE)-start_x.elf
URL:=$(RPI_FIRMWARE_URL)
URL_FILE:=start_x.elf
HASH:=499bfdf3deba7bb0a033d2a4487b7f05bce45de2692c7c6dabc4a456237fd438
HASH:=30c6a7f32a25185053ca3ca9e4bcfe932246ed42a1b7c37f8803209f93d86404
endef
$(eval $(call Download,start_x_elf))
@ -106,7 +106,7 @@ define Download/start4_elf
FILE:=$(RPI_FIRMWARE_FILE)-start4.elf
URL:=$(RPI_FIRMWARE_URL)
URL_FILE:=start4.elf
HASH:=158bf783090223626cf45794bf679a3fadbf64bba55b76e3349b94e01be34202
HASH:=be8bbff41dba2749b7b0e812f0a9d87a9122d18508f7b5ff3cd20f303d15bc07
endef
$(eval $(call Download,start4_elf))
@ -114,7 +114,7 @@ define Download/start4cd_elf
FILE:=$(RPI_FIRMWARE_FILE)-start4cd.elf
URL:=$(RPI_FIRMWARE_URL)
URL_FILE:=start4cd.elf
HASH:=c4912701f620cdd9e44bbacbfc4adb4be1b6fb7ccf81f6029ce2115511970cc0
HASH:=000372e9cf6815ade595948dbd6328665f2a535eeee44e74b0ec8e56b6fbbf90
endef
$(eval $(call Download,start4cd_elf))
@ -122,7 +122,7 @@ define Download/start4x_elf
FILE:=$(RPI_FIRMWARE_FILE)-start4x.elf
URL:=$(RPI_FIRMWARE_URL)
URL_FILE:=start4x.elf
HASH:=3eb1adb5dfef21da0a16679ef65314a64196a67c6fca3422df8bc721d6b6fa94
HASH:=48895858f7936570dfab44c67bdcb0357ac8fcd630162c36ac9ed8f2de85c038
endef
$(eval $(call Download,start4x_elf))

View File

@ -56,7 +56,6 @@ KERNEL_MAKE := \
LLVM=1 CC="$(CLANG)" LD="$(TARGET_CROSS)ld" \
HOSTCC="$(HOSTCC)" \
HOSTCXX="$(HOSTCXX)" \
HOST_LOADLIBES="-L$(STAGING_DIR_HOST)/lib" \
KBUILD_HOSTLDLIBS="-L$(STAGING_DIR_HOST)/lib" \
CONFIG_SHELL="$(BASH)" \
INSTALL_HDR_PATH="$(PKG_BUILD_DIR)/user_headers"

View File

@ -0,0 +1,65 @@
From f2a7064a78b22f2b68b9fcbc8a6f4c5e61c5ba64 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Sun, 10 Oct 2021 00:17:11 +0200
Subject: [PATCH] ath10k: support bus and device specific API 1 BDF selection
Some ath10k IPQ40xx devices like the MikroTik hAP ac2 and ac3 require the
BDF-s to be extracted from the device storage instead of shipping packaged
API 2 BDF-s.
This is required as MikroTik has started shipping boards that require BDF-s
to be updated, as otherwise their WLAN performance really suffers.
This is however impossible as the devices that require this are release
under the same revision and its not possible to differentiate them from
devices using the older BDF-s.
In OpenWrt we are extracting the calibration data during runtime and we are
able to extract the BDF-s in the same manner, however we cannot package the
BDF-s to API 2 format on the fly and can only use API 1 to provide BDF-s on
the fly.
This is an issue as the ath10k driver explicitly looks only for the
board.bin file and not for something like board-bus-device.bin like it does
for pre-cal data.
Due to this we have no way of providing correct BDF-s on the fly, so lets
extend the ath10k driver to first look for BDF-s in the
board-bus-device.bin format, for example: board-ahb-a800000.wifi.bin
If that fails, look for the default board file name as defined previously.
Signed-off-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20211009221711.2315352-1-robimarko@gmail.com
---
drivers/net/wireless/ath/ath10k/core.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1199,6 +1199,7 @@ success:
static int ath10k_core_fetch_board_data_api_1(struct ath10k *ar, int bd_ie_type)
{
const struct firmware *fw;
+ char boardname[100];
if (bd_ie_type == ATH10K_BD_IE_BOARD) {
if (!ar->hw_params.fw.board) {
@@ -1206,9 +1207,19 @@ static int ath10k_core_fetch_board_data_
return -EINVAL;
}
+ scnprintf(boardname, sizeof(boardname), "board-%s-%s.bin",
+ ath10k_bus_str(ar->hif.bus), dev_name(ar->dev));
+
ar->normal_mode_fw.board = ath10k_fetch_fw_file(ar,
ar->hw_params.fw.dir,
- ar->hw_params.fw.board);
+ boardname);
+ if (IS_ERR(ar->normal_mode_fw.board)) {
+ fw = ath10k_fetch_fw_file(ar,
+ ar->hw_params.fw.dir,
+ ar->hw_params.fw.board);
+ ar->normal_mode_fw.board = fw;
+ }
+
if (IS_ERR(ar->normal_mode_fw.board))
return PTR_ERR(ar->normal_mode_fw.board);

View File

@ -44,7 +44,7 @@ Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
bmi_board_id_param = BMI_PARAM_GET_FLASH_BOARD_ID;
else
bmi_board_id_param = BMI_PARAM_GET_EEPROM_BOARD_ID;
@@ -1743,7 +1745,8 @@ static int ath10k_download_and_run_otp(s
@@ -1754,7 +1756,8 @@ static int ath10k_download_and_run_otp(s
/* As of now pre-cal is valid for 10_4 variants */
if (ar->cal_mode == ATH10K_PRE_CAL_MODE_DT ||
@ -54,7 +54,7 @@ Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
bmi_otp_exe_param = BMI_PARAM_FLASH_SECTION_ALL;
ret = ath10k_bmi_execute(ar, address, bmi_otp_exe_param, &result);
@@ -1870,6 +1873,39 @@ out_free:
@@ -1881,6 +1884,39 @@ out_free:
return ret;
}
@ -94,7 +94,7 @@ Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name,
struct ath10k_fw_file *fw_file)
{
@@ -2104,6 +2140,18 @@ static int ath10k_core_pre_cal_download(
@@ -2115,6 +2151,18 @@ static int ath10k_core_pre_cal_download(
{
int ret;
@ -113,7 +113,7 @@ Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
ret = ath10k_download_cal_file(ar, ar->pre_cal_file);
if (ret == 0) {
ar->cal_mode = ATH10K_PRE_CAL_MODE_FILE;
@@ -2170,6 +2218,18 @@ static int ath10k_download_cal_data(stru
@@ -2181,6 +2229,18 @@ static int ath10k_download_cal_data(stru
"pre cal download procedure failed, try cal file: %d\n",
ret);

View File

@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -3429,6 +3429,16 @@ int ath10k_core_register(struct ath10k *
@@ -3440,6 +3440,16 @@ int ath10k_core_register(struct ath10k *
queue_work(ar->workqueue, &ar->register_work);

View File

@ -172,7 +172,7 @@ v13:
.patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH,
@@ -3144,6 +3150,10 @@ int ath10k_core_start(struct ath10k *ar,
@@ -3155,6 +3161,10 @@ int ath10k_core_start(struct ath10k *ar,
goto err_hif_stop;
}
@ -183,7 +183,7 @@ v13:
return 0;
err_hif_stop:
@@ -3402,9 +3412,18 @@ static void ath10k_core_register_work(st
@@ -3413,9 +3423,18 @@ static void ath10k_core_register_work(st
goto err_spectral_destroy;
}
@ -202,7 +202,7 @@ v13:
err_spectral_destroy:
ath10k_spectral_destroy(ar);
err_debug_destroy:
@@ -3450,6 +3469,8 @@ void ath10k_core_unregister(struct ath10
@@ -3461,6 +3480,8 @@ void ath10k_core_unregister(struct ath10
if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags))
return;

View File

@ -26,7 +26,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
#include <linux/property.h>
#include <linux/dmi.h>
#include <linux/ctype.h>
@@ -3320,6 +3321,8 @@ static int ath10k_core_probe_fw(struct a
@@ -3331,6 +3332,8 @@ static int ath10k_core_probe_fw(struct a
device_get_mac_address(ar->dev, ar->mac_addr, sizeof(ar->mac_addr));

View File

@ -29,8 +29,6 @@ v2: Adjust #define per Felix's suggestion
drivers/net/wireless/ath/ath9k/ar9003_phy.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.h b/drivers/net/wireless/ath/ath9k/ar9003_phy.h
index a171dbb29..ad949eb02 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h
@@ -720,7 +720,7 @@
@ -42,6 +40,3 @@ index a171dbb29..ad949eb02 100644
#define AR_CH0_XTAL (AR_SREV_9300(ah) ? 0x16294 : \
((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16298 : \
--
2.30.2

View File

@ -24,11 +24,8 @@ PKG_INSTALL:=1
PKG_USE_MIPS16:=1
PKG_BUILD_DEPENDS:=!USE_GLIBC:argp-standalone
HOST_BUILD_DEPENDS:=argp-standalone/host musl-fts/host
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
include $(INCLUDE_DIR)/host-build.mk
define Package/elfutils/Default
SECTION:=libs
@ -114,7 +111,6 @@ define Package/libelf/install
endef
# these lines need to be ordered by dependency because of ABI versioning
$(eval $(call HostBuild))
$(eval $(call BuildPackage,libelf))
$(eval $(call BuildPackage,libdw))
$(eval $(call BuildPackage,libasm))

View File

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=bcm27xx-userland
PKG_VERSION:=97bc8180ad682b004ea224d1db7b8e108eda4397
PKG_RELEASE:=1
PKG_VERSION:=c4fd1b8986c6d6d4ae5cd51e65a8bbeb495dfa4e
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/raspberrypi/userland/tar.gz/$(PKG_VERSION)?
PKG_HASH:=d67def03931215f41b741aed5a3a1bc2bd62fa33f5cc14692e9a4d65f2e0ea27
PKG_HASH:=ab8a5b27c34cf1b97de87b895448a6355229f73b679866b47c51a723273cc8ae
PKG_FLAGS:=nonshared

View File

@ -81,7 +81,6 @@ CONFIG_CRYPTO_HASH_INFO=y
CONFIG_CRYPTO_LZO=y
CONFIG_CRYPTO_RNG2=y
CONFIG_CRYPTO_ZSTD=y
CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
CONFIG_DMADEVICES=y
CONFIG_DMA_ENGINE=y

View File

@ -118,7 +118,6 @@ CONFIG_CRYPTO_SHA256=y
CONFIG_DCACHE_WORD_ACCESS=y
CONFIG_DEBUG_AT91_SAMA7G5_FLEXCOM3=y
CONFIG_DEBUG_AT91_UART=y
CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_LL=y
CONFIG_DEBUG_LL_INCLUDE="debug/at91.S"
CONFIG_DEBUG_UART_PHYS=0xe1824200

View File

@ -11,7 +11,7 @@ BOARDNAME:=Broadcom BCM27xx
FEATURES:=audio boot-part display ext4 fpu gpio rootfs-part rtc squashfs usb usbgadget
SUBTARGETS:=bcm2708 bcm2709 bcm2710 bcm2711
KERNEL_PATCHVER=5.10
KERNEL_PATCHVER:=5.15
define Target/Description
Build firmware image for Broadcom BCM27xx SoC devices.

View File

@ -10,16 +10,16 @@ board_config_update
board=$(board_name)
case "$board" in
raspberrypi,model-b |\
raspberrypi,model-b-plus |\
raspberrypi,model-b-rev2 |\
raspberrypi,2-model-b |\
raspberrypi,2-model-b-rev2 |\
raspberrypi,3-model-b |\
raspberrypi,3-model-b-plus |\
raspberrypi,400 |\
raspberrypi,4-compute-module |\
raspberrypi,4-model-b)
raspberrypi,4-model-b |\
raspberrypi,model-b |\
raspberrypi,model-b-plus |\
raspberrypi,model-b-rev2)
ucidef_set_interface_lan "eth0"
;;

View File

@ -9,7 +9,7 @@ set_state() {
case "$(board_name)" in
raspberrypi,2-model-b |\
raspberrypi,2-model-b-rev2 |\
raspberrypi,3-model-b |\
raspberrypi,3-model-b |\
raspberrypi,3-model-b-plus |\
raspberrypi,400 |\
raspberrypi,4-compute-module |\

View File

@ -9,6 +9,8 @@ set_preinit_iface() {
raspberrypi,2-model-b-rev2 |\
raspberrypi,3-model-b |\
raspberrypi,3-model-b-plus |\
raspberrypi,400 |\
raspberrypi,4-compute-module |\
raspberrypi,4-model-b |\
raspberrypi,model-b |\
raspberrypi,model-b-plus |\

View File

@ -20,6 +20,7 @@ CONFIG_ARM_CPU_SUSPEND=y
CONFIG_ARM_ERRATA_411920=y
CONFIG_ARM_HAS_SG_CHAIN=y
CONFIG_ARM_L1_CACHE_SHIFT=5
# CONFIG_ARM_MHU_V2 is not set
CONFIG_ARM_PATCH_PHYS_VIRT=y
CONFIG_ARM_RASPBERRYPI_CPUFREQ=y
CONFIG_ARM_THUMB=y
@ -49,11 +50,9 @@ CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=4096
CONFIG_BLK_DEV_SD=y
CONFIG_BLK_PM=y
CONFIG_BLK_SCSI_REQUEST=y
CONFIG_BRCMSTB_L2_IRQ=y
CONFIG_BRCM_CHAR_DRIVERS=y
# CONFIG_CACHE_L2X0 is not set
CONFIG_CLKDEV_LOOKUP=y
CONFIG_CLKSRC_MMIO=y
CONFIG_CLK_BCM2711_DVP=y
CONFIG_CLK_BCM2835=y
@ -69,6 +68,7 @@ CONFIG_CMA_SIZE_MBYTES=5
CONFIG_CMA_SIZE_SEL_MBYTES=y
# CONFIG_CMA_SIZE_SEL_MIN is not set
# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set
# CONFIG_CMA_SYSFS is not set
CONFIG_COMMON_CLK=y
CONFIG_COMPAT_32BIT_TIME=y
CONFIG_CONFIGFS_FS=y
@ -110,7 +110,6 @@ CONFIG_CRYPTO_CRC32C=y
CONFIG_CRYPTO_RNG2=y
CONFIG_DCACHE_WORD_ACCESS=y
CONFIG_DEBUG_BUGVERBOSE=y
CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
CONFIG_DMABUF_HEAPS=y
CONFIG_DMABUF_HEAPS_CMA=y
@ -130,7 +129,6 @@ CONFIG_DTC=y
CONFIG_DUMMY_CONSOLE=y
CONFIG_EDAC_ATOMIC_SCRUB=y
CONFIG_EDAC_SUPPORT=y
CONFIG_ENABLE_MUST_CHECK=y
CONFIG_EXT4_FS=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
@ -158,6 +156,7 @@ CONFIG_FREEZER=y
CONFIG_FS_IOMAP=y
CONFIG_FS_MBCACHE=y
CONFIG_FS_POSIX_ACL=y
CONFIG_FWNODE_MDIO=y
CONFIG_FW_CACHE=y
CONFIG_FW_LOADER_PAGED_BUF=y
CONFIG_GENERIC_ALLOCATOR=y
@ -170,6 +169,7 @@ CONFIG_GENERIC_IRQ_CHIP=y
CONFIG_GENERIC_IRQ_MULTI_HANDLER=y
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED=y
CONFIG_GENERIC_PCI_IOMAP=y
CONFIG_GENERIC_PINCONF=y
CONFIG_GENERIC_PINCTRL_GROUPS=y
@ -181,6 +181,7 @@ CONFIG_GENERIC_STRNLEN_USER=y
CONFIG_GPIOLIB=y
CONFIG_GPIOLIB_IRQCHIP=y
# CONFIG_GPIO_BCM_VIRT is not set
CONFIG_GPIO_CDEV=y
# CONFIG_GPIO_FSM is not set
CONFIG_GPIO_RASPBERRYPI_EXP=y
CONFIG_HANDLE_DOMAIN_IRQ=y
@ -223,13 +224,13 @@ CONFIG_MAC_PARTITION=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_MAILBOX=y
# CONFIG_MAILBOX_TEST is not set
CONFIG_MAX_RAW_DEVS=256
CONFIG_MDIO_BUS=y
CONFIG_MDIO_DEVICE=y
CONFIG_MDIO_DEVRES=y
CONFIG_MEMFD_CREATE=y
CONFIG_MEMORY_ISOLATION=y
CONFIG_MFD_CORE=y
# CONFIG_MFD_RASPBERRYPI_POE_HAT is not set
# CONFIG_MFD_RPISENSE_CORE is not set
CONFIG_MFD_SYSCON=y
CONFIG_MIGHT_HAVE_CACHE_L2X0=y
@ -248,13 +249,14 @@ CONFIG_MODULES_USE_ELF_REL=y
# CONFIG_MTD is not set
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NEED_PER_CPU_KM=y
CONFIG_NET_SELFTESTS=y
CONFIG_NLS=y
CONFIG_NLS_ASCII=y
CONFIG_NOP_USB_XCEIV=y
CONFIG_NO_HZ=y
CONFIG_NO_HZ_COMMON=y
CONFIG_NO_HZ_IDLE=y
CONFIG_NVMEM=y
# CONFIG_NVMEM_RMEM is not set
CONFIG_OABI_COMPAT=y
CONFIG_OF=y
CONFIG_OF_ADDRESS=y
@ -266,7 +268,6 @@ CONFIG_OF_GPIO=y
CONFIG_OF_IRQ=y
CONFIG_OF_KOBJ=y
CONFIG_OF_MDIO=y
CONFIG_OF_NET=y
CONFIG_OF_OVERLAY=y
CONFIG_OF_RESOLVE=y
CONFIG_OLD_SIGACTION=y
@ -286,11 +287,11 @@ CONFIG_PM_OPP=y
CONFIG_PM_SLEEP=y
CONFIG_POWER_SUPPLY=y
CONFIG_PRINTK_TIME=y
CONFIG_PTP_1588_CLOCK_OPTIONAL=y
CONFIG_RASPBERRYPI_FIRMWARE=y
CONFIG_RASPBERRYPI_POWER=y
CONFIG_RATIONAL=y
# CONFIG_RAVE_SP_CORE is not set
CONFIG_RAW_DRIVER=y
CONFIG_REGMAP=y
CONFIG_REGMAP_MMIO=y
CONFIG_REGULATOR=y
@ -299,9 +300,9 @@ CONFIG_RESET_CONTROLLER=y
# CONFIG_RESET_RASPBERRYPI is not set
CONFIG_RESET_SIMPLE=y
# CONFIG_RPIVID_MEM is not set
# CONFIG_RPI_AXIPERF is not set
# CONFIG_RPI_POE_POWER is not set
CONFIG_SCSI=y
CONFIG_SCSI_COMMON=y
# CONFIG_SCSI_LOWLEVEL is not set
# CONFIG_SCSI_PROC_FS is not set
CONFIG_SERIAL_8250_BCM2835AUX=y
@ -319,8 +320,6 @@ CONFIG_SERIAL_MCTRL_GPIO=y
CONFIG_SERIAL_OF_PLATFORM=y
CONFIG_SG_POOL=y
CONFIG_SMSC_PHY=y
# CONFIG_SND_SOC_AD193X_I2C is not set
# CONFIG_SND_SOC_AD193X_SPI is not set
CONFIG_SPARSE_IRQ=y
CONFIG_SRCU=y
# CONFIG_STRIP_ASM_SYMS is not set
@ -354,6 +353,7 @@ CONFIG_USB_SUPPORT=y
CONFIG_USB_UAS=y
CONFIG_USB_USBNET=y
CONFIG_USE_OF=y
CONFIG_VCHIQ_CDEV=y
CONFIG_VFP=y
CONFIG_VT=y
CONFIG_VT_CONSOLE=y

View File

@ -27,6 +27,7 @@ CONFIG_ARM_HAS_SG_CHAIN=y
CONFIG_ARM_L1_CACHE_SHIFT=6
CONFIG_ARM_L1_CACHE_SHIFT_6=y
CONFIG_ARM_LPAE=y
# CONFIG_ARM_MHU_V2 is not set
CONFIG_ARM_PATCH_IDIV=y
CONFIG_ARM_PATCH_PHYS_VIRT=y
CONFIG_ARM_RASPBERRYPI_CPUFREQ=y
@ -62,13 +63,11 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
CONFIG_BLK_DEV_SD=y
CONFIG_BLK_MQ_PCI=y
CONFIG_BLK_PM=y
CONFIG_BLK_SCSI_REQUEST=y
CONFIG_BOUNCE=y
CONFIG_BRCMSTB_L2_IRQ=y
CONFIG_BRCM_CHAR_DRIVERS=y
CONFIG_BROADCOM_PHY=y
# CONFIG_CACHE_L2X0 is not set
CONFIG_CLKDEV_LOOKUP=y
CONFIG_CLKSRC_MMIO=y
CONFIG_CLK_BCM2711_DVP=y
CONFIG_CLK_BCM2835=y
@ -84,6 +83,7 @@ CONFIG_CMA_SIZE_MBYTES=5
CONFIG_CMA_SIZE_SEL_MBYTES=y
# CONFIG_CMA_SIZE_SEL_MIN is not set
# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set
# CONFIG_CMA_SYSFS is not set
CONFIG_COMMON_CLK=y
CONFIG_COMPAT_32BIT_TIME=y
CONFIG_CONFIGFS_FS=y
@ -108,6 +108,7 @@ CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_STAT=y
CONFIG_CPU_HAS_ASID=y
@ -142,7 +143,6 @@ CONFIG_CRYPTO_SHA512=y
CONFIG_CRYPTO_XTS=y
CONFIG_DCACHE_WORD_ACCESS=y
CONFIG_DEBUG_BUGVERBOSE=y
CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
CONFIG_DIMLIB=y
CONFIG_DMABUF_HEAPS=y
@ -163,7 +163,6 @@ CONFIG_DTC=y
CONFIG_DUMMY_CONSOLE=y
CONFIG_EDAC_ATOMIC_SCRUB=y
CONFIG_EDAC_SUPPORT=y
CONFIG_ENABLE_MUST_CHECK=y
CONFIG_EXT4_FS=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
@ -194,6 +193,7 @@ CONFIG_FS_ENCRYPTION_ALGS=y
CONFIG_FS_IOMAP=y
CONFIG_FS_MBCACHE=y
CONFIG_FS_POSIX_ACL=y
CONFIG_FWNODE_MDIO=y
CONFIG_FW_CACHE=y
CONFIG_FW_LOADER_PAGED_BUF=y
CONFIG_GENERIC_ALLOCATOR=y
@ -202,6 +202,7 @@ CONFIG_GENERIC_BUG=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
CONFIG_GENERIC_CPU_AUTOPROBE=y
CONFIG_GENERIC_CPU_VULNERABILITIES=y
CONFIG_GENERIC_EARLY_IOREMAP=y
CONFIG_GENERIC_GETTIMEOFDAY=y
CONFIG_GENERIC_IDLE_POLL_SETUP=y
@ -211,6 +212,7 @@ CONFIG_GENERIC_IRQ_MIGRATION=y
CONFIG_GENERIC_IRQ_MULTI_HANDLER=y
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED=y
CONFIG_GENERIC_MSI_IRQ=y
CONFIG_GENERIC_MSI_IRQ_DOMAIN=y
CONFIG_GENERIC_PCI_IOMAP=y
@ -227,6 +229,7 @@ CONFIG_GENERIC_VDSO_32=y
CONFIG_GPIOLIB=y
CONFIG_GPIOLIB_IRQCHIP=y
CONFIG_GPIO_BCM_VIRT=y
CONFIG_GPIO_CDEV=y
# CONFIG_GPIO_FSM is not set
CONFIG_GPIO_RASPBERRYPI_EXP=y
CONFIG_HANDLE_DOMAIN_IRQ=y
@ -262,6 +265,8 @@ CONFIG_IRQ_FORCED_THREADING=y
CONFIG_IRQ_WORK=y
CONFIG_JBD2=y
CONFIG_KEYS=y
CONFIG_KMAP_LOCAL=y
CONFIG_KMAP_LOCAL_NON_LINEAR_PTE_ARRAY=y
CONFIG_LEDS_GPIO=y
CONFIG_LEDS_TRIGGER_ACTPWR=y
CONFIG_LEDS_TRIGGER_INPUT=y
@ -276,7 +281,6 @@ CONFIG_MAC_PARTITION=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_MAILBOX=y
# CONFIG_MAILBOX_TEST is not set
CONFIG_MAX_RAW_DEVS=256
CONFIG_MDIO_BCM_UNIMAC=y
CONFIG_MDIO_BUS=y
CONFIG_MDIO_DEVICE=y
@ -284,6 +288,7 @@ CONFIG_MDIO_DEVRES=y
CONFIG_MEMFD_CREATE=y
CONFIG_MEMORY_ISOLATION=y
CONFIG_MFD_CORE=y
# CONFIG_MFD_RASPBERRYPI_POE_HAT is not set
# CONFIG_MFD_RPISENSE_CORE is not set
CONFIG_MFD_SYSCON=y
CONFIG_MICROCHIP_PHY=y
@ -308,6 +313,7 @@ CONFIG_MUTEX_SPIN_ON_OWNER=y
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NEON=y
CONFIG_NET_FLOW_LIMIT=y
CONFIG_NET_SELFTESTS=y
CONFIG_NLS=y
CONFIG_NLS_ASCII=y
CONFIG_NOP_USB_XCEIV=y
@ -316,7 +322,6 @@ CONFIG_NO_HZ_COMMON=y
CONFIG_NO_HZ_IDLE=y
CONFIG_NR_CPUS=4
CONFIG_NVMEM=y
# CONFIG_NVMEM_RMEM is not set
CONFIG_OABI_COMPAT=y
CONFIG_OF=y
CONFIG_OF_ADDRESS=y
@ -328,7 +333,6 @@ CONFIG_OF_GPIO=y
CONFIG_OF_IRQ=y
CONFIG_OF_KOBJ=y
CONFIG_OF_MDIO=y
CONFIG_OF_NET=y
CONFIG_OF_OVERLAY=y
CONFIG_OF_RESOLVE=y
CONFIG_OLD_SIGACTION=y
@ -360,12 +364,12 @@ CONFIG_PM_SLEEP=y
CONFIG_PM_SLEEP_SMP=y
CONFIG_POWER_SUPPLY=y
CONFIG_PRINTK_TIME=y
CONFIG_PTP_1588_CLOCK_OPTIONAL=y
CONFIG_RAS=y
CONFIG_RASPBERRYPI_FIRMWARE=y
CONFIG_RASPBERRYPI_POWER=y
CONFIG_RATIONAL=y
# CONFIG_RAVE_SP_CORE is not set
CONFIG_RAW_DRIVER=y
CONFIG_REGMAP=y
CONFIG_REGMAP_MMIO=y
CONFIG_REGULATOR=y
@ -376,11 +380,11 @@ CONFIG_RESET_RASPBERRYPI=y
CONFIG_RESET_SIMPLE=y
CONFIG_RFS_ACCEL=y
# CONFIG_RPIVID_MEM is not set
# CONFIG_RPI_AXIPERF is not set
# CONFIG_RPI_POE_POWER is not set
CONFIG_RPS=y
CONFIG_RWSEM_SPIN_ON_OWNER=y
CONFIG_SCSI=y
CONFIG_SCSI_COMMON=y
# CONFIG_SCSI_LOWLEVEL is not set
# CONFIG_SCSI_PROC_FS is not set
CONFIG_SERIAL_8250_BCM2835AUX=y
@ -400,8 +404,7 @@ CONFIG_SG_POOL=y
CONFIG_SMP=y
CONFIG_SMP_ON_UP=y
CONFIG_SMSC_PHY=y
# CONFIG_SND_SOC_AD193X_I2C is not set
# CONFIG_SND_SOC_AD193X_SPI is not set
CONFIG_SOCK_RX_QUEUE_MAPPING=y
CONFIG_SPARSE_IRQ=y
CONFIG_SRCU=y
# CONFIG_STRIP_ASM_SYMS is not set
@ -411,7 +414,6 @@ CONFIG_SWIOTLB=y
CONFIG_SWPHY=y
CONFIG_SWP_EMULATE=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_SYS_SUPPORTS_HUGETLBFS=y
# CONFIG_TEXTSEARCH is not set
CONFIG_THERMAL=y
CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y
@ -424,6 +426,7 @@ CONFIG_TIMER_PROBE=y
CONFIG_TMPFS_POSIX_ACL=y
CONFIG_TREE_RCU=y
CONFIG_TREE_SRCU=y
# CONFIG_UCLAMP_TASK is not set
CONFIG_UEVENT_HELPER_PATH=""
# CONFIG_UID16 is not set
CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
@ -447,6 +450,7 @@ CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_PCI=y
CONFIG_USB_XHCI_PLATFORM=y
CONFIG_USE_OF=y
CONFIG_VCHIQ_CDEV=y
CONFIG_VFP=y
CONFIG_VFPv3=y
CONFIG_VT=y

View File

@ -4,19 +4,20 @@ CONFIG_ARCH_BCM2835=y
CONFIG_ARCH_DMA_ADDR_T_64BIT=y
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_KEEP_MEMBLOCK=y
CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y
CONFIG_ARCH_MMAP_RND_BITS=18
CONFIG_ARCH_MMAP_RND_BITS_MAX=24
CONFIG_ARCH_MMAP_RND_BITS_MIN=18
CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11
CONFIG_ARCH_PROC_KCORE_TEXT=y
CONFIG_ARCH_SELECT_MEMORY_MODEL=y
CONFIG_ARCH_SPARSEMEM_DEFAULT=y
CONFIG_ARCH_SPARSEMEM_ENABLE=y
CONFIG_ARCH_STACKWALK=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_ARCH_WANTS_NO_INSTR=y
CONFIG_ARM64=y
CONFIG_ARM64_4K_PAGES=y
CONFIG_ARM64_CNP=y
CONFIG_ARM64_EPAN=y
CONFIG_ARM64_ERRATUM_819472=y
CONFIG_ARM64_ERRATUM_824069=y
CONFIG_ARM64_ERRATUM_826319=y
@ -24,18 +25,18 @@ CONFIG_ARM64_ERRATUM_827319=y
CONFIG_ARM64_ERRATUM_832075=y
CONFIG_ARM64_ERRATUM_843419=y
CONFIG_ARM64_HW_AFDBM=y
CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y
CONFIG_ARM64_MODULE_PLTS=y
CONFIG_ARM64_PAGE_SHIFT=12
CONFIG_ARM64_PAN=y
CONFIG_ARM64_PA_BITS=48
CONFIG_ARM64_PA_BITS_48=y
CONFIG_ARM64_PTR_AUTH=y
CONFIG_ARM64_PTR_AUTH_KERNEL=y
CONFIG_ARM64_SVE=y
CONFIG_ARM64_TAGGED_ADDR_ABI=y
CONFIG_ARM64_UAO=y
CONFIG_ARM64_VA_BITS=39
CONFIG_ARM64_VA_BITS_39=y
CONFIG_ARM64_VHE=y
CONFIG_ARM64_WORKAROUND_CLEAN_CACHE=y
CONFIG_ARM_AMBA=y
CONFIG_ARM_ARCH_TIMER=y
@ -46,6 +47,7 @@ CONFIG_ARM_GIC_V2M=y
CONFIG_ARM_GIC_V3=y
CONFIG_ARM_GIC_V3_ITS=y
CONFIG_ARM_GIC_V3_ITS_PCI=y
# CONFIG_ARM_MHU_V2 is not set
CONFIG_ARM_PSCI_FW=y
CONFIG_ARM_RASPBERRYPI_CPUFREQ=y
CONFIG_ARM_TIMER_SP804=y
@ -72,15 +74,12 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
CONFIG_BLK_DEV_SD=y
CONFIG_BLK_MQ_PCI=y
CONFIG_BLK_PM=y
CONFIG_BLK_SCSI_REQUEST=y
CONFIG_BOUNCE=y
CONFIG_BRCMSTB_L2_IRQ=y
CONFIG_BRCM_CHAR_DRIVERS=y
CONFIG_CAVIUM_ERRATUM_22375=y
CONFIG_CAVIUM_ERRATUM_23154=y
CONFIG_CAVIUM_ERRATUM_27456=y
CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y
CONFIG_CLKDEV_LOOKUP=y
CONFIG_CLKSRC_MMIO=y
CONFIG_CLK_BCM2711_DVP=y
CONFIG_CLK_BCM2835=y
@ -96,6 +95,7 @@ CONFIG_CMA_SIZE_MBYTES=5
CONFIG_CMA_SIZE_SEL_MBYTES=y
# CONFIG_CMA_SIZE_SEL_MIN is not set
# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set
# CONFIG_CMA_SYSFS is not set
CONFIG_COMMON_CLK=y
CONFIG_COMMON_CLK_XGENE=y
# CONFIG_COMPAT_32BIT_TIME is not set
@ -113,6 +113,7 @@ CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_STAT=y
CONFIG_CPU_IDLE=y
@ -141,7 +142,6 @@ CONFIG_CRYPTO_SHA512=y
CONFIG_CRYPTO_XTS=y
CONFIG_DCACHE_WORD_ACCESS=y
CONFIG_DEBUG_BUGVERBOSE=y
CONFIG_DEBUG_INFO=y
CONFIG_DMABUF_HEAPS=y
CONFIG_DMABUF_HEAPS_CMA=y
CONFIG_DMABUF_HEAPS_SYSTEM=y
@ -159,7 +159,6 @@ CONFIG_DNOTIFY=y
CONFIG_DTC=y
CONFIG_DUMMY_CONSOLE=y
CONFIG_EDAC_SUPPORT=y
CONFIG_ENABLE_MUST_CHECK=y
CONFIG_EXT4_FS=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
@ -175,7 +174,6 @@ CONFIG_FB_CMDLINE=y
CONFIG_FB_SIMPLE=y
CONFIG_FIXED_PHY=y
CONFIG_FIX_EARLYCON_MEM=y
# CONFIG_FLATMEM_MANUAL is not set
CONFIG_FONT_8x16=y
CONFIG_FONT_8x8=y
CONFIG_FONT_SUPPORT=y
@ -190,6 +188,7 @@ CONFIG_FS_ENCRYPTION_ALGS=y
CONFIG_FS_IOMAP=y
CONFIG_FS_MBCACHE=y
CONFIG_FS_POSIX_ACL=y
CONFIG_FWNODE_MDIO=y
CONFIG_FW_CACHE=y
CONFIG_FW_LOADER_PAGED_BUF=y
CONFIG_GENERIC_ALLOCATOR=y
@ -202,14 +201,15 @@ CONFIG_GENERIC_CPU_AUTOPROBE=y
CONFIG_GENERIC_CPU_VULNERABILITIES=y
CONFIG_GENERIC_CSUM=y
CONFIG_GENERIC_EARLY_IOREMAP=y
CONFIG_GENERIC_FIND_FIRST_BIT=y
CONFIG_GENERIC_GETTIMEOFDAY=y
CONFIG_GENERIC_IDLE_POLL_SETUP=y
CONFIG_GENERIC_IRQ_CHIP=y
CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y
CONFIG_GENERIC_IRQ_MIGRATION=y
CONFIG_GENERIC_IRQ_MULTI_HANDLER=y
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED=y
CONFIG_GENERIC_MSI_IRQ=y
CONFIG_GENERIC_MSI_IRQ_DOMAIN=y
CONFIG_GENERIC_PCI_IOMAP=y
@ -224,6 +224,7 @@ CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_GPIOLIB=y
CONFIG_GPIOLIB_IRQCHIP=y
CONFIG_GPIO_BCM_VIRT=y
CONFIG_GPIO_CDEV=y
# CONFIG_GPIO_FSM is not set
CONFIG_GPIO_RASPBERRYPI_EXP=y
CONFIG_HANDLE_DOMAIN_IRQ=y
@ -231,7 +232,6 @@ CONFIG_HARDIRQS_SW_RESEND=y
CONFIG_HAS_DMA=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT_MAP=y
CONFIG_HOLES_IN_ZONE=y
CONFIG_HOTPLUG_CPU=y
CONFIG_HW_CONSOLE=y
CONFIG_HW_RANDOM=y
@ -269,13 +269,13 @@ CONFIG_MAC_PARTITION=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_MAILBOX=y
# CONFIG_MAILBOX_TEST is not set
CONFIG_MAX_RAW_DEVS=256
CONFIG_MDIO_BUS=y
CONFIG_MDIO_DEVICE=y
CONFIG_MDIO_DEVRES=y
CONFIG_MEMFD_CREATE=y
CONFIG_MEMORY_ISOLATION=y
CONFIG_MFD_CORE=y
# CONFIG_MFD_RASPBERRYPI_POE_HAT is not set
# CONFIG_MFD_RPISENSE_CORE is not set
CONFIG_MFD_SYSCON=y
CONFIG_MICROCHIP_PHY=y
@ -299,14 +299,15 @@ CONFIG_MUTEX_SPIN_ON_OWNER=y
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NEED_SG_DMA_LENGTH=y
CONFIG_NET_FLOW_LIMIT=y
CONFIG_NET_SELFTESTS=y
CONFIG_NLS=y
CONFIG_NLS_ASCII=y
CONFIG_NOP_USB_XCEIV=y
CONFIG_NO_HZ=y
CONFIG_NO_HZ_COMMON=y
CONFIG_NO_HZ_IDLE=y
CONFIG_NR_CPUS=4
CONFIG_NVMEM=y
# CONFIG_NVMEM_RMEM is not set
CONFIG_OF=y
CONFIG_OF_ADDRESS=y
CONFIG_OF_CONFIGFS=y
@ -317,7 +318,6 @@ CONFIG_OF_GPIO=y
CONFIG_OF_IRQ=y
CONFIG_OF_KOBJ=y
CONFIG_OF_MDIO=y
CONFIG_OF_NET=y
CONFIG_OF_OVERLAY=y
CONFIG_OF_RESOLVE=y
CONFIG_PADATA=y
@ -344,13 +344,13 @@ CONFIG_PM_SLEEP_SMP=y
CONFIG_POWER_RESET=y
CONFIG_POWER_SUPPLY=y
CONFIG_PRINTK_TIME=y
CONFIG_PTP_1588_CLOCK_OPTIONAL=y
CONFIG_QUEUED_RWLOCKS=y
CONFIG_QUEUED_SPINLOCKS=y
CONFIG_RASPBERRYPI_FIRMWARE=y
CONFIG_RASPBERRYPI_POWER=y
CONFIG_RATIONAL=y
# CONFIG_RAVE_SP_CORE is not set
CONFIG_RAW_DRIVER=y
CONFIG_REGMAP=y
CONFIG_REGMAP_MMIO=y
CONFIG_REGULATOR=y
@ -362,11 +362,11 @@ CONFIG_RESET_SIMPLE=y
CONFIG_RFS_ACCEL=y
CONFIG_RODATA_FULL_DEFAULT_ENABLED=y
# CONFIG_RPIVID_MEM is not set
# CONFIG_RPI_AXIPERF is not set
# CONFIG_RPI_POE_POWER is not set
CONFIG_RPS=y
CONFIG_RWSEM_SPIN_ON_OWNER=y
CONFIG_SCSI=y
CONFIG_SCSI_COMMON=y
# CONFIG_SCSI_LOWLEVEL is not set
# CONFIG_SCSI_PROC_FS is not set
CONFIG_SERIAL_8250_BCM2835AUX=y
@ -385,11 +385,9 @@ CONFIG_SERIAL_OF_PLATFORM=y
CONFIG_SG_POOL=y
CONFIG_SMP=y
CONFIG_SMSC_PHY=y
# CONFIG_SND_SOC_AD193X_I2C is not set
# CONFIG_SND_SOC_AD193X_SPI is not set
CONFIG_SOCK_RX_QUEUE_MAPPING=y
CONFIG_SPARSEMEM=y
CONFIG_SPARSEMEM_EXTREME=y
CONFIG_SPARSEMEM_MANUAL=y
CONFIG_SPARSEMEM_VMEMMAP=y
CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
CONFIG_SPARSE_IRQ=y
@ -400,7 +398,6 @@ CONFIG_SUSPEND_FREEZER=y
CONFIG_SWIOTLB=y
CONFIG_SWPHY=y
CONFIG_SYSCTL_EXCEPTION_TRACE=y
CONFIG_SYS_SUPPORTS_HUGETLBFS=y
# CONFIG_TEXTSEARCH is not set
CONFIG_THERMAL=y
CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y
@ -415,6 +412,7 @@ CONFIG_TIMER_PROBE=y
CONFIG_TMPFS_POSIX_ACL=y
CONFIG_TREE_RCU=y
CONFIG_TREE_SRCU=y
# CONFIG_UCLAMP_TASK is not set
CONFIG_UEVENT_HELPER_PATH=""
CONFIG_UNMAP_KERNEL_AT_EL0=y
CONFIG_USB=y
@ -424,10 +422,12 @@ CONFIG_USB_DWCOTG=y
CONFIG_USB_LAN78XX=y
CONFIG_USB_NET_DRIVERS=y
CONFIG_USB_NET_SMSC95XX=y
CONFIG_USB_PHY=y
CONFIG_USB_STORAGE=y
CONFIG_USB_SUPPORT=y
CONFIG_USB_UAS=y
CONFIG_USB_USBNET=y
CONFIG_VCHIQ_CDEV=y
CONFIG_VMAP_STACK=y
CONFIG_VT=y
CONFIG_VT_CONSOLE=y

View File

@ -4,19 +4,20 @@ CONFIG_ARCH_BCM2835=y
CONFIG_ARCH_DMA_ADDR_T_64BIT=y
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_KEEP_MEMBLOCK=y
CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y
CONFIG_ARCH_MMAP_RND_BITS=18
CONFIG_ARCH_MMAP_RND_BITS_MAX=24
CONFIG_ARCH_MMAP_RND_BITS_MIN=18
CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11
CONFIG_ARCH_PROC_KCORE_TEXT=y
CONFIG_ARCH_SELECT_MEMORY_MODEL=y
CONFIG_ARCH_SPARSEMEM_DEFAULT=y
CONFIG_ARCH_SPARSEMEM_ENABLE=y
CONFIG_ARCH_STACKWALK=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_ARCH_WANTS_NO_INSTR=y
CONFIG_ARM64=y
CONFIG_ARM64_4K_PAGES=y
CONFIG_ARM64_CNP=y
CONFIG_ARM64_EPAN=y
CONFIG_ARM64_ERRATUM_819472=y
CONFIG_ARM64_ERRATUM_824069=y
CONFIG_ARM64_ERRATUM_826319=y
@ -24,18 +25,18 @@ CONFIG_ARM64_ERRATUM_827319=y
CONFIG_ARM64_ERRATUM_832075=y
CONFIG_ARM64_ERRATUM_843419=y
CONFIG_ARM64_HW_AFDBM=y
CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y
CONFIG_ARM64_MODULE_PLTS=y
CONFIG_ARM64_PAGE_SHIFT=12
CONFIG_ARM64_PAN=y
CONFIG_ARM64_PA_BITS=48
CONFIG_ARM64_PA_BITS_48=y
CONFIG_ARM64_PTR_AUTH=y
CONFIG_ARM64_PTR_AUTH_KERNEL=y
CONFIG_ARM64_SVE=y
CONFIG_ARM64_TAGGED_ADDR_ABI=y
CONFIG_ARM64_UAO=y
CONFIG_ARM64_VA_BITS=39
CONFIG_ARM64_VA_BITS_39=y
CONFIG_ARM64_VHE=y
CONFIG_ARM64_WORKAROUND_CLEAN_CACHE=y
CONFIG_ARM_AMBA=y
CONFIG_ARM_ARCH_TIMER=y
@ -46,6 +47,7 @@ CONFIG_ARM_GIC_V2M=y
CONFIG_ARM_GIC_V3=y
CONFIG_ARM_GIC_V3_ITS=y
CONFIG_ARM_GIC_V3_ITS_PCI=y
# CONFIG_ARM_MHU_V2 is not set
CONFIG_ARM_PSCI_FW=y
CONFIG_ARM_RASPBERRYPI_CPUFREQ=y
CONFIG_ARM_TIMER_SP804=y
@ -75,8 +77,6 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
CONFIG_BLK_DEV_SD=y
CONFIG_BLK_MQ_PCI=y
CONFIG_BLK_PM=y
CONFIG_BLK_SCSI_REQUEST=y
CONFIG_BOUNCE=y
CONFIG_BRCMSTB_L2_IRQ=y
CONFIG_BRCM_CHAR_DRIVERS=y
CONFIG_BROADCOM_PHY=y
@ -84,7 +84,6 @@ CONFIG_CAVIUM_ERRATUM_22375=y
CONFIG_CAVIUM_ERRATUM_23154=y
CONFIG_CAVIUM_ERRATUM_27456=y
CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y
CONFIG_CLKDEV_LOOKUP=y
CONFIG_CLKSRC_MMIO=y
CONFIG_CLK_BCM2711_DVP=y
CONFIG_CLK_BCM2835=y
@ -100,6 +99,7 @@ CONFIG_CMA_SIZE_MBYTES=5
CONFIG_CMA_SIZE_SEL_MBYTES=y
# CONFIG_CMA_SIZE_SEL_MIN is not set
# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set
# CONFIG_CMA_SYSFS is not set
CONFIG_COMMON_CLK=y
CONFIG_COMMON_CLK_XGENE=y
# CONFIG_COMPAT_32BIT_TIME is not set
@ -117,6 +117,7 @@ CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_STAT=y
CONFIG_CPU_IDLE=y
@ -145,7 +146,6 @@ CONFIG_CRYPTO_SHA512=y
CONFIG_CRYPTO_XTS=y
CONFIG_DCACHE_WORD_ACCESS=y
CONFIG_DEBUG_BUGVERBOSE=y
CONFIG_DEBUG_INFO=y
CONFIG_DIMLIB=y
CONFIG_DMABUF_HEAPS=y
CONFIG_DMABUF_HEAPS_CMA=y
@ -164,7 +164,6 @@ CONFIG_DNOTIFY=y
CONFIG_DTC=y
CONFIG_DUMMY_CONSOLE=y
CONFIG_EDAC_SUPPORT=y
CONFIG_ENABLE_MUST_CHECK=y
CONFIG_EXT4_FS=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
@ -180,7 +179,6 @@ CONFIG_FB_CMDLINE=y
CONFIG_FB_SIMPLE=y
CONFIG_FIXED_PHY=y
CONFIG_FIX_EARLYCON_MEM=y
# CONFIG_FLATMEM_MANUAL is not set
CONFIG_FONT_8x16=y
CONFIG_FONT_8x8=y
CONFIG_FONT_SUPPORT=y
@ -195,6 +193,7 @@ CONFIG_FS_ENCRYPTION_ALGS=y
CONFIG_FS_IOMAP=y
CONFIG_FS_MBCACHE=y
CONFIG_FS_POSIX_ACL=y
CONFIG_FWNODE_MDIO=y
CONFIG_FW_CACHE=y
CONFIG_FW_LOADER_PAGED_BUF=y
CONFIG_GENERIC_ALLOCATOR=y
@ -207,14 +206,15 @@ CONFIG_GENERIC_CPU_AUTOPROBE=y
CONFIG_GENERIC_CPU_VULNERABILITIES=y
CONFIG_GENERIC_CSUM=y
CONFIG_GENERIC_EARLY_IOREMAP=y
CONFIG_GENERIC_FIND_FIRST_BIT=y
CONFIG_GENERIC_GETTIMEOFDAY=y
CONFIG_GENERIC_IDLE_POLL_SETUP=y
CONFIG_GENERIC_IRQ_CHIP=y
CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y
CONFIG_GENERIC_IRQ_MIGRATION=y
CONFIG_GENERIC_IRQ_MULTI_HANDLER=y
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED=y
CONFIG_GENERIC_MSI_IRQ=y
CONFIG_GENERIC_MSI_IRQ_DOMAIN=y
CONFIG_GENERIC_PCI_IOMAP=y
@ -230,6 +230,7 @@ CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_GPIOLIB=y
CONFIG_GPIOLIB_IRQCHIP=y
CONFIG_GPIO_BCM_VIRT=y
CONFIG_GPIO_CDEV=y
# CONFIG_GPIO_FSM is not set
CONFIG_GPIO_RASPBERRYPI_EXP=y
CONFIG_HANDLE_DOMAIN_IRQ=y
@ -237,7 +238,6 @@ CONFIG_HARDIRQS_SW_RESEND=y
CONFIG_HAS_DMA=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT_MAP=y
CONFIG_HOLES_IN_ZONE=y
CONFIG_HOTPLUG_CPU=y
CONFIG_HW_CONSOLE=y
CONFIG_HW_RANDOM=y
@ -276,7 +276,6 @@ CONFIG_MAC_PARTITION=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_MAILBOX=y
# CONFIG_MAILBOX_TEST is not set
CONFIG_MAX_RAW_DEVS=256
CONFIG_MDIO_BCM_UNIMAC=y
CONFIG_MDIO_BUS=y
CONFIG_MDIO_DEVICE=y
@ -284,6 +283,7 @@ CONFIG_MDIO_DEVRES=y
CONFIG_MEMFD_CREATE=y
CONFIG_MEMORY_ISOLATION=y
CONFIG_MFD_CORE=y
# CONFIG_MFD_RASPBERRYPI_POE_HAT is not set
# CONFIG_MFD_RPISENSE_CORE is not set
CONFIG_MFD_SYSCON=y
CONFIG_MIGRATION=y
@ -306,6 +306,7 @@ CONFIG_MUTEX_SPIN_ON_OWNER=y
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NEED_SG_DMA_LENGTH=y
CONFIG_NET_FLOW_LIMIT=y
CONFIG_NET_SELFTESTS=y
CONFIG_NLS=y
CONFIG_NLS_ASCII=y
CONFIG_NOP_USB_XCEIV=y
@ -314,7 +315,6 @@ CONFIG_NO_HZ_COMMON=y
CONFIG_NO_HZ_IDLE=y
CONFIG_NR_CPUS=4
CONFIG_NVMEM=y
# CONFIG_NVMEM_RMEM is not set
CONFIG_OF=y
CONFIG_OF_ADDRESS=y
CONFIG_OF_CONFIGFS=y
@ -325,7 +325,6 @@ CONFIG_OF_GPIO=y
CONFIG_OF_IRQ=y
CONFIG_OF_KOBJ=y
CONFIG_OF_MDIO=y
CONFIG_OF_NET=y
CONFIG_OF_OVERLAY=y
CONFIG_OF_RESOLVE=y
CONFIG_PADATA=y
@ -355,6 +354,7 @@ CONFIG_PM_SLEEP_SMP=y
CONFIG_POWER_RESET=y
CONFIG_POWER_SUPPLY=y
CONFIG_PRINTK_TIME=y
CONFIG_PTP_1588_CLOCK_OPTIONAL=y
CONFIG_QUEUED_RWLOCKS=y
CONFIG_QUEUED_SPINLOCKS=y
CONFIG_RAS=y
@ -362,7 +362,6 @@ CONFIG_RASPBERRYPI_FIRMWARE=y
CONFIG_RASPBERRYPI_POWER=y
CONFIG_RATIONAL=y
# CONFIG_RAVE_SP_CORE is not set
CONFIG_RAW_DRIVER=y
CONFIG_REGMAP=y
CONFIG_REGMAP_MMIO=y
CONFIG_REGULATOR=y
@ -374,11 +373,11 @@ CONFIG_RESET_SIMPLE=y
CONFIG_RFS_ACCEL=y
CONFIG_RODATA_FULL_DEFAULT_ENABLED=y
# CONFIG_RPIVID_MEM is not set
# CONFIG_RPI_AXIPERF is not set
# CONFIG_RPI_POE_POWER is not set
CONFIG_RPS=y
CONFIG_RWSEM_SPIN_ON_OWNER=y
CONFIG_SCSI=y
CONFIG_SCSI_COMMON=y
# CONFIG_SCSI_LOWLEVEL is not set
# CONFIG_SCSI_PROC_FS is not set
CONFIG_SERIAL_8250_BCM2835AUX=y
@ -396,11 +395,9 @@ CONFIG_SERIAL_MCTRL_GPIO=y
CONFIG_SERIAL_OF_PLATFORM=y
CONFIG_SG_POOL=y
CONFIG_SMP=y
# CONFIG_SND_SOC_AD193X_I2C is not set
# CONFIG_SND_SOC_AD193X_SPI is not set
CONFIG_SOCK_RX_QUEUE_MAPPING=y
CONFIG_SPARSEMEM=y
CONFIG_SPARSEMEM_EXTREME=y
CONFIG_SPARSEMEM_MANUAL=y
CONFIG_SPARSEMEM_VMEMMAP=y
CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
CONFIG_SPARSE_IRQ=y
@ -411,7 +408,6 @@ CONFIG_SUSPEND_FREEZER=y
CONFIG_SWIOTLB=y
CONFIG_SWPHY=y
CONFIG_SYSCTL_EXCEPTION_TRACE=y
CONFIG_SYS_SUPPORTS_HUGETLBFS=y
# CONFIG_TEXTSEARCH is not set
CONFIG_THERMAL=y
CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y
@ -426,6 +422,7 @@ CONFIG_TIMER_PROBE=y
CONFIG_TMPFS_POSIX_ACL=y
CONFIG_TREE_RCU=y
CONFIG_TREE_SRCU=y
# CONFIG_UCLAMP_TASK is not set
CONFIG_UEVENT_HELPER_PATH=""
CONFIG_UNMAP_KERNEL_AT_EL0=y
CONFIG_USB=y
@ -442,6 +439,7 @@ CONFIG_USB_UAS=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_PCI=y
CONFIG_USB_XHCI_PLATFORM=y
CONFIG_VCHIQ_CDEV=y
CONFIG_VMAP_STACK=y
CONFIG_VT=y
CONFIG_VT_CONSOLE=y

View File

@ -15,19 +15,3 @@ define KernelPackage/hwmon-raspberrypi/description
endef
$(eval $(call KernelPackage,hwmon-raspberrypi))
define KernelPackage/hwmon-rpi-poe-fan
SUBMENU:=$(HWMON_MENU)
TITLE:=Raspberry Pi PoE HAT fan
DEPENDS:=@TARGET_bcm27xx +kmod-hwmon-core
KCONFIG:=CONFIG_SENSORS_RPI_POE_FAN
FILES:=$(LINUX_DIR)/drivers/hwmon/rpi-poe-fan.ko
AUTOLOAD:=$(call AutoProbe,rpi-poe-fan)
endef
define KernelPackage/hwmon-rpi-poe-fan/description
Raspberry Pi PoE HAT fan driver
endef
$(eval $(call KernelPackage,hwmon-rpi-poe-fan))

View File

@ -20,6 +20,24 @@ endef
$(eval $(call KernelPackage,pwm-bcm2835))
define KernelPackage/pwm-raspberrypi-poe
SUBMENU:=$(OTHER_MENU)
TITLE:=Raspberry Pi Firwmware PoE Hat PWM support
KCONFIG:= \
CONFIG_PWM=y \
CONFIG_PWM_RASPBERRYPI_POE
FILES:=$(LINUX_DIR)/drivers/pwm/pwm-raspberrypi-poe.ko
AUTOLOAD:=$(call AutoLoad,20,pwm-raspberrypi-poe)
DEPENDS:=@TARGET_bcm27xx @LINUX_5_15
endef
define KernelPackage/pwm-raspberrypi-poe/description
This package provides Raspberry Pi Firwmware PoE Hat PWM support
endef
$(eval $(call KernelPackage,pwm-raspberrypi-poe))
define KernelPackage/smi-bcm2835
SUBMENU:=$(OTHER_MENU)
TITLE:=BCM2835 SMI driver

View File

@ -932,6 +932,7 @@ define KernelPackage/sound-soc-rpi-cirrus
CONFIG_SND_SOC_WM8804 \
CONFIG_SND_SOC_WM_ADSP
FILES:= \
$(LINUX_DIR)/drivers/mfd/arizona.ko \
$(LINUX_DIR)/sound/soc/bcm/snd-soc-rpi-cirrus.ko \
$(LINUX_DIR)/sound/soc/codecs/snd-soc-arizona.ko \
$(LINUX_DIR)/sound/soc/codecs/snd-soc-wm-adsp.ko \

View File

@ -40,7 +40,7 @@ define KernelPackage/drm-vc4
$(LINUX_DIR)/drivers/gpu/drm/vc4/vc4.ko \
$(LINUX_DIR)/drivers/gpu/drm/drm_kms_helper.ko \
$(LINUX_DIR)/drivers/media/cec/cec.ko@lt5.10 \
$(LINUX_DIR)/drivers/media/cec/core/cec.ko@ge5.10
$(LINUX_DIR)/drivers/media/cec/core/cec.ko
AUTOLOAD:=$(call AutoProbe,vc4)
endef

View File

@ -1,27 +0,0 @@
From b7ad81911a06fd8047ca36c07bd49d8317833502 Mon Sep 17 00:00:00 2001
From: popcornmix <popcornmix@gmail.com>
Date: Mon, 25 Jan 2016 17:25:12 +0000
Subject: [PATCH] firmware: Updated mailbox header
---
include/soc/bcm2835/raspberrypi-firmware.h | 3 +++
1 file changed, 3 insertions(+)
--- a/include/soc/bcm2835/raspberrypi-firmware.h
+++ b/include/soc/bcm2835/raspberrypi-firmware.h
@@ -9,6 +9,8 @@
#include <linux/types.h>
#include <linux/of_device.h>
+#define RPI_FIRMWARE_CHAN_FB 1
+
struct rpi_firmware;
enum rpi_firmware_property_status {
@@ -161,5 +163,6 @@ static inline struct rpi_firmware *rpi_f
return NULL;
}
#endif
+int rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data);
#endif /* __SOC_RASPBERRY_FIRMWARE_H__ */

View File

@ -1,25 +0,0 @@
From a432a3f7142e7e76fd1708debe509ffbea3a3658 Mon Sep 17 00:00:00 2001
From: Eric Anholt <eric@anholt.net>
Date: Thu, 18 Dec 2014 16:07:15 -0800
Subject: [PATCH] mm: Remove the PFN busy warning
See commit dae803e165a11bc88ca8dbc07a11077caf97bbcb -- the warning is
expected sometimes when using CMA. However, that commit still spams
my kernel log with these warnings.
Signed-off-by: Eric Anholt <eric@anholt.net>
---
mm/page_alloc.c | 2 --
1 file changed, 2 deletions(-)
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -8603,8 +8603,6 @@ int alloc_contig_range(unsigned long sta
/* Make sure the range is really isolated. */
if (test_pages_isolated(outer_start, end, 0)) {
- pr_info_ratelimited("%s: [%lx, %lx) PFNs busy\n",
- __func__, outer_start, end);
ret = -EBUSY;
goto done;
}

View File

@ -1,85 +0,0 @@
From 28c2408f991d97de5e3d1da9711cf5486f411d02 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Thu, 11 Jul 2019 13:13:39 +0100
Subject: [PATCH] tty: amba-pl011: Make TX optimisation conditional
pl011_tx_chars takes a "from_irq" parameter to reduce the number of
register accesses. When from_irq is true the function assumes that the
FIFO is half empty and writes up to half a FIFO's worth of bytes
without polling the FIFO status register, the reasoning being that
the function is being called as a result of the TX interrupt being
raised. This logic would work were it not for the fact that
pl011_rx_chars, called from pl011_int before pl011_tx_chars, releases
the spinlock before calling tty_flip_buffer_push.
A user thread writing to the UART claims the spinlock and ultimately
calls pl011_tx_chars with from_irq set to false. This reverts to the
older logic that polls the FIFO status register before sending every
byte. If this happen on an SMP system during the section of the IRQ
handler where the spinlock has been released, then by the time the TX
interrupt handler is called, the FIFO may already be full, and any
further writes are likely to be lost.
The fix involves adding a per-port flag that is true iff running from
within the interrupt handler and the spinlock has not yet been released.
This flag is then used as the value for the from_irq parameter of
pl011_tx_chars, causing polling to be used in the unsafe case.
Fixes: 1e84d22322ce ("serial/amba-pl011: Refactor and simplify TX FIFO handling")
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
drivers/tty/serial/amba-pl011.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -265,6 +265,7 @@ struct uart_amba_port {
unsigned int old_cr; /* state during shutdown */
unsigned int fixed_baud; /* vendor-set fixed baud rate */
char type[12];
+ bool irq_locked; /* in irq, unreleased lock */
#ifdef CONFIG_DMA_ENGINE
/* DMA stuff */
bool using_tx_dma;
@@ -811,6 +812,7 @@ __acquires(&uap->port.lock)
if (!uap->using_tx_dma)
return;
+ uap->irq_locked = 0;
dmaengine_terminate_async(uap->dmatx.chan);
if (uap->dmatx.queued) {
@@ -937,6 +939,7 @@ static void pl011_dma_rx_chars(struct ua
fifotaken = pl011_fifo_to_tty(uap);
}
+ uap->irq_locked = 0;
spin_unlock(&uap->port.lock);
dev_vdbg(uap->port.dev,
"Took %d chars from DMA buffer and %d chars from the FIFO\n",
@@ -1341,6 +1344,7 @@ __acquires(&uap->port.lock)
{
pl011_fifo_to_tty(uap);
+ uap->irq_locked = 0;
spin_unlock(&uap->port.lock);
tty_flip_buffer_push(&uap->port.state->port);
/*
@@ -1474,6 +1478,7 @@ static irqreturn_t pl011_int(int irq, vo
int handled = 0;
spin_lock_irqsave(&uap->port.lock, flags);
+ uap->irq_locked = 1;
status = pl011_read(uap, REG_RIS) & uap->im;
if (status) {
do {
@@ -1493,7 +1498,7 @@ static irqreturn_t pl011_int(int irq, vo
UART011_CTSMIS|UART011_RIMIS))
pl011_modem_status(uap);
if (status & UART011_TXIS)
- pl011_tx_chars(uap, true);
+ pl011_tx_chars(uap, uap->irq_locked);
if (pass_counter-- == 0)
break;

View File

@ -1,22 +0,0 @@
From 68ef623a719071e05f5d62270c7bee35a2984452 Mon Sep 17 00:00:00 2001
From: notro <notro@tronnes.org>
Date: Thu, 10 Jul 2014 13:59:47 +0200
Subject: [PATCH] pinctrl-bcm2835: Set base to 0 give expected gpio
numbering
Signed-off-by: Noralf Tronnes <notro@tronnes.org>
---
drivers/pinctrl/bcm/pinctrl-bcm2835.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
@@ -362,7 +362,7 @@ static const struct gpio_chip bcm2835_gp
.get = bcm2835_gpio_get,
.set = bcm2835_gpio_set,
.set_config = gpiochip_generic_config,
- .base = -1,
+ .base = 0,
.ngpio = BCM2835_NUM_GPIOS,
.can_sleep = false,
};

View File

@ -1,46 +0,0 @@
From 4be98b29d123fc7615ea8404fbda450ec8acb084 Mon Sep 17 00:00:00 2001
From: Joerg Schambacher <joerg@i2audio.com>
Date: Fri, 16 Oct 2020 15:17:07 +0200
Subject: [PATCH] Fixes a problem when module probes before i2c module
is available
The driver crashed while a NULL pointer returned by i2c_get_adapter()
has been used to access the i2c bus functions.
The headphone probing function hb_hp_probe() now returns -EPROBE_DEFER
in case the i2c module has not been loaded yet.
Signed-off-by: Joerg Schambacher <joerg@i2audio.com>
---
sound/soc/bcm/hifiberry_dacplus.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
--- a/sound/soc/bcm/hifiberry_dacplus.c
+++ b/sound/soc/bcm/hifiberry_dacplus.c
@@ -315,12 +315,14 @@ static int hb_hp_detect(void)
{
struct i2c_adapter *adap = i2c_get_adapter(1);
int ret;
-
struct i2c_client tpa_i2c_client = {
.addr = 0x60,
.adapter = adap,
};
+ if (!adap)
+ return -EPROBE_DEFER; /* I2C module not yet available */
+
ret = i2c_smbus_read_byte(&tpa_i2c_client) >= 0;
i2c_put_adapter(adap);
return ret;
@@ -342,7 +344,10 @@ static int snd_rpi_hifiberry_dacplus_pro
struct of_changeset ocs;
/* probe for head phone amp */
- if (hb_hp_detect()) {
+ ret = hb_hp_detect();
+ if (ret < 0)
+ return ret;
+ if (ret) {
card->aux_dev = hifiberry_dacplus_aux_devs;
card->num_aux_devs =
ARRAY_SIZE(hifiberry_dacplus_aux_devs);

View File

@ -1,32 +0,0 @@
From 9cf689eda644ccba0c80982cbd821c9163f5de39 Mon Sep 17 00:00:00 2001
From: Eric Anholt <eric@anholt.net>
Date: Wed, 14 Sep 2016 09:16:19 +0100
Subject: [PATCH] raspberrypi-firmware: Export the general transaction
function.
The vc4-firmware-kms module is going to be doing the MBOX FB call.
Signed-off-by: Eric Anholt <eric@anholt.net>
---
drivers/firmware/raspberrypi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/firmware/raspberrypi.c
+++ b/drivers/firmware/raspberrypi.c
@@ -46,7 +46,7 @@ static void response_callback(struct mbo
* Sends a request to the firmware through the BCM2835 mailbox driver,
* and synchronously waits for the reply.
*/
-static int
+int
rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data)
{
u32 message = MBOX_MSG(chan, data);
@@ -71,6 +71,7 @@ rpi_firmware_transaction(struct rpi_firm
return ret;
}
+EXPORT_SYMBOL_GPL(rpi_firmware_transaction);
/**
* rpi_firmware_property_list - Submit firmware property list

View File

@ -1,21 +0,0 @@
From 781bfd769e192aa39ef93fa37c812af444a9cf93 Mon Sep 17 00:00:00 2001
From: hdoverobinson <hdoverobinson@gmail.com>
Date: Tue, 13 Mar 2018 06:58:39 -0400
Subject: [PATCH] added capture_clear option to pps-gpio via dtoverlay
(#2433)
---
drivers/pps/clients/pps-gpio.c | 2 ++
1 file changed, 2 insertions(+)
--- a/drivers/pps/clients/pps-gpio.c
+++ b/drivers/pps/clients/pps-gpio.c
@@ -145,6 +145,8 @@ static int pps_gpio_setup(struct platfor
if (of_property_read_bool(np, "assert-falling-edge"))
data->assert_falling_edge = true;
+ if (of_property_read_bool(np, "capture-clear"))
+ data->capture_clear = true;
return 0;
}

View File

@ -1,581 +0,0 @@
From 079bce6210d997fda44d6143b4b394173360bef1 Mon Sep 17 00:00:00 2001
From: Serge Schneider <serge@raspberrypi.org>
Date: Mon, 9 Jul 2018 12:54:25 +0100
Subject: [PATCH] Add rpi-poe-fan driver
Signed-off-by: Serge Schneider <serge@raspberrypi.org>
PoE HAT driver cleanup
* Fix undeclared variable in rpi_poe_fan_suspend
* Add SPDX-License-Identifier
* Expand PoE acronym in Kconfig help
* Give clearer error message on of_property_count_u32_elems fail
* Add documentation
* Add vendor to of_device_id compatible string.
* Rename m_data_s struct to fw_data_s
* Fix typos
Fixes: #2665
Signed-off-by: Serge Schneider <serge@raspberrypi.org>
rpi-poe-fan: fix def_pwm1 writes
Signed-off-by: Serge Schneider <serge@raspberrypi.org>
---
.../devicetree/bindings/hwmon/rpi-poe-fan.txt | 55 +++
Documentation/hwmon/rpi-poe-fan | 15 +
drivers/hwmon/Kconfig | 11 +
drivers/hwmon/Makefile | 1 +
drivers/hwmon/rpi-poe-fan.c | 436 ++++++++++++++++++
5 files changed, 518 insertions(+)
create mode 100644 Documentation/devicetree/bindings/hwmon/rpi-poe-fan.txt
create mode 100644 Documentation/hwmon/rpi-poe-fan
create mode 100644 drivers/hwmon/rpi-poe-fan.c
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/rpi-poe-fan.txt
@@ -0,0 +1,55 @@
+Bindings for the Raspberry Pi PoE HAT fan
+
+Required properties:
+- compatible : "raspberrypi,rpi-poe-fan"
+- firmware : Reference to the RPi firmware device node
+- pwms : the PWM that is used to control the PWM fan
+- cooling-levels : PWM duty cycle values in a range from 0 to 255
+ which correspond to thermal cooling states
+
+Example:
+ fan0: rpi-poe-fan@0 {
+ compatible = "raspberrypi,rpi-poe-fan";
+ firmware = <&firmware>;
+ cooling-min-state = <0>;
+ cooling-max-state = <3>;
+ #cooling-cells = <2>;
+ cooling-levels = <0 50 150 255>;
+ status = "okay";
+ };
+
+ thermal-zones {
+ cpu_thermal: cpu-thermal {
+ trips {
+ threshold: trip-point@0 {
+ temperature = <45000>;
+ hysteresis = <5000>;
+ type = "active";
+ };
+ target: trip-point@1 {
+ temperature = <50000>;
+ hysteresis = <2000>;
+ type = "active";
+ };
+ cpu_hot: cpu_hot@0 {
+ temperature = <55000>;
+ hysteresis = <2000>;
+ type = "active";
+ };
+ };
+ cooling-maps {
+ map0 {
+ trip = <&threshold>;
+ cooling-device = <&fan0 0 1>;
+ };
+ map1 {
+ trip = <&target>;
+ cooling-device = <&fan0 1 2>;
+ };
+ map2 {
+ trip = <&cpu_hot>;
+ cooling-device = <&fan0 2 3>;
+ };
+ };
+ };
+ };
--- /dev/null
+++ b/Documentation/hwmon/rpi-poe-fan
@@ -0,0 +1,15 @@
+Kernel driver rpi-poe-fan
+=====================
+
+This driver enables the use of the Raspberry Pi PoE HAT fan.
+
+Author: Serge Schneider <serge@raspberrypi.org>
+
+Description
+-----------
+
+The driver implements a simple interface for driving the Raspberry Pi PoE
+(Power over Ethernet) HAT fan. The driver passes commands to the Raspberry Pi
+firmware through the mailbox property interface. The firmware then forwards
+the commands to the board over I2C on the ID_EEPROM pins. The driver exposes
+the fan to the user space through the hwmon sysfs interface.
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -1489,6 +1489,17 @@ config SENSORS_RASPBERRYPI_HWMON
This driver can also be built as a module. If so, the module
will be called raspberrypi-hwmon.
+config SENSORS_RPI_POE_FAN
+ tristate "Raspberry Pi PoE HAT fan"
+ depends on RASPBERRYPI_FIRMWARE
+ depends on THERMAL || THERMAL=n
+ help
+ If you say yes here you get support for Raspberry Pi PoE (Power over
+ Ethernet) HAT fan.
+
+ This driver can also be built as a module. If so, the module
+ will be called rpi-poe-fan.
+
config SENSORS_SL28CPLD
tristate "Kontron sl28cpld hardware monitoring driver"
depends on MFD_SL28CPLD || COMPILE_TEST
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -157,6 +157,7 @@ obj-$(CONFIG_SENSORS_PCF8591) += pcf8591
obj-$(CONFIG_SENSORS_POWR1220) += powr1220.o
obj-$(CONFIG_SENSORS_PWM_FAN) += pwm-fan.o
obj-$(CONFIG_SENSORS_RASPBERRYPI_HWMON) += raspberrypi-hwmon.o
+obj-$(CONFIG_SENSORS_RPI_POE_FAN) += rpi-poe-fan.o
obj-$(CONFIG_SENSORS_S3C) += s3c-hwmon.o
obj-$(CONFIG_SENSORS_SCH56XX_COMMON)+= sch56xx-common.o
obj-$(CONFIG_SENSORS_SCH5627) += sch5627.o
--- /dev/null
+++ b/drivers/hwmon/rpi-poe-fan.c
@@ -0,0 +1,436 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * rpi-poe-fan.c - Hwmon driver for Raspberry Pi PoE HAT fan.
+ *
+ * Copyright (C) 2018 Raspberry Pi (Trading) Ltd.
+ * Based on pwm-fan.c by Kamil Debski <k.debski@samsung.com>
+ *
+ * Author: Serge Schneider <serge@raspberrypi.org>
+ */
+
+#include <linux/hwmon.h>
+#include <linux/hwmon-sysfs.h>
+#include <linux/module.h>
+#include <linux/mutex.h>
+#include <linux/notifier.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/reboot.h>
+#include <linux/sysfs.h>
+#include <linux/thermal.h>
+#include <soc/bcm2835/raspberrypi-firmware.h>
+
+#define MAX_PWM 255
+
+#define POE_CUR_PWM 0x0
+#define POE_DEF_PWM 0x1
+
+struct rpi_poe_fan_ctx {
+ struct mutex lock;
+ struct rpi_firmware *fw;
+ unsigned int pwm_value;
+ unsigned int def_pwm_value;
+ unsigned int rpi_poe_fan_state;
+ unsigned int rpi_poe_fan_max_state;
+ unsigned int *rpi_poe_fan_cooling_levels;
+ struct thermal_cooling_device *cdev;
+ struct notifier_block nb;
+};
+
+struct fw_tag_data_s{
+ u32 reg;
+ u32 val;
+ u32 ret;
+};
+
+static int write_reg(struct rpi_firmware *fw, u32 reg, u32 *val){
+ struct fw_tag_data_s fw_tag_data = {
+ .reg = reg,
+ .val = *val
+ };
+ int ret;
+ ret = rpi_firmware_property(fw, RPI_FIRMWARE_SET_POE_HAT_VAL,
+ &fw_tag_data, sizeof(fw_tag_data));
+ if (ret) {
+ return ret;
+ } else if (fw_tag_data.ret) {
+ return -EIO;
+ }
+ return 0;
+}
+
+static int read_reg(struct rpi_firmware *fw, u32 reg, u32 *val){
+ struct fw_tag_data_s fw_tag_data = {
+ .reg = reg,
+ };
+ int ret;
+ ret = rpi_firmware_property(fw, RPI_FIRMWARE_GET_POE_HAT_VAL,
+ &fw_tag_data, sizeof(fw_tag_data));
+ if (ret) {
+ return ret;
+ } else if (fw_tag_data.ret) {
+ return -EIO;
+ }
+ *val = fw_tag_data.val;
+ return 0;
+}
+
+static int rpi_poe_reboot(struct notifier_block *nb, unsigned long code,
+ void *unused)
+{
+ struct rpi_poe_fan_ctx *ctx = container_of(nb, struct rpi_poe_fan_ctx,
+ nb);
+
+ if (ctx->pwm_value != ctx->def_pwm_value)
+ write_reg(ctx->fw, POE_CUR_PWM, &ctx->def_pwm_value);
+
+ return NOTIFY_DONE;
+}
+
+static int __set_pwm(struct rpi_poe_fan_ctx *ctx, u32 pwm)
+{
+ int ret = 0;
+
+ mutex_lock(&ctx->lock);
+ if (ctx->pwm_value == pwm)
+ goto exit_set_pwm_err;
+
+ ret = write_reg(ctx->fw, POE_CUR_PWM, &pwm);
+ if (!ret)
+ ctx->pwm_value = pwm;
+exit_set_pwm_err:
+ mutex_unlock(&ctx->lock);
+ return ret;
+}
+
+static int __set_def_pwm(struct rpi_poe_fan_ctx *ctx, u32 def_pwm)
+{
+ int ret = 0;
+ mutex_lock(&ctx->lock);
+ if (ctx->def_pwm_value == def_pwm)
+ goto exit_set_def_pwm_err;
+
+ ret = write_reg(ctx->fw, POE_DEF_PWM, &def_pwm);
+ if (!ret)
+ ctx->def_pwm_value = def_pwm;
+exit_set_def_pwm_err:
+ mutex_unlock(&ctx->lock);
+ return ret;
+}
+
+static void rpi_poe_fan_update_state(struct rpi_poe_fan_ctx *ctx,
+ unsigned long pwm)
+{
+ int i;
+
+ for (i = 0; i < ctx->rpi_poe_fan_max_state; ++i)
+ if (pwm < ctx->rpi_poe_fan_cooling_levels[i + 1])
+ break;
+
+ ctx->rpi_poe_fan_state = i;
+}
+
+static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct rpi_poe_fan_ctx *ctx = dev_get_drvdata(dev);
+ unsigned long pwm;
+ int ret;
+
+ if (kstrtoul(buf, 10, &pwm) || pwm > MAX_PWM)
+ return -EINVAL;
+
+ ret = __set_pwm(ctx, pwm);
+ if (ret)
+ return ret;
+
+ rpi_poe_fan_update_state(ctx, pwm);
+ return count;
+}
+
+static ssize_t set_def_pwm(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct rpi_poe_fan_ctx *ctx = dev_get_drvdata(dev);
+ unsigned long def_pwm;
+ int ret;
+
+ if (kstrtoul(buf, 10, &def_pwm) || def_pwm > MAX_PWM)
+ return -EINVAL;
+
+ ret = __set_def_pwm(ctx, def_pwm);
+ if (ret)
+ return ret;
+ return count;
+}
+
+static ssize_t show_pwm(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct rpi_poe_fan_ctx *ctx = dev_get_drvdata(dev);
+
+ return sprintf(buf, "%u\n", ctx->pwm_value);
+}
+
+static ssize_t show_def_pwm(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct rpi_poe_fan_ctx *ctx = dev_get_drvdata(dev);
+
+ return sprintf(buf, "%u\n", ctx->def_pwm_value);
+}
+
+
+static SENSOR_DEVICE_ATTR(pwm1, 0644, show_pwm, set_pwm, 0);
+static SENSOR_DEVICE_ATTR(def_pwm1, 0644, show_def_pwm, set_def_pwm, 1);
+
+static struct attribute *rpi_poe_fan_attrs[] = {
+ &sensor_dev_attr_pwm1.dev_attr.attr,
+ &sensor_dev_attr_def_pwm1.dev_attr.attr,
+ NULL,
+};
+
+ATTRIBUTE_GROUPS(rpi_poe_fan);
+
+/* thermal cooling device callbacks */
+static int rpi_poe_fan_get_max_state(struct thermal_cooling_device *cdev,
+ unsigned long *state)
+{
+ struct rpi_poe_fan_ctx *ctx = cdev->devdata;
+
+ if (!ctx)
+ return -EINVAL;
+
+ *state = ctx->rpi_poe_fan_max_state;
+
+ return 0;
+}
+
+static int rpi_poe_fan_get_cur_state(struct thermal_cooling_device *cdev,
+ unsigned long *state)
+{
+ struct rpi_poe_fan_ctx *ctx = cdev->devdata;
+
+ if (!ctx)
+ return -EINVAL;
+
+ *state = ctx->rpi_poe_fan_state;
+
+ return 0;
+}
+
+static int rpi_poe_fan_set_cur_state(struct thermal_cooling_device *cdev,
+ unsigned long state)
+{
+ struct rpi_poe_fan_ctx *ctx = cdev->devdata;
+ int ret;
+
+ if (!ctx || (state > ctx->rpi_poe_fan_max_state))
+ return -EINVAL;
+
+ if (state == ctx->rpi_poe_fan_state)
+ return 0;
+
+ ret = __set_pwm(ctx, ctx->rpi_poe_fan_cooling_levels[state]);
+ if (ret) {
+ dev_err(&cdev->device, "Cannot set pwm!\n");
+ return ret;
+ }
+
+ ctx->rpi_poe_fan_state = state;
+
+ return ret;
+}
+
+static const struct thermal_cooling_device_ops rpi_poe_fan_cooling_ops = {
+ .get_max_state = rpi_poe_fan_get_max_state,
+ .get_cur_state = rpi_poe_fan_get_cur_state,
+ .set_cur_state = rpi_poe_fan_set_cur_state,
+};
+
+static int rpi_poe_fan_of_get_cooling_data(struct device *dev,
+ struct rpi_poe_fan_ctx *ctx)
+{
+ struct device_node *np = dev->of_node;
+ int num, i, ret;
+
+ if (!of_find_property(np, "cooling-levels", NULL))
+ return 0;
+
+ ret = of_property_count_u32_elems(np, "cooling-levels");
+ if (ret <= 0) {
+ dev_err(dev, "cooling-levels property missing or invalid: %d\n",
+ ret);
+ return ret ? : -EINVAL;
+ }
+
+ num = ret;
+ ctx->rpi_poe_fan_cooling_levels = devm_kzalloc(dev, num * sizeof(u32),
+ GFP_KERNEL);
+ if (!ctx->rpi_poe_fan_cooling_levels)
+ return -ENOMEM;
+
+ ret = of_property_read_u32_array(np, "cooling-levels",
+ ctx->rpi_poe_fan_cooling_levels, num);
+ if (ret) {
+ dev_err(dev, "Property 'cooling-levels' cannot be read!\n");
+ return ret;
+ }
+
+ for (i = 0; i < num; i++) {
+ if (ctx->rpi_poe_fan_cooling_levels[i] > MAX_PWM) {
+ dev_err(dev, "PWM fan state[%d]:%d > %d\n", i,
+ ctx->rpi_poe_fan_cooling_levels[i], MAX_PWM);
+ return -EINVAL;
+ }
+ }
+
+ ctx->rpi_poe_fan_max_state = num - 1;
+
+ return 0;
+}
+
+static int rpi_poe_fan_probe(struct platform_device *pdev)
+{
+ struct thermal_cooling_device *cdev;
+ struct rpi_poe_fan_ctx *ctx;
+ struct device *hwmon;
+ struct device_node *np = pdev->dev.of_node;
+ struct device_node *fw_node;
+ int ret;
+
+ fw_node = of_parse_phandle(np, "firmware", 0);
+ if (!fw_node) {
+ dev_err(&pdev->dev, "Missing firmware node\n");
+ return -ENOENT;
+ }
+
+ ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
+ if (!ctx)
+ return -ENOMEM;
+
+ mutex_init(&ctx->lock);
+
+ ctx->fw = rpi_firmware_get(fw_node);
+ if (!ctx->fw)
+ return -EPROBE_DEFER;
+
+ platform_set_drvdata(pdev, ctx);
+
+ ctx->nb.notifier_call = rpi_poe_reboot;
+ ret = register_reboot_notifier(&ctx->nb);
+ if (ret) {
+ dev_err(&pdev->dev, "Failed to register reboot notifier: %i\n",
+ ret);
+ return ret;
+ }
+ ret = read_reg(ctx->fw, POE_DEF_PWM, &ctx->def_pwm_value);
+ if (ret) {
+ dev_err(&pdev->dev, "Failed to get default PWM value: %i\n",
+ ret);
+ goto err;
+ }
+ ret = read_reg(ctx->fw, POE_CUR_PWM, &ctx->pwm_value);
+ if (ret) {
+ dev_err(&pdev->dev, "Failed to get current PWM value: %i\n",
+ ret);
+ goto err;
+ }
+
+ hwmon = devm_hwmon_device_register_with_groups(&pdev->dev, "rpipoefan",
+ ctx, rpi_poe_fan_groups);
+ if (IS_ERR(hwmon)) {
+ dev_err(&pdev->dev, "Failed to register hwmon device\n");
+ ret = PTR_ERR(hwmon);
+ goto err;
+ }
+
+ ret = rpi_poe_fan_of_get_cooling_data(&pdev->dev, ctx);
+ if (ret)
+ return ret;
+
+ rpi_poe_fan_update_state(ctx, ctx->pwm_value);
+ if (!IS_ENABLED(CONFIG_THERMAL))
+ return 0;
+
+ cdev = thermal_of_cooling_device_register(np,
+ "rpi-poe-fan", ctx,
+ &rpi_poe_fan_cooling_ops);
+ if (IS_ERR(cdev)) {
+ dev_err(&pdev->dev,
+ "Failed to register rpi-poe-fan as cooling device");
+ ret = PTR_ERR(cdev);
+ goto err;
+ }
+ ctx->cdev = cdev;
+ thermal_cdev_update(cdev);
+
+ return 0;
+err:
+ unregister_reboot_notifier(&ctx->nb);
+ return ret;
+}
+
+static int rpi_poe_fan_remove(struct platform_device *pdev)
+{
+ struct rpi_poe_fan_ctx *ctx = platform_get_drvdata(pdev);
+ u32 value = ctx->def_pwm_value;
+
+ unregister_reboot_notifier(&ctx->nb);
+ thermal_cooling_device_unregister(ctx->cdev);
+ if (ctx->pwm_value != value) {
+ write_reg(ctx->fw, POE_CUR_PWM, &value);
+ }
+ return 0;
+}
+
+#ifdef CONFIG_PM_SLEEP
+static int rpi_poe_fan_suspend(struct device *dev)
+{
+ struct rpi_poe_fan_ctx *ctx = dev_get_drvdata(dev);
+ u32 value = 0;
+ int ret = 0;
+
+ if (ctx->pwm_value != value)
+ ret = write_reg(ctx->fw, POE_CUR_PWM, &value);
+ return ret;
+}
+
+static int rpi_poe_fan_resume(struct device *dev)
+{
+ struct rpi_poe_fan_ctx *ctx = dev_get_drvdata(dev);
+ u32 value = ctx->pwm_value;
+ int ret = 0;
+
+ if (value != 0)
+ ret = write_reg(ctx->fw, POE_CUR_PWM, &value);
+
+ return ret;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(rpi_poe_fan_pm, rpi_poe_fan_suspend,
+ rpi_poe_fan_resume);
+
+static const struct of_device_id of_rpi_poe_fan_match[] = {
+ { .compatible = "raspberrypi,rpi-poe-fan", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, of_rpi_poe_fan_match);
+
+static struct platform_driver rpi_poe_fan_driver = {
+ .probe = rpi_poe_fan_probe,
+ .remove = rpi_poe_fan_remove,
+ .driver = {
+ .name = "rpi-poe-fan",
+ .pm = &rpi_poe_fan_pm,
+ .of_match_table = of_rpi_poe_fan_match,
+ },
+};
+
+module_platform_driver(rpi_poe_fan_driver);
+
+MODULE_AUTHOR("Serge Schneider <serge@raspberrypi.org>");
+MODULE_ALIAS("platform:rpi-poe-fan");
+MODULE_DESCRIPTION("Raspberry Pi PoE HAT fan driver");
+MODULE_LICENSE("GPL");

View File

@ -1,75 +0,0 @@
From f6e40957774cd71b4a8ce2190d94ef8e9b289938 Mon Sep 17 00:00:00 2001
From: Stefan Wahren <stefan.wahren@i2se.com>
Date: Sat, 6 Oct 2018 16:46:18 +0200
Subject: [PATCH] hwmon: raspberrypi: Prevent voltage low warnings from
filling log
Although the correct fix for low voltage warnings is to
improve the power supply, the current implementation
of the detection can fill the log if the warning
happens freqently. This replaces the logging with
slightly custom ratelimited logging.
Signed-off-by: James Hughes <james.hughes@raspberrypi.org>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
drivers/hwmon/raspberrypi-hwmon.c | 41 ++++++++++++++++++++++++++++---
1 file changed, 37 insertions(+), 4 deletions(-)
--- a/drivers/hwmon/raspberrypi-hwmon.c
+++ b/drivers/hwmon/raspberrypi-hwmon.c
@@ -15,6 +15,36 @@
#include <linux/workqueue.h>
#include <soc/bcm2835/raspberrypi-firmware.h>
+/*
+ * This section defines some rate limited logging that prevent
+ * repeated messages at much lower Hz than the default kernel settings.
+ * It's usually 5s, this is 5 minutes.
+ * Burst 3 means you may get three messages 'quickly', before
+ * the ratelimiting kicks in.
+ */
+#define LOCAL_RATELIMIT_INTERVAL (5 * 60 * HZ)
+#define LOCAL_RATELIMIT_BURST 3
+
+#ifdef CONFIG_PRINTK
+#define printk_ratelimited_local(fmt, ...) \
+({ \
+ static DEFINE_RATELIMIT_STATE(_rs, \
+ LOCAL_RATELIMIT_INTERVAL, \
+ LOCAL_RATELIMIT_BURST); \
+ \
+ if (__ratelimit(&_rs)) \
+ printk(fmt, ##__VA_ARGS__); \
+})
+#else
+#define printk_ratelimited_local(fmt, ...) \
+ no_printk(fmt, ##__VA_ARGS__)
+#endif
+
+#define pr_crit_ratelimited_local(fmt, ...) \
+ printk_ratelimited_local(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_info_ratelimited_local(fmt, ...) \
+printk_ratelimited_local(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
+
#define UNDERVOLTAGE_STICKY_BIT BIT(16)
struct rpi_hwmon_data {
@@ -47,10 +77,13 @@ static void rpi_firmware_get_throttled(s
if (new_uv == old_uv)
return;
- if (new_uv)
- dev_crit(data->hwmon_dev, "Undervoltage detected!\n");
- else
- dev_info(data->hwmon_dev, "Voltage normalised\n");
+ if (new_uv) {
+ pr_crit_ratelimited_local("Under-voltage detected! (0x%08x)\n",
+ value);
+ } else {
+ pr_info_ratelimited_local("Voltage normalised (0x%08x)\n",
+ value);
+ }
sysfs_notify(&data->hwmon_dev->kobj, NULL, "in0_lcrit_alarm");
}

View File

@ -1,47 +0,0 @@
From 3774310df4996e7ce45854ddb47a6cf969295f9d Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.org>
Date: Wed, 31 Oct 2018 14:55:37 +0000
Subject: [PATCH] media: ov5647: Add set_fmt and get_fmt calls.
There's no way to query the subdevice for the supported
resolutions.
Add set_fmt and get_fmt implementations.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
---
drivers/media/i2c/ov5647.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
--- a/drivers/media/i2c/ov5647.c
+++ b/drivers/media/i2c/ov5647.c
@@ -463,8 +463,30 @@ static int ov5647_enum_mbus_code(struct
return 0;
}
+static int ov5647_set_get_fmt(struct v4l2_subdev *sd,
+ struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_format *format)
+{
+ struct v4l2_mbus_framefmt *fmt = &format->format;
+
+ if (format->pad != 0)
+ return -EINVAL;
+
+ /* Only one format is supported, so return that */
+ memset(fmt, 0, sizeof(*fmt));
+ fmt->code = MEDIA_BUS_FMT_SBGGR8_1X8;
+ fmt->colorspace = V4L2_COLORSPACE_SRGB;
+ fmt->field = V4L2_FIELD_NONE;
+ fmt->width = 640;
+ fmt->height = 480;
+
+ return 0;
+}
+
static const struct v4l2_subdev_pad_ops ov5647_subdev_pad_ops = {
.enum_mbus_code = ov5647_enum_mbus_code,
+ .set_fmt = ov5647_set_get_fmt,
+ .get_fmt = ov5647_set_get_fmt,
};
static const struct v4l2_subdev_ops ov5647_subdev_ops = {

View File

@ -1,92 +0,0 @@
From 4b8d9d9c7f6d8f863669ce97ac299ca542ad6ecc Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.org>
Date: Wed, 31 Oct 2018 14:56:33 +0000
Subject: [PATCH] media: ov5647: Add support for PWDN GPIO.
Add support for an optional GPIO connected to PWDN on the sensor.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
---
drivers/media/i2c/ov5647.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
--- a/drivers/media/i2c/ov5647.c
+++ b/drivers/media/i2c/ov5647.c
@@ -21,6 +21,7 @@
#include <linux/clk.h>
#include <linux/delay.h>
+#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/io.h>
@@ -35,6 +36,13 @@
#define SENSOR_NAME "ov5647"
+/*
+ * From the datasheet, "20ms after PWDN goes low or 20ms after RESETB goes
+ * high if reset is inserted after PWDN goes high, host can access sensor's
+ * SCCB to initialize sensor."
+ */
+#define PWDN_ACTIVE_DELAY_MS 20
+
#define MIPI_CTRL00_CLOCK_LANE_GATE BIT(5)
#define MIPI_CTRL00_BUS_IDLE BIT(2)
#define MIPI_CTRL00_CLOCK_LANE_DISABLE BIT(0)
@@ -86,6 +94,7 @@ struct ov5647 {
unsigned int height;
int power_count;
struct clk *xclk;
+ struct gpio_desc *pwdn;
};
static inline struct ov5647 *to_state(struct v4l2_subdev *sd)
@@ -355,6 +364,11 @@ static int ov5647_sensor_power(struct v4
if (on && !ov5647->power_count) {
dev_dbg(&client->dev, "OV5647 power on\n");
+ if (ov5647->pwdn) {
+ gpiod_set_value(ov5647->pwdn, 0);
+ msleep(PWDN_ACTIVE_DELAY_MS);
+ }
+
ret = clk_prepare_enable(ov5647->xclk);
if (ret < 0) {
dev_err(&client->dev, "clk prepare enable failed\n");
@@ -392,6 +406,8 @@ static int ov5647_sensor_power(struct v4
dev_dbg(&client->dev, "soft stby failed\n");
clk_disable_unprepare(ov5647->xclk);
+
+ gpiod_set_value(ov5647->pwdn, 1);
}
/* Update the power count. */
@@ -603,6 +619,10 @@ static int ov5647_probe(struct i2c_clien
return -EINVAL;
}
+ /* Request the power down GPIO asserted */
+ sensor->pwdn = devm_gpiod_get_optional(&client->dev, "pwdn",
+ GPIOD_OUT_HIGH);
+
mutex_init(&sensor->lock);
sd = &sensor->sd;
@@ -616,7 +636,15 @@ static int ov5647_probe(struct i2c_clien
if (ret < 0)
goto mutex_remove;
+ if (sensor->pwdn) {
+ gpiod_set_value(sensor->pwdn, 0);
+ msleep(PWDN_ACTIVE_DELAY_MS);
+ }
+
ret = ov5647_detect(sd);
+
+ gpiod_set_value(sensor->pwdn, 1);
+
if (ret < 0)
goto error;

View File

@ -1,79 +0,0 @@
From f8ae99474d8555a30615db821c180a7d56b2e73c Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.org>
Date: Wed, 31 Oct 2018 14:56:47 +0000
Subject: [PATCH] media: ov5647: Add support for non-continuous clock
mode
The driver was only supporting continuous clock mode
although this was not stated anywhere.
Non-continuous clock saves a small amount of power and
on some SoCs is easier to interface with.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
---
drivers/media/i2c/ov5647.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
--- a/drivers/media/i2c/ov5647.c
+++ b/drivers/media/i2c/ov5647.c
@@ -44,6 +44,7 @@
#define PWDN_ACTIVE_DELAY_MS 20
#define MIPI_CTRL00_CLOCK_LANE_GATE BIT(5)
+#define MIPI_CTRL00_LINE_SYNC_ENABLE BIT(4)
#define MIPI_CTRL00_BUS_IDLE BIT(2)
#define MIPI_CTRL00_CLOCK_LANE_DISABLE BIT(0)
@@ -95,6 +96,7 @@ struct ov5647 {
int power_count;
struct clk *xclk;
struct gpio_desc *pwdn;
+ unsigned int flags;
};
static inline struct ov5647 *to_state(struct v4l2_subdev *sd)
@@ -269,9 +271,15 @@ static int ov5647_set_virtual_channel(st
static int ov5647_stream_on(struct v4l2_subdev *sd)
{
+ struct ov5647 *ov5647 = to_state(sd);
+ u8 val = MIPI_CTRL00_BUS_IDLE;
int ret;
- ret = ov5647_write(sd, OV5647_REG_MIPI_CTRL00, MIPI_CTRL00_BUS_IDLE);
+ if (ov5647->flags & V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK)
+ val |= MIPI_CTRL00_CLOCK_LANE_GATE |
+ MIPI_CTRL00_LINE_SYNC_ENABLE;
+
+ ret = ov5647_write(sd, OV5647_REG_MIPI_CTRL00, val);
if (ret < 0)
return ret;
@@ -568,7 +576,7 @@ static const struct v4l2_subdev_internal
.open = ov5647_open,
};
-static int ov5647_parse_dt(struct device_node *np)
+static int ov5647_parse_dt(struct device_node *np, struct ov5647 *sensor)
{
struct v4l2_fwnode_endpoint bus_cfg = { .bus_type = 0 };
struct device_node *ep;
@@ -581,6 +589,9 @@ static int ov5647_parse_dt(struct device
ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(ep), &bus_cfg);
+ if (!ret)
+ sensor->flags = bus_cfg.bus.mipi_csi2.flags;
+
of_node_put(ep);
return ret;
}
@@ -599,7 +610,7 @@ static int ov5647_probe(struct i2c_clien
return -ENOMEM;
if (IS_ENABLED(CONFIG_OF) && np) {
- ret = ov5647_parse_dt(np);
+ ret = ov5647_parse_dt(np, sensor);
if (ret) {
dev_err(dev, "DT parsing error: %d\n", ret);
return ret;

View File

@ -1,54 +0,0 @@
From 58f1758adcdbfd1cf556eb3cbb85b88ddcef0840 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.org>
Date: Tue, 18 Sep 2018 11:08:51 +0100
Subject: [PATCH] media: ov5647: Use gpiod_set_value_cansleep
All calls to the gpio library are in contexts that can sleep,
therefore there is no issue with having those GPIOs controlled
by controllers which require sleeping (eg I2C GPIO expanders).
Switch to using gpiod_set_value_cansleep instead of gpiod_set_value
to avoid triggering the warning in gpiolib should the GPIO
controller need to sleep.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
---
drivers/media/i2c/ov5647.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- a/drivers/media/i2c/ov5647.c
+++ b/drivers/media/i2c/ov5647.c
@@ -373,7 +373,7 @@ static int ov5647_sensor_power(struct v4
dev_dbg(&client->dev, "OV5647 power on\n");
if (ov5647->pwdn) {
- gpiod_set_value(ov5647->pwdn, 0);
+ gpiod_set_value_cansleep(ov5647->pwdn, 0);
msleep(PWDN_ACTIVE_DELAY_MS);
}
@@ -415,7 +415,7 @@ static int ov5647_sensor_power(struct v4
clk_disable_unprepare(ov5647->xclk);
- gpiod_set_value(ov5647->pwdn, 1);
+ gpiod_set_value_cansleep(ov5647->pwdn, 1);
}
/* Update the power count. */
@@ -648,13 +648,13 @@ static int ov5647_probe(struct i2c_clien
goto mutex_remove;
if (sensor->pwdn) {
- gpiod_set_value(sensor->pwdn, 0);
+ gpiod_set_value_cansleep(sensor->pwdn, 0);
msleep(PWDN_ACTIVE_DELAY_MS);
}
ret = ov5647_detect(sd);
- gpiod_set_value(sensor->pwdn, 1);
+ gpiod_set_value_cansleep(sensor->pwdn, 1);
if (ret < 0)
goto error;

View File

@ -1,46 +0,0 @@
From efc6e571660a0d0ca53fb603cc4f132481e8977f Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Fri, 2 Aug 2019 15:20:11 +0100
Subject: [PATCH] mmc: sdhci-iproc: Fix vmmc regulators on iProc
The Linux support for controlling card power via regulators appears to
be contentious. I would argue that the default behaviour is contrary to
the SDHCI spec - turning off the power writes a reserved value to the
SD Bus Voltage Select field of the Power Control Register, which
seems to kill the Arasan/iProc controller - but fortunately there is a
hook in sdhci_ops to override the behaviour. Borrow the implementation
from sdhci_arasan_set_power.
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
drivers/mmc/host/sdhci-iproc.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
--- a/drivers/mmc/host/sdhci-iproc.c
+++ b/drivers/mmc/host/sdhci-iproc.c
@@ -190,6 +190,17 @@ static unsigned int sdhci_iproc_bcm2711_
return 200000;
}
+static void sdhci_iproc_set_power(struct sdhci_host *host, unsigned char mode,
+ unsigned short vdd)
+{
+ if (!IS_ERR(host->mmc->supply.vmmc)) {
+ struct mmc_host *mmc = host->mmc;
+
+ mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
+ }
+ sdhci_set_power_noreg(host, mode, vdd);
+}
+
static const struct sdhci_ops sdhci_iproc_ops = {
.set_clock = sdhci_set_clock,
.get_max_clock = sdhci_iproc_get_max_clock,
@@ -207,6 +218,7 @@ static const struct sdhci_ops sdhci_ipro
.write_b = sdhci_iproc_writeb,
.set_clock = sdhci_set_clock,
.get_max_clock = sdhci_iproc_get_max_clock,
+ .set_power = sdhci_iproc_set_power,
.set_bus_width = sdhci_set_bus_width,
.reset = sdhci_reset,
.set_uhs_signaling = sdhci_set_uhs_signaling,

View File

@ -1,34 +0,0 @@
From e7398ddc64a8540bb016d653ff0bddfc0660f606 Mon Sep 17 00:00:00 2001
From: Eric Anholt <eric@anholt.net>
Date: Mon, 14 Jan 2019 14:47:57 -0800
Subject: [PATCH] drm/v3d: Hook up the runtime PM ops.
In translating the runtime PM code from vc4, I missed the ".pm"
assignment to actually connect them up. Fixes missing MMU setup if
runtime PM resets V3D.
Signed-off-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit ca197699af29baa8236c74c53d4904ca8957ee06)
---
drivers/gpu/drm/v3d/v3d_drv.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/gpu/drm/v3d/v3d_drv.c
+++ b/drivers/gpu/drm/v3d/v3d_drv.c
@@ -70,7 +70,7 @@ static int v3d_runtime_resume(struct dev
}
#endif
-static const struct dev_pm_ops v3d_v3d_pm_ops = {
+static const struct dev_pm_ops v3d_pm_ops = {
SET_RUNTIME_PM_OPS(v3d_runtime_suspend, v3d_runtime_resume, NULL)
};
@@ -356,6 +356,7 @@ static struct platform_driver v3d_platfo
.driver = {
.name = "v3d",
.of_match_table = v3d_of_match,
+ .pm = &v3d_pm_ops,
},
};

View File

@ -1,34 +0,0 @@
From 1c6c1ab42e61cdca555c85bdde5677b13b5cd5f3 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.org>
Date: Fri, 6 Sep 2019 15:04:51 +0100
Subject: [PATCH] v4l2: Add a Greyworld AWB mode.
Adds a simple greyworld white balance preset, mainly for use
with cameras without an IR filter (eg Raspberry Pi NoIR)
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
---
drivers/media/v4l2-core/v4l2-ctrls.c | 1 +
include/uapi/linux/v4l2-controls.h | 1 +
2 files changed, 2 insertions(+)
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -275,6 +275,7 @@ const char * const *v4l2_ctrl_get_menu(u
"Flash",
"Cloudy",
"Shade",
+ "Greyworld",
NULL,
};
static const char * const camera_iso_sensitivity_auto[] = {
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -886,6 +886,7 @@ enum v4l2_auto_n_preset_white_balance {
V4L2_WHITE_BALANCE_FLASH = 7,
V4L2_WHITE_BALANCE_CLOUDY = 8,
V4L2_WHITE_BALANCE_SHADE = 9,
+ V4L2_WHITE_BALANCE_GREYWORLD = 10,
};
#define V4L2_CID_WIDE_DYNAMIC_RANGE (V4L2_CID_CAMERA_CLASS_BASE+21)

View File

@ -1,36 +0,0 @@
From 39e3ab3e857a617b982dbeee2037f13edc46f799 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Mon, 23 Sep 2019 09:26:41 +0100
Subject: [PATCH] kbuild: Allow .dtbo overlays to be built piecemeal
Before 4.20, it was possible to build an arbitrary overlay by copying
it to arm/boot/dts/overlays/mytest-overlay.dts and running:
make ARCH=arm overlays/mytest.dtbo
In 4.20 the .dtb build rules were centralised, requiring the dowstream
.dtbo build rules to be changed. They were, enough to support "make ...
dtbs", but not sufficiently to allow this ad-hoc, one-off building of
individual files.
Add the missing makefile rule to support this way of building.
See: https://github.com/raspberrypi/linux/issues/3250
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
Makefile | 3 +++
1 file changed, 3 insertions(+)
--- a/Makefile
+++ b/Makefile
@@ -1354,6 +1354,9 @@ ifneq ($(dtstree),)
%.dtb: include/config/kernel.release scripts_dtc
$(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
+%.dtbo: prepare3 scripts_dtc
+ $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
+
PHONY += dtbs dtbs_install dtbs_check
dtbs: include/config/kernel.release scripts_dtc
$(Q)$(MAKE) $(build)=$(dtstree)

View File

@ -1,34 +0,0 @@
From 7372f1f8c151f752aa533eaf2b85ad9b21ec9639 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Mon, 11 Nov 2019 14:01:41 +0000
Subject: [PATCH] drm/v3d: Don't clear MMU control bits on exception
MMU exception conditions are reported in the V3D_MMU_CTRL register as
write-1-to-clear (W1C) bits. The MMU interrupt handling code clears any
exceptions, but does so by masking out any other bits and writing the
result back. There are some important control bits in that register,
including MMU_ENABLE, so a safer approach is to simply write back the
value just read unaltered.
This patch doesn't remove the cause of the apparent PTE errors, but it
does reduce the impact to just an error in the kernel log.
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
drivers/gpu/drm/v3d/v3d_irq.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
--- a/drivers/gpu/drm/v3d/v3d_irq.c
+++ b/drivers/gpu/drm/v3d/v3d_irq.c
@@ -178,10 +178,7 @@ v3d_hub_irq(int irq, void *arg)
};
const char *client = "?";
- V3D_WRITE(V3D_MMU_CTL,
- V3D_READ(V3D_MMU_CTL) & (V3D_MMU_CTL_CAP_EXCEEDED |
- V3D_MMU_CTL_PT_INVALID |
- V3D_MMU_CTL_WRITE_VIOLATION));
+ V3D_WRITE(V3D_MMU_CTL, V3D_READ(V3D_MMU_CTL));
if (v3d->ver >= 41) {
axi_id = axi_id >> 5;

View File

@ -1,24 +0,0 @@
From 7f729e862d5d0f6605874393af075a6aa8e98bd5 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Thu, 14 Nov 2019 11:59:01 +0000
Subject: [PATCH] net: bcmgenet: The second IRQ is optional
As of 5.4, the kernel logs errors for absent IRQs unless requested
with platform_get_irq_optional.
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
drivers/gpu/drm/v3d/v3d_irq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/gpu/drm/v3d/v3d_irq.c
+++ b/drivers/gpu/drm/v3d/v3d_irq.c
@@ -217,7 +217,7 @@ v3d_irq_init(struct v3d_dev *v3d)
V3D_CORE_WRITE(core, V3D_CTL_INT_CLR, V3D_CORE_IRQS);
V3D_WRITE(V3D_HUB_INT_CLR, V3D_HUB_IRQS);
- irq1 = platform_get_irq(v3d_to_pdev(v3d), 1);
+ irq1 = platform_get_irq_optional(v3d_to_pdev(v3d), 1);
if (irq1 == -EPROBE_DEFER)
return irq1;
if (irq1 > 0) {

View File

@ -1,46 +0,0 @@
From 3ab0c4b6aa76a4dedb51c4e800b5b4ba29187c46 Mon Sep 17 00:00:00 2001
From: James Hughes <james.hughes@raspberrypi.org>
Date: Thu, 31 Oct 2019 14:39:44 +0000
Subject: [PATCH] net:phy:2711 Allow ethernet LED mode to be set via
device tree
Add device tree entries and code to allow the specification of
the lighting modes for the LED's on the ethernet connector.
Signed-off-by: James Hughes <james.hughes@raspberrypi.org>
---
drivers/net/phy/broadcom.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -314,6 +314,9 @@ static void bcm54xx_adjust_rxrefclk(stru
static int bcm54xx_config_init(struct phy_device *phydev)
{
int reg, err, val;
+ u32 led_modes[] = {BCM_LED_MULTICOLOR_LINK_ACT,
+ BCM_LED_MULTICOLOR_LINK_ACT};
+ struct device_node *np = phydev->mdio.dev.of_node;
reg = phy_read(phydev, MII_BCM54XX_ECR);
if (reg < 0)
@@ -369,6 +372,8 @@ static int bcm54xx_config_init(struct ph
bcm54xx_phydsp_config(phydev);
+ of_property_read_u32_array(np, "led-modes", led_modes, 2);
+
/* Encode link speed into LED1 and LED3 pair (green/amber).
* Also flash these two LEDs on activity. This means configuring
* them for MULTICOLOR and encoding link/activity into them.
@@ -378,8 +383,8 @@ static int bcm54xx_config_init(struct ph
bcm_phy_write_shadow(phydev, BCM5482_SHD_LEDS1, val);
val = BCM_LED_MULTICOLOR_IN_PHASE |
- BCM5482_SHD_LEDS1_LED1(BCM_LED_MULTICOLOR_LINK_ACT) |
- BCM5482_SHD_LEDS1_LED3(BCM_LED_MULTICOLOR_LINK_ACT);
+ BCM5482_SHD_LEDS1_LED1(led_modes[0]) |
+ BCM5482_SHD_LEDS1_LED3(led_modes[1]);
bcm_phy_write_exp(phydev, BCM_EXP_MULTICOLOR, val);
return 0;

View File

@ -1,33 +0,0 @@
From 0534ec9429d41d9a00851444498f11b222d350b8 Mon Sep 17 00:00:00 2001
From: James Hughes <james.hughes@raspberrypi.org>
Date: Thu, 7 Nov 2019 14:59:59 +0000
Subject: [PATCH] net:phy:2711 Change the default ethernet LED actions
This should return default behaviour back to that of previous
releases.
---
drivers/net/phy/broadcom.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -315,7 +315,7 @@ static int bcm54xx_config_init(struct ph
{
int reg, err, val;
u32 led_modes[] = {BCM_LED_MULTICOLOR_LINK_ACT,
- BCM_LED_MULTICOLOR_LINK_ACT};
+ BCM_LED_MULTICOLOR_LINK};
struct device_node *np = phydev->mdio.dev.of_node;
reg = phy_read(phydev, MII_BCM54XX_ECR);
@@ -374,10 +374,6 @@ static int bcm54xx_config_init(struct ph
of_property_read_u32_array(np, "led-modes", led_modes, 2);
- /* Encode link speed into LED1 and LED3 pair (green/amber).
- * Also flash these two LEDs on activity. This means configuring
- * them for MULTICOLOR and encoding link/activity into them.
- */
val = BCM5482_SHD_LEDS1_LED1(BCM_LED_SRC_MULTICOLOR1) |
BCM5482_SHD_LEDS1_LED3(BCM_LED_SRC_MULTICOLOR1);
bcm_phy_write_shadow(phydev, BCM5482_SHD_LEDS1, val);

View File

@ -1,27 +0,0 @@
From 0a34bafa5816dd1425550968ff7d3de2dc955e6f Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Fri, 22 Nov 2019 16:23:32 +0000
Subject: [PATCH] drm/v3d: Set dma_mask as well as coherent_dma_mask
Both coherent_dma_mask and dma_mask act as constraints on allocations
and bounce buffer usage, so be sure to set dma_mask to the appropriate
value otherwise the effective mask could be incorrect.
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
drivers/gpu/drm/v3d/v3d_drv.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/gpu/drm/v3d/v3d_drv.c
+++ b/drivers/gpu/drm/v3d/v3d_drv.c
@@ -263,8 +263,8 @@ static int v3d_platform_drm_probe(struct
return ret;
mmu_debug = V3D_READ(V3D_MMU_DEBUG_INFO);
- dev->coherent_dma_mask =
- DMA_BIT_MASK(30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_PA_WIDTH));
+ dma_set_mask_and_coherent(dev,
+ DMA_BIT_MASK(30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_PA_WIDTH)));
v3d->va_width = 30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_VA_WIDTH);
ident1 = V3D_READ(V3D_HUB_IDENT1);

View File

@ -1,31 +0,0 @@
From 9ab71458b5475c7d8d42896721e593f6ef1a5c7a Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Tue, 25 Feb 2020 17:38:20 +0000
Subject: [PATCH] pinctrl: bcm2835: Accept fewer than expected IRQs
The downstream .dts files only request two GPIO IRQs. Truncate the
array of parent IRQs when irq_of_parse_and_map returns 0.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
drivers/pinctrl/bcm/pinctrl-bcm2835.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
@@ -1290,9 +1290,13 @@ static int bcm2835_pinctrl_probe(struct
char *name;
girq->parents[i] = irq_of_parse_and_map(np, i);
- if (!is_7211)
+ if (!is_7211) {
+ if (!girq->parents[i]) {
+ girq->num_parents = i;
+ break;
+ }
continue;
-
+ }
/* Skip over the all banks interrupts */
pc->wake_irq[i] = irq_of_parse_and_map(np, i +
BCM2835_NUM_IRQS + 1);

View File

@ -1,26 +0,0 @@
From 45ae2035e05d4519d86f1073a257dea3a920f484 Mon Sep 17 00:00:00 2001
From: Nataliya Korovkina <malus.brandywine@gmail.com>
Date: Thu, 12 Mar 2020 17:22:53 -0400
Subject: [PATCH] Kbuild: Allow .dtbo overlays to be built, adjust.
This is adjustment to commit
d368ceaacdccd7732dc97d1d7987bdf7149d62e3 "kbuild: Allow .dtbo overlays to be built piecemeal"
prepare3 target has gone from mainline tree in branch 5.4.y
Signed-off-by: Nataliya Korovkina <malus.brandywine@gmail.com>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/Makefile
+++ b/Makefile
@@ -1354,7 +1354,7 @@ ifneq ($(dtstree),)
%.dtb: include/config/kernel.release scripts_dtc
$(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
-%.dtbo: prepare3 scripts_dtc
+%.dtbo: include/config/kernel.release scripts_dtc
$(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
PHONY += dtbs dtbs_install dtbs_check

View File

@ -1,40 +0,0 @@
From cfbd02c5469513b6d28d9012b14d70baa44869c5 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Mon, 23 Mar 2020 19:00:17 +0000
Subject: [PATCH] media: uapi: Add hevc ctrls for WPP decoding
WPP can allow greater parallelism within the decode, but needs
offset information to be passed in.
Adds num_entry_point_offsets and entry_point_offset_minus1 to
v4l2_ctrl_hevc_slice_params.
This is based on Jernej Skrabec's patches for cedrus which
implement the same feature.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
include/media/hevc-ctrls.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/include/media/hevc-ctrls.h
+++ b/include/media/hevc-ctrls.h
@@ -170,6 +170,7 @@ struct v4l2_ctrl_hevc_slice_params {
/* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */
__u32 slice_segment_addr;
+ __u32 num_entry_point_offsets;
/* ISO/IEC 23008-2, ITU-T Rec. H.265: NAL unit header */
__u8 nal_unit_type;
@@ -204,7 +205,9 @@ struct v4l2_ctrl_hevc_slice_params {
__u8 num_rps_poc_st_curr_after;
__u8 num_rps_poc_lt_curr;
- __u8 padding[5];
+ __u8 padding;
+
+ __u32 entry_point_offset_minus1[256];
/* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */
struct v4l2_hevc_dpb_entry dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];

View File

@ -1,42 +0,0 @@
From 966a8df34ba0d98908dd381f27f6cfd615b3cb74 Mon Sep 17 00:00:00 2001
From: Maxime Ripard <maxime@cerno.tech>
Date: Fri, 6 Dec 2019 13:05:27 +0100
Subject: [PATCH] mmc: sdhci: Silence MMC warnings
When the MMC isn't plugged in, the driver will spam the console which is
pretty annoying when using NFS.
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
drivers/mmc/host/sdhci.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -41,7 +41,7 @@
pr_debug("%s: " DRIVER_NAME ": " f, mmc_hostname(host->mmc), ## x)
#define SDHCI_DUMP(f, x...) \
- pr_err("%s: " DRIVER_NAME ": " f, mmc_hostname(host->mmc), ## x)
+ pr_debug("%s: " DRIVER_NAME ": " f, mmc_hostname(host->mmc), ## x)
#define MAX_TUNING_LOOP 40
@@ -3145,7 +3145,7 @@ static void sdhci_timeout_timer(struct t
spin_lock_irqsave(&host->lock, flags);
if (host->cmd && !sdhci_data_line_cmd(host->cmd)) {
- pr_err("%s: Timeout waiting for hardware cmd interrupt.\n",
+ pr_debug("%s: Timeout waiting for hardware cmd interrupt.\n",
mmc_hostname(host->mmc));
sdhci_dumpregs(host);
@@ -3167,7 +3167,7 @@ static void sdhci_timeout_data_timer(str
if (host->data || host->data_cmd ||
(host->cmd && sdhci_data_line_cmd(host->cmd))) {
- pr_err("%s: Timeout waiting for hardware interrupt.\n",
+ pr_debug("%s: Timeout waiting for hardware interrupt.\n",
mmc_hostname(host->mmc));
sdhci_dumpregs(host);

View File

@ -1,24 +0,0 @@
From 987af76904b945d39b90e6a5294f8f2f691fb8fb Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Wed, 8 Apr 2020 11:59:39 +0100
Subject: [PATCH] overlays: Fix dtc warnings in i2c-gpio
Better late than never.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts | 3 +++
1 file changed, 3 insertions(+)
--- a/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts
+++ b/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts
@@ -11,6 +11,9 @@
target-path = "/";
__overlay__ {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
i2c_gpio: i2c@0 {
reg = <0xffffffff>;
compatible = "i2c-gpio";

View File

@ -1,32 +0,0 @@
From 4721459bb386bf32b2295b947f38b91cdd97929b Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Fri, 1 May 2020 17:56:13 +0100
Subject: [PATCH] overlays: Make the i2c-gpio overlay safe again
Like many overlays, the i2c-gpio overlay goes to efforts to avoid
generating warnings about #address-cells and #size-cells not
being defined, which it does by defining them. Unfortunately this
is fatal if they don't match what the system requires, and the
recent switch to #size-cells = 2 on 2711 made i2c-gpio very
dangerous.
In the absence of the knowledge of a clean way to fix this, just delete
the declarations and suffer the warnings.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts | 3 ---
1 file changed, 3 deletions(-)
--- a/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts
+++ b/arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts
@@ -11,9 +11,6 @@
target-path = "/";
__overlay__ {
- #address-cells = <1>;
- #size-cells = <0>;
-
i2c_gpio: i2c@0 {
reg = <0xffffffff>;
compatible = "i2c-gpio";

View File

@ -1,27 +0,0 @@
From 8a251d243fa3931f3b03677f4f58ceb728f42e99 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Mon, 20 Apr 2020 11:01:21 +0100
Subject: [PATCH] media: i2c: imx219: Declare that the driver can
create events
The flag V4L2_SUBDEV_FL_HAS_EVENTS is required if the subdev can
generate events. It can create events from the ctrl handler, therefore
this is required.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/imx219.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/media/i2c/imx219.c
+++ b/drivers/media/i2c/imx219.c
@@ -1591,7 +1591,8 @@ static int imx219_probe(struct i2c_clien
/* Initialize subdev */
imx219->sd.internal_ops = &imx219_internal_ops;
- imx219->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+ imx219->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
+ V4L2_SUBDEV_FL_HAS_EVENTS;
imx219->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
/* Initialize source pads */

View File

@ -1,407 +0,0 @@
From c3535af52b9f641565db400aab050298b786fcf3 Mon Sep 17 00:00:00 2001
From: David Plowman <david.plowman@raspberrypi.com>
Date: Wed, 29 Jan 2020 15:30:53 +0000
Subject: [PATCH] media: ov5647: Add basic support for multiple sensor
modes.
Specifically:
Added a structure ov5647_mode and a list of supported_modes (though no
actual new modes as yet). The state object points to the "current mode".
ov5647_enum_mbus_code, ov5647_enum_frame_size, ov5647_set_fmt and
ov5647_get_fmt all needed upgrading to cope with multiple modes.
__sensor_init (which writes all the registers) is now called by
ov5647_stream_on (once the mode is known) rather than by
ov5647_sensor_power.
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
---
drivers/media/i2c/ov5647.c | 268 ++++++++++++++++++++++++++++---------
1 file changed, 202 insertions(+), 66 deletions(-)
--- a/drivers/media/i2c/ov5647.c
+++ b/drivers/media/i2c/ov5647.c
@@ -86,13 +86,17 @@ struct regval_list {
u8 data;
};
+struct ov5647_mode {
+ struct v4l2_mbus_framefmt format;
+ struct regval_list *reg_list;
+ unsigned int num_regs;
+};
+
struct ov5647 {
struct v4l2_subdev sd;
struct media_pad pad;
struct mutex lock;
- struct v4l2_mbus_framefmt format;
- unsigned int width;
- unsigned int height;
+ const struct ov5647_mode *mode;
int power_count;
struct clk *xclk;
struct gpio_desc *pwdn;
@@ -207,6 +211,32 @@ static struct regval_list ov5647_640x480
{0x0100, 0x01},
};
+static struct ov5647_mode supported_modes_8bit[] = {
+ /*
+ * Original 8-bit VGA mode
+ * Uncentred crop (top left quarter) from 2x2 binned 1296x972 image.
+ */
+ {
+ {
+ .code = MEDIA_BUS_FMT_SBGGR8_1X8,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .field = V4L2_FIELD_NONE,
+ .width = 640,
+ .height = 480
+ },
+ ov5647_640x480,
+ ARRAY_SIZE(ov5647_640x480)
+ },
+ /* more modes below here... */
+};
+
+static struct ov5647_mode supported_modes_10bit[] = {
+ /* no 10-bit modes yet */
+};
+
+/* Use original 8-bit VGA mode as default. */
+#define OV5647_DEFAULT_MODE (&supported_modes_8bit[0])
+
static int ov5647_write(struct v4l2_subdev *sd, u16 reg, u8 val)
{
int ret;
@@ -293,12 +323,55 @@ static int ov5647_set_virtual_channel(st
return ov5647_write(sd, OV5647_REG_MIPI_CTRL14, channel_id | (channel << 6));
}
+static int __sensor_init(struct v4l2_subdev *sd)
+{
+ int ret;
+ u8 resetval, rdval;
+ struct i2c_client *client = v4l2_get_subdevdata(sd);
+ struct ov5647 *state = to_state(sd);
+
+ ret = ov5647_read(sd, OV5647_SW_STANDBY, &rdval);
+ if (ret < 0)
+ return ret;
+
+ ret = ov5647_write_array(sd, state->mode->reg_list,
+ state->mode->num_regs);
+ if (ret < 0) {
+ dev_err(&client->dev, "write sensor default regs error\n");
+ return ret;
+ }
+
+ ret = ov5647_set_virtual_channel(sd, 0);
+ if (ret < 0)
+ return ret;
+
+ ret = ov5647_read(sd, OV5647_SW_STANDBY, &resetval);
+ if (ret < 0)
+ return ret;
+
+ if (!(resetval & 0x01)) {
+ dev_err(&client->dev, "Device was in SW standby");
+ ret = ov5647_write(sd, OV5647_SW_STANDBY, 0x01);
+ if (ret < 0)
+ return ret;
+ }
+
+ return 0;
+}
+
static int ov5647_stream_on(struct v4l2_subdev *sd)
{
+ struct i2c_client *client = v4l2_get_subdevdata(sd);
struct ov5647 *ov5647 = to_state(sd);
u8 val = MIPI_CTRL00_BUS_IDLE;
int ret;
+ ret = __sensor_init(sd);
+ if (ret < 0) {
+ dev_err(&client->dev, "sensor_init failed\n");
+ return ret;
+ }
+
if (ov5647->flags & V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK)
val |= MIPI_CTRL00_CLOCK_LANE_GATE |
MIPI_CTRL00_LINE_SYNC_ENABLE;
@@ -347,44 +420,6 @@ static int set_sw_standby(struct v4l2_su
return ov5647_write(sd, OV5647_SW_STANDBY, rdval);
}
-static int __sensor_init(struct v4l2_subdev *sd)
-{
- int ret;
- u8 resetval, rdval;
- struct i2c_client *client = v4l2_get_subdevdata(sd);
-
- ret = ov5647_read(sd, OV5647_SW_STANDBY, &rdval);
- if (ret < 0)
- return ret;
-
- ret = ov5647_write_array(sd, ov5647_640x480,
- ARRAY_SIZE(ov5647_640x480));
- if (ret < 0) {
- dev_err(&client->dev, "write sensor default regs error\n");
- return ret;
- }
-
- ret = ov5647_set_virtual_channel(sd, 0);
- if (ret < 0)
- return ret;
-
- ret = ov5647_read(sd, OV5647_SW_STANDBY, &resetval);
- if (ret < 0)
- return ret;
-
- if (!(resetval & 0x01)) {
- dev_err(&client->dev, "Device was in SW standby");
- ret = ov5647_write(sd, OV5647_SW_STANDBY, 0x01);
- if (ret < 0)
- return ret;
- }
-
- /*
- * stream off to make the clock lane into LP-11 state.
- */
- return ov5647_stream_off(sd);
-}
-
static int ov5647_sensor_power(struct v4l2_subdev *sd, int on)
{
int ret = 0;
@@ -408,7 +443,7 @@ static int ov5647_sensor_power(struct v4
}
ret = ov5647_write_array(sd, sensor_oe_enable_regs,
- ARRAY_SIZE(sensor_oe_enable_regs));
+ ARRAY_SIZE(sensor_oe_enable_regs));
if (ret < 0) {
clk_disable_unprepare(ov5647->xclk);
dev_err(&client->dev,
@@ -416,7 +451,10 @@ static int ov5647_sensor_power(struct v4
goto out;
}
- ret = __sensor_init(sd);
+ /*
+ * Ensure streaming off to make clock lane go into LP-11 state.
+ */
+ ret = ov5647_stream_off(sd);
if (ret < 0) {
clk_disable_unprepare(ov5647->xclk);
dev_err(&client->dev,
@@ -427,7 +465,7 @@ static int ov5647_sensor_power(struct v4
dev_dbg(&client->dev, "OV5647 power off\n");
ret = ov5647_write_array(sd, sensor_oe_disable_regs,
- ARRAY_SIZE(sensor_oe_disable_regs));
+ ARRAY_SIZE(sensor_oe_disable_regs));
if (ret < 0)
dev_dbg(&client->dev, "disable oe failed\n");
@@ -489,10 +527,19 @@ static const struct v4l2_subdev_core_ops
static int ov5647_s_stream(struct v4l2_subdev *sd, int enable)
{
+ struct ov5647 *state = to_state(sd);
+ int ret = 0;
+
+ mutex_lock(&state->lock);
+
if (enable)
- return ov5647_stream_on(sd);
+ ret = ov5647_stream_on(sd);
else
- return ov5647_stream_off(sd);
+ ret = ov5647_stream_off(sd);
+
+ mutex_unlock(&state->lock);
+
+ return ret;
}
static const struct v4l2_subdev_video_ops ov5647_subdev_video_ops = {
@@ -503,38 +550,127 @@ static int ov5647_enum_mbus_code(struct
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_mbus_code_enum *code)
{
- if (code->index > 0)
+ if (code->index == 0 && ARRAY_SIZE(supported_modes_8bit))
+ code->code = MEDIA_BUS_FMT_SBGGR8_1X8;
+ else if (code->index == 0 && ARRAY_SIZE(supported_modes_8bit) == 0 &&
+ ARRAY_SIZE(supported_modes_10bit))
+ code->code = MEDIA_BUS_FMT_SBGGR10_1X10;
+ else if (code->index == 1 && ARRAY_SIZE(supported_modes_8bit) &&
+ ARRAY_SIZE(supported_modes_10bit))
+ code->code = MEDIA_BUS_FMT_SBGGR10_1X10;
+ else
return -EINVAL;
- code->code = MEDIA_BUS_FMT_SBGGR8_1X8;
+ return 0;
+}
+
+static int ov5647_enum_frame_size(struct v4l2_subdev *sd,
+ struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_frame_size_enum *fse)
+{
+ struct ov5647_mode *mode = NULL;
+
+ if (fse->code == MEDIA_BUS_FMT_SBGGR8_1X8) {
+ if (fse->index >= ARRAY_SIZE(supported_modes_8bit))
+ return -EINVAL;
+ mode = &supported_modes_8bit[fse->index];
+ } else if (fse->code == MEDIA_BUS_FMT_SBGGR10_1X10) {
+ if (fse->index >= ARRAY_SIZE(supported_modes_10bit))
+ return -EINVAL;
+ mode = &supported_modes_10bit[fse->index];
+ } else {
+ return -EINVAL;
+ }
+
+ fse->min_width = mode->format.width;
+ fse->max_width = fse->min_width;
+ fse->min_height = mode->format.height;
+ fse->max_height = fse->min_height;
+
+ return 0;
+}
+
+static int ov5647_set_fmt(struct v4l2_subdev *sd,
+ struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_format *format)
+{
+ struct v4l2_mbus_framefmt *fmt = &format->format;
+ struct ov5647 *state = to_state(sd);
+ struct v4l2_mbus_framefmt *framefmt;
+ const struct ov5647_mode *mode_8bit, *mode_10bit, *mode = NULL;
+
+ if (format->pad != 0)
+ return -EINVAL;
+
+ mutex_lock(&state->lock);
+
+ /*
+ * Try to respect any given pixel format, otherwise try for a 10-bit
+ * mode.
+ */
+ mode_8bit = v4l2_find_nearest_size(supported_modes_8bit,
+ ARRAY_SIZE(supported_modes_8bit),
+ format.width, format.height,
+ format->format.width,
+ format->format.height);
+ mode_10bit = v4l2_find_nearest_size(supported_modes_10bit,
+ ARRAY_SIZE(supported_modes_10bit),
+ format.width, format.height,
+ format->format.width,
+ format->format.height);
+ if (format->format.code == MEDIA_BUS_FMT_SBGGR8_1X8 && mode_8bit)
+ mode = mode_8bit;
+ else if (format->format.code == MEDIA_BUS_FMT_SBGGR10_1X10 &&
+ mode_10bit)
+ mode = mode_10bit;
+ else if (mode_10bit)
+ mode = mode_10bit;
+ else
+ mode = mode_8bit;
+
+ if (!mode)
+ return -EINVAL;
+
+ *fmt = mode->format;
+ if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
+ framefmt = v4l2_subdev_get_try_format(sd, cfg, format->pad);
+ *framefmt = format->format;
+ } else {
+ state->mode = mode;
+ }
+
+ mutex_unlock(&state->lock);
return 0;
}
-static int ov5647_set_get_fmt(struct v4l2_subdev *sd,
- struct v4l2_subdev_pad_config *cfg,
- struct v4l2_subdev_format *format)
+static int ov5647_get_fmt(struct v4l2_subdev *sd,
+ struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_format *format)
{
struct v4l2_mbus_framefmt *fmt = &format->format;
+ struct ov5647 *state = to_state(sd);
if (format->pad != 0)
return -EINVAL;
- /* Only one format is supported, so return that */
- memset(fmt, 0, sizeof(*fmt));
- fmt->code = MEDIA_BUS_FMT_SBGGR8_1X8;
- fmt->colorspace = V4L2_COLORSPACE_SRGB;
- fmt->field = V4L2_FIELD_NONE;
- fmt->width = 640;
- fmt->height = 480;
+ mutex_lock(&state->lock);
+
+ if (format->which == V4L2_SUBDEV_FORMAT_TRY)
+ *fmt = *v4l2_subdev_get_try_format(sd, cfg, format->pad);
+ else
+ *fmt = state->mode->format;
+
+ mutex_unlock(&state->lock);
return 0;
}
static const struct v4l2_subdev_pad_ops ov5647_subdev_pad_ops = {
.enum_mbus_code = ov5647_enum_mbus_code,
- .set_fmt = ov5647_set_get_fmt,
- .get_fmt = ov5647_set_get_fmt,
+ .set_fmt = ov5647_set_fmt,
+ .get_fmt = ov5647_get_fmt,
+ .enum_frame_size = ov5647_enum_frame_size,
};
static const struct v4l2_subdev_ops ov5647_subdev_ops = {
@@ -580,18 +716,15 @@ static int ov5647_open(struct v4l2_subde
v4l2_subdev_get_try_format(sd, fh->pad, 0);
struct v4l2_rect *crop =
v4l2_subdev_get_try_crop(sd, fh->pad, 0);
+ struct ov5647 *state = to_state(sd);
crop->left = OV5647_COLUMN_START_DEF;
crop->top = OV5647_ROW_START_DEF;
crop->width = OV5647_WINDOW_WIDTH_DEF;
crop->height = OV5647_WINDOW_HEIGHT_DEF;
- format->code = MEDIA_BUS_FMT_SBGGR8_1X8;
-
- format->width = OV5647_WINDOW_WIDTH_DEF;
- format->height = OV5647_WINDOW_HEIGHT_DEF;
- format->field = V4L2_FIELD_NONE;
- format->colorspace = V4L2_COLORSPACE_SRGB;
+ /* Set the default format to the same as the sensor. */
+ *format = state->mode->format;
return 0;
}
@@ -660,6 +793,9 @@ static int ov5647_probe(struct i2c_clien
mutex_init(&sensor->lock);
+ /* Set the default mode before we init the subdev */
+ sensor->mode = OV5647_DEFAULT_MODE;
+
sd = &sensor->sd;
v4l2_i2c_subdev_init(sd, client, &ov5647_subdev_ops);
sensor->sd.internal_ops = &ov5647_subdev_internal_ops;

View File

@ -1,277 +0,0 @@
From 0c212ccaa2e790de8eb43b2766767f2713f93915 Mon Sep 17 00:00:00 2001
From: David Plowman <david.plowman@raspberrypi.com>
Date: Wed, 29 Jan 2020 15:31:23 +0000
Subject: [PATCH] media: ov5647: Add V4L2 controls for analogue gain,
exposure and AWB
Added basic v4l2_ctrl_handler infrastructure (there was none
previously).
Added controls to let AWB/AEC/AGC run in the sensor's auto mode or
manually. Also controls to set exposure (in lines) and analogue gain
(as a register code) from user code.
Also delete registers (just the one) from the VGA mode register set
that are now controlled by the new V4L2 controls.
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
---
drivers/media/i2c/ov5647.c | 175 ++++++++++++++++++++++++++++++++++++-
1 file changed, 174 insertions(+), 1 deletion(-)
--- a/drivers/media/i2c/ov5647.c
+++ b/drivers/media/i2c/ov5647.c
@@ -29,11 +29,13 @@
#include <linux/of_graph.h>
#include <linux/slab.h>
#include <linux/videodev2.h>
+#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-image-sizes.h>
#include <media/v4l2-mediabus.h>
+
#define SENSOR_NAME "ov5647"
/*
@@ -53,9 +55,16 @@
#define OV5647_REG_CHIPID_H 0x300A
#define OV5647_REG_CHIPID_L 0x300B
#define OV5640_REG_PAD_OUT 0x300D
+#define OV5647_REG_EXP_HI 0x3500
+#define OV5647_REG_EXP_MID 0x3501
+#define OV5647_REG_EXP_LO 0x3502
+#define OV5647_REG_AEC_AGC 0x3503
+#define OV5647_REG_GAIN_HI 0x350A
+#define OV5647_REG_GAIN_LO 0x350B
#define OV5647_REG_FRAME_OFF_NUMBER 0x4202
#define OV5647_REG_MIPI_CTRL00 0x4800
#define OV5647_REG_MIPI_CTRL14 0x4814
+#define OV5647_REG_AWB 0x5001
#define REG_TERM 0xfffe
#define VAL_TERM 0xfe
@@ -101,6 +110,7 @@ struct ov5647 {
struct clk *xclk;
struct gpio_desc *pwdn;
unsigned int flags;
+ struct v4l2_ctrl_handler ctrls;
};
static inline struct ov5647 *to_state(struct v4l2_subdev *sd)
@@ -135,7 +145,6 @@ static struct regval_list ov5647_640x480
{0x3612, 0x59},
{0x3618, 0x00},
{0x5000, 0x06},
- {0x5001, 0x01},
{0x5002, 0x41},
{0x5003, 0x08},
{0x5a00, 0x08},
@@ -372,6 +381,11 @@ static int ov5647_stream_on(struct v4l2_
return ret;
}
+ /* Apply customized values from user when stream starts */
+ ret = __v4l2_ctrl_handler_setup(sd->ctrl_handler);
+ if (ret)
+ return ret;
+
if (ov5647->flags & V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK)
val |= MIPI_CTRL00_CLOCK_LANE_GATE |
MIPI_CTRL00_LINE_SYNC_ENABLE;
@@ -753,6 +767,120 @@ static int ov5647_parse_dt(struct device
return ret;
}
+static int ov5647_s_auto_white_balance(struct v4l2_subdev *sd, u32 val)
+{
+ /* non-zero turns on AWB */
+ return ov5647_write(sd, OV5647_REG_AWB, val ? 1 : 0);
+}
+
+static int ov5647_s_autogain(struct v4l2_subdev *sd, u32 val)
+{
+ int ret;
+ u8 reg;
+
+ /* non-zero turns on AGC by clearing bit 1 */
+ ret = ov5647_read(sd, OV5647_REG_AEC_AGC, &reg);
+ if (ret == 0)
+ ret = ov5647_write(sd, OV5647_REG_AEC_AGC,
+ val ? reg & ~2 : reg | 2);
+
+ return ret;
+}
+
+static int ov5647_s_exposure_auto(struct v4l2_subdev *sd, u32 val)
+{
+ int ret;
+ u8 reg;
+
+ /* Everything except V4L2_EXPOSURE_MANUAL turns on AEC by
+ * clearing bit 0
+ */
+ ret = ov5647_read(sd, OV5647_REG_AEC_AGC, &reg);
+ if (ret == 0)
+ ret = ov5647_write(sd, OV5647_REG_AEC_AGC,
+ val == V4L2_EXPOSURE_MANUAL ?
+ reg | 1 : reg & ~1);
+
+ return ret;
+}
+
+static int ov5647_s_analogue_gain(struct v4l2_subdev *sd, u32 val)
+{
+ int ret;
+
+ /* 10 bits of gain, 2 in the high register */
+ ret = ov5647_write(sd, OV5647_REG_GAIN_HI, (val >> 8) & 3);
+ if (ret == 0)
+ ret = ov5647_write(sd, OV5647_REG_GAIN_LO, val & 0xff);
+
+ return ret;
+}
+
+static int ov5647_s_exposure(struct v4l2_subdev *sd, u32 val)
+{
+ int ret;
+
+ /* Sensor has 20 bits, but the bottom 4 bits are fractions of a line
+ * which we leave as zero (and don't receive in "val").
+ */
+ ret = ov5647_write(sd, OV5647_REG_EXP_HI, (val >> 12) & 0xf);
+ if (ret == 0)
+ ov5647_write(sd, OV5647_REG_EXP_MID, (val >> 4) & 0xff);
+ if (ret == 0)
+ ov5647_write(sd, OV5647_REG_EXP_LO, (val & 0xf) << 4);
+
+ return ret;
+}
+
+static int ov5647_s_ctrl(struct v4l2_ctrl *ctrl)
+{
+ struct ov5647 *state = container_of(ctrl->handler,
+ struct ov5647, ctrls);
+ struct v4l2_subdev *sd = &state->sd;
+ struct i2c_client *client = v4l2_get_subdevdata(sd);
+ int ret = 0;
+
+ /* v4l2_ctrl_lock() locks our own mutex */
+
+ /*
+ * If the device is not powered up by the host driver do
+ * not apply any controls to H/W at this time. Instead
+ * the controls will be restored right after power-up.
+ */
+ if (state->power_count == 0)
+ return 0;
+
+ switch (ctrl->id) {
+ case V4L2_CID_AUTO_WHITE_BALANCE:
+ ret = ov5647_s_auto_white_balance(sd, ctrl->val);
+ break;
+ case V4L2_CID_AUTOGAIN:
+ ret = ov5647_s_autogain(sd, ctrl->val);
+ break;
+ case V4L2_CID_EXPOSURE_AUTO:
+ ret = ov5647_s_exposure_auto(sd, ctrl->val);
+ break;
+ case V4L2_CID_ANALOGUE_GAIN:
+ ret = ov5647_s_analogue_gain(sd, ctrl->val);
+ break;
+ case V4L2_CID_EXPOSURE:
+ ret = ov5647_s_exposure(sd, ctrl->val);
+ break;
+ default:
+ dev_info(&client->dev,
+ "ctrl(id:0x%x,val:0x%x) is not handled\n",
+ ctrl->id, ctrl->val);
+ ret = -EINVAL;
+ break;
+ }
+
+ return ret;
+}
+
+static const struct v4l2_ctrl_ops ov5647_ctrl_ops = {
+ .s_ctrl = ov5647_s_ctrl,
+};
+
static int ov5647_probe(struct i2c_client *client)
{
struct device *dev = &client->dev;
@@ -761,6 +889,7 @@ static int ov5647_probe(struct i2c_clien
struct v4l2_subdev *sd;
struct device_node *np = client->dev.of_node;
u32 xclk_freq;
+ struct v4l2_ctrl *ctrl;
sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL);
if (!sensor)
@@ -793,6 +922,48 @@ static int ov5647_probe(struct i2c_clien
mutex_init(&sensor->lock);
+ /* Initialise controls. */
+ v4l2_ctrl_handler_init(&sensor->ctrls, 3);
+ v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,
+ V4L2_CID_AUTOGAIN,
+ 0, /* min */
+ 1, /* max */
+ 1, /* step */
+ 1); /* default */
+ v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,
+ V4L2_CID_AUTO_WHITE_BALANCE,
+ 0, /* min */
+ 1, /* max */
+ 1, /* step */
+ 1); /* default */
+ v4l2_ctrl_new_std_menu(&sensor->ctrls, &ov5647_ctrl_ops,
+ V4L2_CID_EXPOSURE_AUTO,
+ V4L2_EXPOSURE_MANUAL, /* max */
+ 0, /* skip_mask */
+ V4L2_EXPOSURE_AUTO); /* default */
+ ctrl = v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,
+ V4L2_CID_EXPOSURE,
+ 4, /* min lines */
+ 65535, /* max lines (4+8+4 bits)*/
+ 1, /* step */
+ 1000); /* default number of lines */
+ ctrl->flags |= V4L2_CTRL_FLAG_EXECUTE_ON_WRITE;
+ ctrl = v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,
+ V4L2_CID_ANALOGUE_GAIN,
+ 16, /* min, 16 = 1.0x */
+ 1023, /* max (10 bits) */
+ 1, /* step */
+ 32); /* default, 32 = 2.0x */
+ ctrl->flags |= V4L2_CTRL_FLAG_EXECUTE_ON_WRITE;
+
+ if (sensor->ctrls.error) {
+ ret = sensor->ctrls.error;
+ dev_err(&client->dev, "%s control init failed (%d)\n",
+ __func__, ret);
+ goto error;
+ }
+ sensor->sd.ctrl_handler = &sensor->ctrls;
+
/* Set the default mode before we init the subdev */
sensor->mode = OV5647_DEFAULT_MODE;
@@ -828,6 +999,7 @@ static int ov5647_probe(struct i2c_clien
error:
media_entity_cleanup(&sd->entity);
mutex_remove:
+ v4l2_ctrl_handler_free(&sensor->ctrls);
mutex_destroy(&sensor->lock);
return ret;
}
@@ -839,6 +1011,7 @@ static int ov5647_remove(struct i2c_clie
v4l2_async_unregister_subdev(&ov5647->sd);
media_entity_cleanup(&ov5647->sd.entity);
+ v4l2_ctrl_handler_free(&ov5647->ctrls);
v4l2_device_unregister_subdev(sd);
mutex_destroy(&ov5647->lock);

View File

@ -1,549 +0,0 @@
From 004f4065edbb817a54121937514eb94159ecce69 Mon Sep 17 00:00:00 2001
From: David Plowman <david.plowman@raspberrypi.com>
Date: Wed, 29 Jan 2020 15:31:28 +0000
Subject: [PATCH] media: ov5647: Add extra 10-bit sensor modes.
The 8-bit VGA mode remains, we add the following 10-bit modes:
Mode 0: 2592x1944 full resolution.
Mode 1: 1920x1080 full resolution, but centre-cropped.
(This mode achieves 30fps, mode 0 does not.)
Mode 2: 1296x972 full field-of-view 2x2 binned mode.
Mode 3: VGA full field of view mode.
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
---
drivers/media/i2c/ov5647.c | 463 ++++++++++++++++++++++++++++++++++++-
1 file changed, 452 insertions(+), 11 deletions(-)
--- a/drivers/media/i2c/ov5647.c
+++ b/drivers/media/i2c/ov5647.c
@@ -111,6 +111,7 @@ struct ov5647 {
struct gpio_desc *pwdn;
unsigned int flags;
struct v4l2_ctrl_handler ctrls;
+ bool write_mode_regs;
};
static inline struct ov5647 *to_state(struct v4l2_subdev *sd)
@@ -130,7 +131,7 @@ static struct regval_list sensor_oe_enab
{0x3002, 0xe4},
};
-static struct regval_list ov5647_640x480[] = {
+static struct regval_list ov5647_640x480_8bit[] = {
{0x0100, 0x00},
{0x0103, 0x01},
{0x3034, 0x08},
@@ -220,9 +221,378 @@ static struct regval_list ov5647_640x480
{0x0100, 0x01},
};
+static struct regval_list ov5647_2592x1944_10bit[] = {
+ {0x0100, 0x00},
+ {0x0103, 0x01},
+ {0x3034, 0x1a},
+ {0x3035, 0x21},
+ {0x3036, 0x69},
+ {0x303c, 0x11},
+ {0x3106, 0xf5},
+ {0x3821, 0x06},
+ {0x3820, 0x00},
+ {0x3827, 0xec},
+ {0x370c, 0x03},
+ {0x3612, 0x5b},
+ {0x3618, 0x04},
+ {0x5000, 0x06},
+ {0x5002, 0x41},
+ {0x5003, 0x08},
+ {0x5a00, 0x08},
+ {0x3000, 0x00},
+ {0x3001, 0x00},
+ {0x3002, 0x00},
+ {0x3016, 0x08},
+ {0x3017, 0xe0},
+ {0x3018, 0x44},
+ {0x301c, 0xf8},
+ {0x301d, 0xf0},
+ {0x3a18, 0x00},
+ {0x3a19, 0xf8},
+ {0x3c01, 0x80},
+ {0x3b07, 0x0c},
+ {0x380c, 0x0b},
+ {0x380d, 0x1c},
+ {0x380e, 0x07},
+ {0x380f, 0xb0},
+ {0x3814, 0x11},
+ {0x3815, 0x11},
+ {0x3708, 0x64},
+ {0x3709, 0x12},
+ {0x3808, 0x0a},
+ {0x3809, 0x20},
+ {0x380a, 0x07},
+ {0x380b, 0x98},
+ {0x3800, 0x00},
+ {0x3801, 0x00},
+ {0x3802, 0x00},
+ {0x3803, 0x00},
+ {0x3804, 0x0a},
+ {0x3805, 0x3f},
+ {0x3806, 0x07},
+ {0x3807, 0xa3},
+ {0x3811, 0x10},
+ {0x3813, 0x06},
+ {0x3630, 0x2e},
+ {0x3632, 0xe2},
+ {0x3633, 0x23},
+ {0x3634, 0x44},
+ {0x3636, 0x06},
+ {0x3620, 0x64},
+ {0x3621, 0xe0},
+ {0x3600, 0x37},
+ {0x3704, 0xa0},
+ {0x3703, 0x5a},
+ {0x3715, 0x78},
+ {0x3717, 0x01},
+ {0x3731, 0x02},
+ {0x370b, 0x60},
+ {0x3705, 0x1a},
+ {0x3f05, 0x02},
+ {0x3f06, 0x10},
+ {0x3f01, 0x0a},
+ {0x3a08, 0x01},
+ {0x3a09, 0x28},
+ {0x3a0a, 0x00},
+ {0x3a0b, 0xf6},
+ {0x3a0d, 0x08},
+ {0x3a0e, 0x06},
+ {0x3a0f, 0x58},
+ {0x3a10, 0x50},
+ {0x3a1b, 0x58},
+ {0x3a1e, 0x50},
+ {0x3a11, 0x60},
+ {0x3a1f, 0x28},
+ {0x4001, 0x02},
+ {0x4004, 0x04},
+ {0x4000, 0x09},
+ {0x4837, 0x19},
+ {0x4800, 0x24},
+ {0x3503, 0x03},
+ {0x0100, 0x01},
+};
+
+static struct regval_list ov5647_1080p30_10bit[] = {
+ {0x0100, 0x00},
+ {0x0103, 0x01},
+ {0x3034, 0x1a},
+ {0x3035, 0x21},
+ {0x3036, 0x62},
+ {0x303c, 0x11},
+ {0x3106, 0xf5},
+ {0x3821, 0x06},
+ {0x3820, 0x00},
+ {0x3827, 0xec},
+ {0x370c, 0x03},
+ {0x3612, 0x5b},
+ {0x3618, 0x04},
+ {0x5000, 0x06},
+ {0x5002, 0x41},
+ {0x5003, 0x08},
+ {0x5a00, 0x08},
+ {0x3000, 0x00},
+ {0x3001, 0x00},
+ {0x3002, 0x00},
+ {0x3016, 0x08},
+ {0x3017, 0xe0},
+ {0x3018, 0x44},
+ {0x301c, 0xf8},
+ {0x301d, 0xf0},
+ {0x3a18, 0x00},
+ {0x3a19, 0xf8},
+ {0x3c01, 0x80},
+ {0x3b07, 0x0c},
+ {0x380c, 0x09},
+ {0x380d, 0x70},
+ {0x380e, 0x04},
+ {0x380f, 0x50},
+ {0x3814, 0x11},
+ {0x3815, 0x11},
+ {0x3708, 0x64},
+ {0x3709, 0x12},
+ {0x3808, 0x07},
+ {0x3809, 0x80},
+ {0x380a, 0x04},
+ {0x380b, 0x38},
+ {0x3800, 0x01},
+ {0x3801, 0x5c},
+ {0x3802, 0x01},
+ {0x3803, 0xb2},
+ {0x3804, 0x08},
+ {0x3805, 0xe3},
+ {0x3806, 0x05},
+ {0x3807, 0xf1},
+ {0x3811, 0x04},
+ {0x3813, 0x02},
+ {0x3630, 0x2e},
+ {0x3632, 0xe2},
+ {0x3633, 0x23},
+ {0x3634, 0x44},
+ {0x3636, 0x06},
+ {0x3620, 0x64},
+ {0x3621, 0xe0},
+ {0x3600, 0x37},
+ {0x3704, 0xa0},
+ {0x3703, 0x5a},
+ {0x3715, 0x78},
+ {0x3717, 0x01},
+ {0x3731, 0x02},
+ {0x370b, 0x60},
+ {0x3705, 0x1a},
+ {0x3f05, 0x02},
+ {0x3f06, 0x10},
+ {0x3f01, 0x0a},
+ {0x3a08, 0x01},
+ {0x3a09, 0x4b},
+ {0x3a0a, 0x01},
+ {0x3a0b, 0x13},
+ {0x3a0d, 0x04},
+ {0x3a0e, 0x03},
+ {0x3a0f, 0x58},
+ {0x3a10, 0x50},
+ {0x3a1b, 0x58},
+ {0x3a1e, 0x50},
+ {0x3a11, 0x60},
+ {0x3a1f, 0x28},
+ {0x4001, 0x02},
+ {0x4004, 0x04},
+ {0x4000, 0x09},
+ {0x4837, 0x19},
+ {0x4800, 0x34},
+ {0x3503, 0x03},
+ {0x0100, 0x01},
+};
+
+static struct regval_list ov5647_2x2binned_10bit[] = {
+ {0x0100, 0x00},
+ {0x0103, 0x01},
+ {0x3034, 0x1A},
+ {0x3035, 0x21},
+ {0x3036, 0x62},
+ {0x303C, 0x11},
+ {0x3106, 0xF5},
+ {0x3827, 0xEC},
+ {0x370C, 0x03},
+ {0x3612, 0x59},
+ {0x3618, 0x00},
+ {0x5000, 0x06},
+ {0x5002, 0x41},
+ {0x5003, 0x08},
+ {0x5A00, 0x08},
+ {0x3000, 0x00},
+ {0x3001, 0x00},
+ {0x3002, 0x00},
+ {0x3016, 0x08},
+ {0x3017, 0xE0},
+ {0x3018, 0x44},
+ {0x301C, 0xF8},
+ {0x301D, 0xF0},
+ {0x3A18, 0x00},
+ {0x3A19, 0xF8},
+ {0x3C01, 0x80},
+ {0x3B07, 0x0C},
+ {0x3800, 0x00},
+ {0x3801, 0x00},
+ {0x3802, 0x00},
+ {0x3803, 0x00},
+ {0x3804, 0x0A},
+ {0x3805, 0x3F},
+ {0x3806, 0x07},
+ {0x3807, 0xA3},
+ {0x3808, 0x05},
+ {0x3809, 0x10},
+ {0x380A, 0x03},
+ {0x380B, 0xCC},
+ {0x380C, 0x07},
+ {0x380D, 0x68},
+ {0x3811, 0x0c},
+ {0x3813, 0x06},
+ {0x3814, 0x31},
+ {0x3815, 0x31},
+ {0x3630, 0x2E},
+ {0x3632, 0xE2},
+ {0x3633, 0x23},
+ {0x3634, 0x44},
+ {0x3636, 0x06},
+ {0x3620, 0x64},
+ {0x3621, 0xE0},
+ {0x3600, 0x37},
+ {0x3704, 0xA0},
+ {0x3703, 0x5A},
+ {0x3715, 0x78},
+ {0x3717, 0x01},
+ {0x3731, 0x02},
+ {0x370B, 0x60},
+ {0x3705, 0x1A},
+ {0x3F05, 0x02},
+ {0x3F06, 0x10},
+ {0x3F01, 0x0A},
+ {0x3A08, 0x01},
+ {0x3A09, 0x28},
+ {0x3A0A, 0x00},
+ {0x3A0B, 0xF6},
+ {0x3A0D, 0x08},
+ {0x3A0E, 0x06},
+ {0x3A0F, 0x58},
+ {0x3A10, 0x50},
+ {0x3A1B, 0x58},
+ {0x3A1E, 0x50},
+ {0x3A11, 0x60},
+ {0x3A1F, 0x28},
+ {0x4001, 0x02},
+ {0x4004, 0x04},
+ {0x4000, 0x09},
+ {0x4837, 0x16},
+ {0x4800, 0x24},
+ {0x3503, 0x03},
+ {0x3820, 0x41},
+ {0x3821, 0x07},
+ {0x380E, 0x05},
+ {0x380F, 0x9B},
+ {0x350A, 0x00},
+ {0x350B, 0x10},
+ {0x3500, 0x00},
+ {0x3501, 0x1A},
+ {0x3502, 0xF0},
+ {0x3212, 0xA0},
+ {0x0100, 0x01},
+};
+
+static struct regval_list ov5647_640x480_10bit[] = {
+ {0x0100, 0x00},
+ {0x0103, 0x01},
+ {0x3035, 0x11},
+ {0x3036, 0x46},
+ {0x303c, 0x11},
+ {0x3821, 0x07},
+ {0x3820, 0x41},
+ {0x370c, 0x03},
+ {0x3612, 0x59},
+ {0x3618, 0x00},
+ {0x5000, 0x06},
+ {0x5003, 0x08},
+ {0x5a00, 0x08},
+ {0x3000, 0xff},
+ {0x3001, 0xff},
+ {0x3002, 0xff},
+ {0x301d, 0xf0},
+ {0x3a18, 0x00},
+ {0x3a19, 0xf8},
+ {0x3c01, 0x80},
+ {0x3b07, 0x0c},
+ {0x380c, 0x07},
+ {0x380d, 0x3c},
+ {0x380e, 0x01},
+ {0x380f, 0xf8},
+ {0x3814, 0x35},
+ {0x3815, 0x35},
+ {0x3708, 0x64},
+ {0x3709, 0x52},
+ {0x3808, 0x02},
+ {0x3809, 0x80},
+ {0x380a, 0x01},
+ {0x380b, 0xe0},
+ {0x3800, 0x00},
+ {0x3801, 0x10},
+ {0x3802, 0x00},
+ {0x3803, 0x00},
+ {0x3804, 0x0a},
+ {0x3805, 0x2f},
+ {0x3806, 0x07},
+ {0x3807, 0x9f},
+ {0x3630, 0x2e},
+ {0x3632, 0xe2},
+ {0x3633, 0x23},
+ {0x3634, 0x44},
+ {0x3620, 0x64},
+ {0x3621, 0xe0},
+ {0x3600, 0x37},
+ {0x3704, 0xa0},
+ {0x3703, 0x5a},
+ {0x3715, 0x78},
+ {0x3717, 0x01},
+ {0x3731, 0x02},
+ {0x370b, 0x60},
+ {0x3705, 0x1a},
+ {0x3f05, 0x02},
+ {0x3f06, 0x10},
+ {0x3f01, 0x0a},
+ {0x3a08, 0x01},
+ {0x3a09, 0x2e},
+ {0x3a0a, 0x00},
+ {0x3a0b, 0xfb},
+ {0x3a0d, 0x02},
+ {0x3a0e, 0x01},
+ {0x3a0f, 0x58},
+ {0x3a10, 0x50},
+ {0x3a1b, 0x58},
+ {0x3a1e, 0x50},
+ {0x3a11, 0x60},
+ {0x3a1f, 0x28},
+ {0x4001, 0x02},
+ {0x4004, 0x02},
+ {0x4000, 0x09},
+ {0x3000, 0x00},
+ {0x3001, 0x00},
+ {0x3002, 0x00},
+ {0x3017, 0xe0},
+ {0x301c, 0xfc},
+ {0x3636, 0x06},
+ {0x3016, 0x08},
+ {0x3827, 0xec},
+ {0x3018, 0x44},
+ {0x3035, 0x21},
+ {0x3106, 0xf5},
+ {0x3034, 0x1a},
+ {0x301c, 0xf8},
+ {0x4800, 0x34},
+ {0x3503, 0x03},
+ {0x0100, 0x01},
+};
+
static struct ov5647_mode supported_modes_8bit[] = {
/*
- * Original 8-bit VGA mode
+ * MODE 0: Original 8-bit VGA mode.
* Uncentred crop (top left quarter) from 2x2 binned 1296x972 image.
*/
{
@@ -233,14 +603,70 @@ static struct ov5647_mode supported_mode
.width = 640,
.height = 480
},
- ov5647_640x480,
- ARRAY_SIZE(ov5647_640x480)
+ ov5647_640x480_8bit,
+ ARRAY_SIZE(ov5647_640x480_8bit)
},
- /* more modes below here... */
};
static struct ov5647_mode supported_modes_10bit[] = {
- /* no 10-bit modes yet */
+ /*
+ * MODE 0: 2592x1944 full resolution full FOV 10-bit mode.
+ */
+ {
+ {
+ .code = MEDIA_BUS_FMT_SBGGR10_1X10,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .field = V4L2_FIELD_NONE,
+ .width = 2592,
+ .height = 1944
+ },
+ ov5647_2592x1944_10bit,
+ ARRAY_SIZE(ov5647_2592x1944_10bit)
+ },
+ /*
+ * MODE 1: 1080p30 10-bit mode.
+ * Full resolution centre-cropped down to 1080p.
+ */
+ {
+ {
+ .code = MEDIA_BUS_FMT_SBGGR10_1X10,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .field = V4L2_FIELD_NONE,
+ .width = 1920,
+ .height = 1080
+ },
+ ov5647_1080p30_10bit,
+ ARRAY_SIZE(ov5647_1080p30_10bit)
+ },
+ /*
+ * MODE 2: 2x2 binned full FOV 10-bit mode.
+ */
+ {
+ {
+ .code = MEDIA_BUS_FMT_SBGGR10_1X10,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .field = V4L2_FIELD_NONE,
+ .width = 1296,
+ .height = 972
+ },
+ ov5647_2x2binned_10bit,
+ ARRAY_SIZE(ov5647_2x2binned_10bit)
+ },
+ /*
+ * MODE 3: 10-bit VGA full FOV mode 60fps.
+ * 2x2 binned and subsampled down to VGA.
+ */
+ {
+ {
+ .code = MEDIA_BUS_FMT_SBGGR10_1X10,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .field = V4L2_FIELD_NONE,
+ .width = 640,
+ .height = 480
+ },
+ ov5647_640x480_10bit,
+ ARRAY_SIZE(ov5647_640x480_10bit)
+ },
};
/* Use original 8-bit VGA mode as default. */
@@ -343,11 +769,14 @@ static int __sensor_init(struct v4l2_sub
if (ret < 0)
return ret;
- ret = ov5647_write_array(sd, state->mode->reg_list,
- state->mode->num_regs);
- if (ret < 0) {
- dev_err(&client->dev, "write sensor default regs error\n");
- return ret;
+ if (state->write_mode_regs) {
+ ret = ov5647_write_array(sd, state->mode->reg_list,
+ state->mode->num_regs);
+ if (ret < 0) {
+ dev_err(&client->dev, "write sensor default regs error\n");
+ return ret;
+ }
+ state->write_mode_regs = false;
}
ret = ov5647_set_virtual_channel(sd, 0);
@@ -475,6 +904,9 @@ static int ov5647_sensor_power(struct v4
"Camera not available, check Power\n");
goto out;
}
+
+ /* Write out the register set over I2C on stream-on. */
+ ov5647->write_mode_regs = true;
} else if (!on && ov5647->power_count == 1) {
dev_dbg(&client->dev, "OV5647 power off\n");
@@ -650,6 +1082,12 @@ static int ov5647_set_fmt(struct v4l2_su
framefmt = v4l2_subdev_get_try_format(sd, cfg, format->pad);
*framefmt = format->format;
} else {
+ /*
+ * If we have changed modes, write the I2C register list on
+ * a stream_on().
+ */
+ if (state->mode != mode)
+ state->write_mode_regs = true;
state->mode = mode;
}
@@ -967,6 +1405,9 @@ static int ov5647_probe(struct i2c_clien
/* Set the default mode before we init the subdev */
sensor->mode = OV5647_DEFAULT_MODE;
+ /* Write out the register set over I2C on stream-on. */
+ sensor->write_mode_regs = true;
+
sd = &sensor->sd;
v4l2_i2c_subdev_init(sd, client, &ov5647_subdev_ops);
sensor->sd.internal_ops = &ov5647_subdev_internal_ops;

View File

@ -1,59 +0,0 @@
From aab5d5842d718544ef906dc8cc5c221e6121160f Mon Sep 17 00:00:00 2001
From: David Plowman <david.plowman@raspberrypi.com>
Date: Wed, 29 Jan 2020 15:31:32 +0000
Subject: [PATCH] media: ov5647: change defaults to better match raw
camera applications.
Specifically:
* AWB is now off by default.
* AEC/AGC is also off by default.
* The default mode is changed to the 10-bit 2x2 binned mode.
AWB and AEC/AGC can be re-enabled using the usual V4L2 controls. The
original 8-bit mode will be respected if an application requests the
8-bit format.
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
---
drivers/media/i2c/ov5647.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
--- a/drivers/media/i2c/ov5647.c
+++ b/drivers/media/i2c/ov5647.c
@@ -669,8 +669,8 @@ static struct ov5647_mode supported_mode
},
};
-/* Use original 8-bit VGA mode as default. */
-#define OV5647_DEFAULT_MODE (&supported_modes_8bit[0])
+/* Use 2x2 binned 10-bit mode as default. */
+#define OV5647_DEFAULT_MODE (&supported_modes_10bit[2])
static int ov5647_write(struct v4l2_subdev *sd, u16 reg, u8 val)
{
@@ -1367,18 +1367,18 @@ static int ov5647_probe(struct i2c_clien
0, /* min */
1, /* max */
1, /* step */
- 1); /* default */
+ 0); /* default */
v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,
V4L2_CID_AUTO_WHITE_BALANCE,
0, /* min */
1, /* max */
1, /* step */
- 1); /* default */
+ 0); /* default */
v4l2_ctrl_new_std_menu(&sensor->ctrls, &ov5647_ctrl_ops,
V4L2_CID_EXPOSURE_AUTO,
V4L2_EXPOSURE_MANUAL, /* max */
0, /* skip_mask */
- V4L2_EXPOSURE_AUTO); /* default */
+ V4L2_EXPOSURE_MANUAL); /* default */
ctrl = v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,
V4L2_CID_EXPOSURE,
4, /* min lines */

View File

@ -1,206 +0,0 @@
From 450dc10dd858314fcb5e18942b6e5260e3478f10 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Wed, 29 Apr 2020 11:46:07 +0100
Subject: [PATCH] media: i2c: ov5647: Add support for g_selection to
reflect cropping/binning
In order to apply lens shading correctly the client needs to know how
each mode crops or scales the image compared to the full sensor array.
Implement this (based on the imx219 equivalent).
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/ov5647.c | 119 ++++++++++++++++++++++++++++++-------
1 file changed, 96 insertions(+), 23 deletions(-)
--- a/drivers/media/i2c/ov5647.c
+++ b/drivers/media/i2c/ov5647.c
@@ -70,25 +70,14 @@
#define VAL_TERM 0xfe
#define REG_DLY 0xffff
-#define OV5647_ROW_START 0x01
-#define OV5647_ROW_START_MIN 0
-#define OV5647_ROW_START_MAX 2004
-#define OV5647_ROW_START_DEF 54
-
-#define OV5647_COLUMN_START 0x02
-#define OV5647_COLUMN_START_MIN 0
-#define OV5647_COLUMN_START_MAX 2750
-#define OV5647_COLUMN_START_DEF 16
-
-#define OV5647_WINDOW_HEIGHT 0x03
-#define OV5647_WINDOW_HEIGHT_MIN 2
-#define OV5647_WINDOW_HEIGHT_MAX 2006
-#define OV5647_WINDOW_HEIGHT_DEF 1944
-
-#define OV5647_WINDOW_WIDTH 0x04
-#define OV5647_WINDOW_WIDTH_MIN 2
-#define OV5647_WINDOW_WIDTH_MAX 2752
-#define OV5647_WINDOW_WIDTH_DEF 2592
+/* OV5647 native and active pixel array size */
+#define OV5647_NATIVE_WIDTH 2624U
+#define OV5647_NATIVE_HEIGHT 1956U
+
+#define OV5647_PIXEL_ARRAY_LEFT 16U
+#define OV5647_PIXEL_ARRAY_TOP 16U
+#define OV5647_PIXEL_ARRAY_WIDTH 2592U
+#define OV5647_PIXEL_ARRAY_HEIGHT 1944U
struct regval_list {
u16 addr;
@@ -97,6 +86,9 @@ struct regval_list {
struct ov5647_mode {
struct v4l2_mbus_framefmt format;
+ /* Analog crop rectangle. */
+ struct v4l2_rect crop;
+
struct regval_list *reg_list;
unsigned int num_regs;
};
@@ -603,6 +595,12 @@ static struct ov5647_mode supported_mode
.width = 640,
.height = 480
},
+ .crop = {
+ .left = 0,
+ .top = 0,
+ .width = 1280,
+ .height = 960,
+ },
ov5647_640x480_8bit,
ARRAY_SIZE(ov5647_640x480_8bit)
},
@@ -620,6 +618,12 @@ static struct ov5647_mode supported_mode
.width = 2592,
.height = 1944
},
+ .crop = {
+ .left = 0,
+ .top = 0,
+ .width = 2592,
+ .height = 1944
+ },
ov5647_2592x1944_10bit,
ARRAY_SIZE(ov5647_2592x1944_10bit)
},
@@ -635,6 +639,12 @@ static struct ov5647_mode supported_mode
.width = 1920,
.height = 1080
},
+ .crop = {
+ .left = 348,
+ .top = 434,
+ .width = 1928,
+ .height = 1080,
+ },
ov5647_1080p30_10bit,
ARRAY_SIZE(ov5647_1080p30_10bit)
},
@@ -649,6 +659,12 @@ static struct ov5647_mode supported_mode
.width = 1296,
.height = 972
},
+ .crop = {
+ .left = 0,
+ .top = 0,
+ .width = 2592,
+ .height = 1944,
+ },
ov5647_2x2binned_10bit,
ARRAY_SIZE(ov5647_2x2binned_10bit)
},
@@ -664,6 +680,12 @@ static struct ov5647_mode supported_mode
.width = 640,
.height = 480
},
+ .crop = {
+ .left = 16,
+ .top = 0,
+ .width = 2560,
+ .height = 1920,
+ },
ov5647_640x480_10bit,
ARRAY_SIZE(ov5647_640x480_10bit)
},
@@ -971,6 +993,56 @@ static const struct v4l2_subdev_core_ops
#endif
};
+static const struct v4l2_rect *
+__ov5647_get_pad_crop(struct ov5647 *ov5647, struct v4l2_subdev_pad_config *cfg,
+ unsigned int pad, enum v4l2_subdev_format_whence which)
+{
+ switch (which) {
+ case V4L2_SUBDEV_FORMAT_TRY:
+ return v4l2_subdev_get_try_crop(&ov5647->sd, cfg, pad);
+ case V4L2_SUBDEV_FORMAT_ACTIVE:
+ return &ov5647->mode->crop;
+ }
+
+ return NULL;
+}
+
+static int ov5647_get_selection(struct v4l2_subdev *sd,
+ struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_selection *sel)
+{
+ switch (sel->target) {
+ case V4L2_SEL_TGT_CROP: {
+ struct ov5647 *state = to_state(sd);
+
+ mutex_lock(&state->lock);
+ sel->r = *__ov5647_get_pad_crop(state, cfg, sel->pad,
+ sel->which);
+ mutex_unlock(&state->lock);
+
+ return 0;
+ }
+
+ case V4L2_SEL_TGT_NATIVE_SIZE:
+ sel->r.top = 0;
+ sel->r.left = 0;
+ sel->r.width = OV5647_NATIVE_WIDTH;
+ sel->r.height = OV5647_NATIVE_HEIGHT;
+
+ return 0;
+
+ case V4L2_SEL_TGT_CROP_DEFAULT:
+ sel->r.top = OV5647_PIXEL_ARRAY_TOP;
+ sel->r.left = OV5647_PIXEL_ARRAY_LEFT;
+ sel->r.width = OV5647_PIXEL_ARRAY_WIDTH;
+ sel->r.height = OV5647_PIXEL_ARRAY_HEIGHT;
+
+ return 0;
+ }
+
+ return -EINVAL;
+}
+
static int ov5647_s_stream(struct v4l2_subdev *sd, int enable)
{
struct ov5647 *state = to_state(sd);
@@ -1122,6 +1194,7 @@ static const struct v4l2_subdev_pad_ops
.enum_mbus_code = ov5647_enum_mbus_code,
.set_fmt = ov5647_set_fmt,
.get_fmt = ov5647_get_fmt,
+ .get_selection = ov5647_get_selection,
.enum_frame_size = ov5647_enum_frame_size,
};
@@ -1170,10 +1243,10 @@ static int ov5647_open(struct v4l2_subde
v4l2_subdev_get_try_crop(sd, fh->pad, 0);
struct ov5647 *state = to_state(sd);
- crop->left = OV5647_COLUMN_START_DEF;
- crop->top = OV5647_ROW_START_DEF;
- crop->width = OV5647_WINDOW_WIDTH_DEF;
- crop->height = OV5647_WINDOW_HEIGHT_DEF;
+ crop->left = OV5647_PIXEL_ARRAY_LEFT;
+ crop->top = OV5647_PIXEL_ARRAY_TOP;
+ crop->width = OV5647_PIXEL_ARRAY_WIDTH;
+ crop->height = OV5647_PIXEL_ARRAY_HEIGHT;
/* Set the default format to the same as the sensor. */
*format = state->mode->format;

View File

@ -1,29 +0,0 @@
From 5c462e56efdb4de0e3b785082d8adae675ccaefd Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Wed, 29 Apr 2020 11:50:52 +0100
Subject: [PATCH] media: i2c: ov5467: Fixup error path to release mutex
"87f3ab9 media: ov5647: Add basic support for multiple sensor modes."
added a return path ov5647_set_fmt that didn't release the device
mutex that it had claimed.
Release the mutex.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/ov5647.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/drivers/media/i2c/ov5647.c
+++ b/drivers/media/i2c/ov5647.c
@@ -1146,8 +1146,10 @@ static int ov5647_set_fmt(struct v4l2_su
else
mode = mode_8bit;
- if (!mode)
+ if (!mode) {
+ mutex_unlock(&state->lock);
return -EINVAL;
+ }
*fmt = mode->format;
if (format->which == V4L2_SUBDEV_FORMAT_TRY) {

View File

@ -1,131 +0,0 @@
From 5cb8892104a869adaf76d40629b5a0230d32edd0 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Wed, 29 Apr 2020 12:25:13 +0100
Subject: [PATCH] media: i2c: ov5647: Support V4L2_CID_PIXEL_RATE
Clients need to know the pixel rate in order to compute exposure
and frame rate values.
Advertise it.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/ov5647.c | 31 +++++++++++++++++++++++++++----
1 file changed, 27 insertions(+), 4 deletions(-)
--- a/drivers/media/i2c/ov5647.c
+++ b/drivers/media/i2c/ov5647.c
@@ -89,6 +89,8 @@ struct ov5647_mode {
/* Analog crop rectangle. */
struct v4l2_rect crop;
+ u64 pixel_rate;
+
struct regval_list *reg_list;
unsigned int num_regs;
};
@@ -103,6 +105,7 @@ struct ov5647 {
struct gpio_desc *pwdn;
unsigned int flags;
struct v4l2_ctrl_handler ctrls;
+ struct v4l2_ctrl *pixel_rate;
bool write_mode_regs;
};
@@ -601,6 +604,7 @@ static struct ov5647_mode supported_mode
.width = 1280,
.height = 960,
},
+ .pixel_rate = 77291670,
ov5647_640x480_8bit,
ARRAY_SIZE(ov5647_640x480_8bit)
},
@@ -624,6 +628,7 @@ static struct ov5647_mode supported_mode
.width = 2592,
.height = 1944
},
+ .pixel_rate = 87500000,
ov5647_2592x1944_10bit,
ARRAY_SIZE(ov5647_2592x1944_10bit)
},
@@ -645,6 +650,7 @@ static struct ov5647_mode supported_mode
.width = 1928,
.height = 1080,
},
+ .pixel_rate = 81666700,
ov5647_1080p30_10bit,
ARRAY_SIZE(ov5647_1080p30_10bit)
},
@@ -665,6 +671,7 @@ static struct ov5647_mode supported_mode
.width = 2592,
.height = 1944,
},
+ .pixel_rate = 81666700,
ov5647_2x2binned_10bit,
ARRAY_SIZE(ov5647_2x2binned_10bit)
},
@@ -686,6 +693,7 @@ static struct ov5647_mode supported_mode
.width = 2560,
.height = 1920,
},
+ .pixel_rate = 55000000,
ov5647_640x480_10bit,
ARRAY_SIZE(ov5647_640x480_10bit)
},
@@ -1163,6 +1171,11 @@ static int ov5647_set_fmt(struct v4l2_su
if (state->mode != mode)
state->write_mode_regs = true;
state->mode = mode;
+
+ __v4l2_ctrl_modify_range(state->pixel_rate,
+ mode->pixel_rate,
+ mode->pixel_rate, 1,
+ mode->pixel_rate);
}
mutex_unlock(&state->lock);
@@ -1379,6 +1392,9 @@ static int ov5647_s_ctrl(struct v4l2_ctr
case V4L2_CID_EXPOSURE:
ret = ov5647_s_exposure(sd, ctrl->val);
break;
+ case V4L2_CID_PIXEL_RATE:
+ /* Read-only, but we adjust it based on mode. */
+ break;
default:
dev_info(&client->dev,
"ctrl(id:0x%x,val:0x%x) is not handled\n",
@@ -1436,7 +1452,7 @@ static int ov5647_probe(struct i2c_clien
mutex_init(&sensor->lock);
/* Initialise controls. */
- v4l2_ctrl_handler_init(&sensor->ctrls, 3);
+ v4l2_ctrl_handler_init(&sensor->ctrls, 6);
v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,
V4L2_CID_AUTOGAIN,
0, /* min */
@@ -1469,6 +1485,16 @@ static int ov5647_probe(struct i2c_clien
32); /* default, 32 = 2.0x */
ctrl->flags |= V4L2_CTRL_FLAG_EXECUTE_ON_WRITE;
+ /* Set the default mode before we init the subdev */
+ sensor->mode = OV5647_DEFAULT_MODE;
+
+ /* By default, PIXEL_RATE is read only, but it does change per mode */
+ sensor->pixel_rate = v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,
+ V4L2_CID_PIXEL_RATE,
+ sensor->mode->pixel_rate,
+ sensor->mode->pixel_rate, 1,
+ sensor->mode->pixel_rate);
+
if (sensor->ctrls.error) {
ret = sensor->ctrls.error;
dev_err(&client->dev, "%s control init failed (%d)\n",
@@ -1477,9 +1503,6 @@ static int ov5647_probe(struct i2c_clien
}
sensor->sd.ctrl_handler = &sensor->ctrls;
- /* Set the default mode before we init the subdev */
- sensor->mode = OV5647_DEFAULT_MODE;
-
/* Write out the register set over I2C on stream-on. */
sensor->write_mode_regs = true;

View File

@ -1,143 +0,0 @@
From 29e3826878f43cd88414824be055cf5fcd57ab23 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Wed, 29 Apr 2020 17:25:56 +0100
Subject: [PATCH] media: i2c: ov5647: Set V4L2_SUBDEV_FL_HAS_EVENTS
flag
The ov5647 subdev can generate control events, therefore set
the V4L2_SUBDEV_FL_HAS_EVENTS flag.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/ov5647.c | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
--- a/drivers/media/i2c/ov5647.c
+++ b/drivers/media/i2c/ov5647.c
@@ -90,6 +90,8 @@ struct ov5647_mode {
struct v4l2_rect crop;
u64 pixel_rate;
+ /* HTS as defined in the register set (0x380C/0x380D) */
+ int hts;
struct regval_list *reg_list;
unsigned int num_regs;
@@ -106,6 +108,7 @@ struct ov5647 {
unsigned int flags;
struct v4l2_ctrl_handler ctrls;
struct v4l2_ctrl *pixel_rate;
+ struct v4l2_ctrl *hblank;
bool write_mode_regs;
};
@@ -605,6 +608,7 @@ static struct ov5647_mode supported_mode
.height = 960,
},
.pixel_rate = 77291670,
+ .hts = 1896,
ov5647_640x480_8bit,
ARRAY_SIZE(ov5647_640x480_8bit)
},
@@ -629,6 +633,7 @@ static struct ov5647_mode supported_mode
.height = 1944
},
.pixel_rate = 87500000,
+ .hts = 2844,
ov5647_2592x1944_10bit,
ARRAY_SIZE(ov5647_2592x1944_10bit)
},
@@ -651,6 +656,7 @@ static struct ov5647_mode supported_mode
.height = 1080,
},
.pixel_rate = 81666700,
+ .hts = 2416,
ov5647_1080p30_10bit,
ARRAY_SIZE(ov5647_1080p30_10bit)
},
@@ -672,6 +678,7 @@ static struct ov5647_mode supported_mode
.height = 1944,
},
.pixel_rate = 81666700,
+ .hts = 1896,
ov5647_2x2binned_10bit,
ARRAY_SIZE(ov5647_2x2binned_10bit)
},
@@ -694,6 +701,7 @@ static struct ov5647_mode supported_mode
.height = 1920,
},
.pixel_rate = 55000000,
+ .hts = 1852,
ov5647_640x480_10bit,
ARRAY_SIZE(ov5647_640x480_10bit)
},
@@ -1168,6 +1176,8 @@ static int ov5647_set_fmt(struct v4l2_su
* If we have changed modes, write the I2C register list on
* a stream_on().
*/
+ int hblank;
+
if (state->mode != mode)
state->write_mode_regs = true;
state->mode = mode;
@@ -1176,6 +1186,9 @@ static int ov5647_set_fmt(struct v4l2_su
mode->pixel_rate,
mode->pixel_rate, 1,
mode->pixel_rate);
+ hblank = mode->hts - mode->format.width;
+ __v4l2_ctrl_modify_range(state->hblank, hblank, hblank, 1,
+ hblank);
}
mutex_unlock(&state->lock);
@@ -1395,6 +1408,9 @@ static int ov5647_s_ctrl(struct v4l2_ctr
case V4L2_CID_PIXEL_RATE:
/* Read-only, but we adjust it based on mode. */
break;
+ case V4L2_CID_HBLANK:
+ /* Read-only, but we adjust it based on mode. */
+ break;
default:
dev_info(&client->dev,
"ctrl(id:0x%x,val:0x%x) is not handled\n",
@@ -1419,6 +1435,7 @@ static int ov5647_probe(struct i2c_clien
struct device_node *np = client->dev.of_node;
u32 xclk_freq;
struct v4l2_ctrl *ctrl;
+ int hblank;
sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL);
if (!sensor)
@@ -1452,7 +1469,7 @@ static int ov5647_probe(struct i2c_clien
mutex_init(&sensor->lock);
/* Initialise controls. */
- v4l2_ctrl_handler_init(&sensor->ctrls, 6);
+ v4l2_ctrl_handler_init(&sensor->ctrls, 7);
v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,
V4L2_CID_AUTOGAIN,
0, /* min */
@@ -1495,6 +1512,13 @@ static int ov5647_probe(struct i2c_clien
sensor->mode->pixel_rate, 1,
sensor->mode->pixel_rate);
+ /* By default, HBLANK is read only, but it does change per mode */
+ hblank = sensor->mode->hts - sensor->mode->format.width;
+ sensor->hblank = v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,
+ V4L2_CID_HBLANK, hblank, hblank, 1,
+ hblank);
+ sensor->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
+
if (sensor->ctrls.error) {
ret = sensor->ctrls.error;
dev_err(&client->dev, "%s control init failed (%d)\n",
@@ -1509,7 +1533,8 @@ static int ov5647_probe(struct i2c_clien
sd = &sensor->sd;
v4l2_i2c_subdev_init(sd, client, &ov5647_subdev_ops);
sensor->sd.internal_ops = &ov5647_subdev_internal_ops;
- sensor->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+ sensor->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
+ V4L2_SUBDEV_FL_HAS_EVENTS;
sensor->pad.flags = MEDIA_PAD_FL_SOURCE;
sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;

View File

@ -1,205 +0,0 @@
From 95a10a4709eea202f3ce833fdeb9b30c17d80148 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Wed, 29 Apr 2020 21:39:58 +0100
Subject: [PATCH] media: i2c: ov5647: Add support for V4L2_CID_VBLANK
Adds vblank control to allow for frame rate control.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/ov5647.c | 65 ++++++++++++++++++++++++++++++++------
1 file changed, 55 insertions(+), 10 deletions(-)
--- a/drivers/media/i2c/ov5647.c
+++ b/drivers/media/i2c/ov5647.c
@@ -61,6 +61,8 @@
#define OV5647_REG_AEC_AGC 0x3503
#define OV5647_REG_GAIN_HI 0x350A
#define OV5647_REG_GAIN_LO 0x350B
+#define OV5647_REG_VTS_HI 0x380e
+#define OV5647_REG_VTS_LO 0x380f
#define OV5647_REG_FRAME_OFF_NUMBER 0x4202
#define OV5647_REG_MIPI_CTRL00 0x4800
#define OV5647_REG_MIPI_CTRL14 0x4814
@@ -79,6 +81,9 @@
#define OV5647_PIXEL_ARRAY_WIDTH 2592U
#define OV5647_PIXEL_ARRAY_HEIGHT 1944U
+#define OV5647_VBLANK_MIN 4
+#define OV5647_VTS_MAX 32767
+
struct regval_list {
u16 addr;
u8 data;
@@ -92,6 +97,8 @@ struct ov5647_mode {
u64 pixel_rate;
/* HTS as defined in the register set (0x380C/0x380D) */
int hts;
+ /* Default VTS value for this mode */
+ int vts_def;
struct regval_list *reg_list;
unsigned int num_regs;
@@ -109,6 +116,7 @@ struct ov5647 {
struct v4l2_ctrl_handler ctrls;
struct v4l2_ctrl *pixel_rate;
struct v4l2_ctrl *hblank;
+ struct v4l2_ctrl *vblank;
bool write_mode_regs;
};
@@ -161,8 +169,6 @@ static struct regval_list ov5647_640x480
{0x3b07, 0x0c},
{0x380c, 0x07},
{0x380d, 0x68},
- {0x380e, 0x03},
- {0x380f, 0xd8},
{0x3814, 0x31},
{0x3815, 0x31},
{0x3708, 0x64},
@@ -251,8 +257,6 @@ static struct regval_list ov5647_2592x19
{0x3b07, 0x0c},
{0x380c, 0x0b},
{0x380d, 0x1c},
- {0x380e, 0x07},
- {0x380f, 0xb0},
{0x3814, 0x11},
{0x3815, 0x11},
{0x3708, 0x64},
@@ -342,8 +346,6 @@ static struct regval_list ov5647_1080p30
{0x3b07, 0x0c},
{0x380c, 0x09},
{0x380d, 0x70},
- {0x380e, 0x04},
- {0x380f, 0x50},
{0x3814, 0x11},
{0x3815, 0x11},
{0x3708, 0x64},
@@ -485,8 +487,6 @@ static struct regval_list ov5647_2x2binn
{0x3503, 0x03},
{0x3820, 0x41},
{0x3821, 0x07},
- {0x380E, 0x05},
- {0x380F, 0x9B},
{0x350A, 0x00},
{0x350B, 0x10},
{0x3500, 0x00},
@@ -520,8 +520,6 @@ static struct regval_list ov5647_640x480
{0x3b07, 0x0c},
{0x380c, 0x07},
{0x380d, 0x3c},
- {0x380e, 0x01},
- {0x380f, 0xf8},
{0x3814, 0x35},
{0x3815, 0x35},
{0x3708, 0x64},
@@ -609,6 +607,7 @@ static struct ov5647_mode supported_mode
},
.pixel_rate = 77291670,
.hts = 1896,
+ .vts_def = 0x3d8,
ov5647_640x480_8bit,
ARRAY_SIZE(ov5647_640x480_8bit)
},
@@ -634,6 +633,7 @@ static struct ov5647_mode supported_mode
},
.pixel_rate = 87500000,
.hts = 2844,
+ .vts_def = 0x7b0,
ov5647_2592x1944_10bit,
ARRAY_SIZE(ov5647_2592x1944_10bit)
},
@@ -657,6 +657,7 @@ static struct ov5647_mode supported_mode
},
.pixel_rate = 81666700,
.hts = 2416,
+ .vts_def = 0x450,
ov5647_1080p30_10bit,
ARRAY_SIZE(ov5647_1080p30_10bit)
},
@@ -679,6 +680,7 @@ static struct ov5647_mode supported_mode
},
.pixel_rate = 81666700,
.hts = 1896,
+ .vts_def = 0x59b,
ov5647_2x2binned_10bit,
ARRAY_SIZE(ov5647_2x2binned_10bit)
},
@@ -702,6 +704,7 @@ static struct ov5647_mode supported_mode
},
.pixel_rate = 55000000,
.hts = 1852,
+ .vts_def = 0x1f8,
ov5647_640x480_10bit,
ARRAY_SIZE(ov5647_640x480_10bit)
},
@@ -710,6 +713,29 @@ static struct ov5647_mode supported_mode
/* Use 2x2 binned 10-bit mode as default. */
#define OV5647_DEFAULT_MODE (&supported_modes_10bit[2])
+static int ov5647_write16(struct v4l2_subdev *sd, u16 reg, u16 val)
+{
+ int ret;
+ unsigned char data[4] = { reg >> 8, reg & 0xff, val >> 8, val & 0xff};
+ struct i2c_client *client = v4l2_get_subdevdata(sd);
+
+ ret = i2c_master_send(client, data, 4);
+ /*
+ * Writing the wrong number of bytes also needs to be flagged as an
+ * error. Success needs to produce a 0 return code.
+ */
+ if (ret == 4) {
+ ret = 0;
+ } else {
+ dev_dbg(&client->dev, "%s: i2c write error, reg: %x\n",
+ __func__, reg);
+ if (ret >= 0)
+ ret = -EINVAL;
+ }
+
+ return ret;
+}
+
static int ov5647_write(struct v4l2_subdev *sd, u16 reg, u8 val)
{
int ret;
@@ -1189,6 +1215,14 @@ static int ov5647_set_fmt(struct v4l2_su
hblank = mode->hts - mode->format.width;
__v4l2_ctrl_modify_range(state->hblank, hblank, hblank, 1,
hblank);
+
+ __v4l2_ctrl_modify_range(state->vblank,
+ OV5647_VBLANK_MIN,
+ OV5647_VTS_MAX - mode->format.height,
+ 1,
+ mode->vts_def - mode->format.height);
+ __v4l2_ctrl_s_ctrl(state->vblank,
+ mode->vts_def - mode->format.height);
}
mutex_unlock(&state->lock);
@@ -1411,6 +1445,10 @@ static int ov5647_s_ctrl(struct v4l2_ctr
case V4L2_CID_HBLANK:
/* Read-only, but we adjust it based on mode. */
break;
+ case V4L2_CID_VBLANK:
+ ret = ov5647_write16(sd, OV5647_REG_VTS_HI,
+ state->mode->format.height + ctrl->val);
+ break;
default:
dev_info(&client->dev,
"ctrl(id:0x%x,val:0x%x) is not handled\n",
@@ -1519,6 +1557,13 @@ static int ov5647_probe(struct i2c_clien
hblank);
sensor->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
+ sensor->vblank = v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,
+ V4L2_CID_VBLANK, OV5647_VBLANK_MIN,
+ OV5647_VTS_MAX -
+ sensor->mode->format.height, 1,
+ sensor->mode->vts_def -
+ sensor->mode->format.height);
+
if (sensor->ctrls.error) {
ret = sensor->ctrls.error;
dev_err(&client->dev, "%s control init failed (%d)\n",

View File

@ -1,58 +0,0 @@
From 05a1c88d9b8dd344edfce3eaa00a3cac866cf3ad Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Wed, 29 Apr 2020 21:47:25 +0100
Subject: [PATCH] media: i2c: ov5647: Neither analogue gain nor
exposure need EXECUTE_ON_WRITE
The controls for analogue gain and exposure were defined with
V4L2_CTRL_FLAG_EXECUTE_ON_WRITE. This is not required as we only need
to send changes to the sensor.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/ov5647.c | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
--- a/drivers/media/i2c/ov5647.c
+++ b/drivers/media/i2c/ov5647.c
@@ -1472,7 +1472,6 @@ static int ov5647_probe(struct i2c_clien
struct v4l2_subdev *sd;
struct device_node *np = client->dev.of_node;
u32 xclk_freq;
- struct v4l2_ctrl *ctrl;
int hblank;
sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL);
@@ -1525,20 +1524,18 @@ static int ov5647_probe(struct i2c_clien
V4L2_EXPOSURE_MANUAL, /* max */
0, /* skip_mask */
V4L2_EXPOSURE_MANUAL); /* default */
- ctrl = v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,
- V4L2_CID_EXPOSURE,
- 4, /* min lines */
- 65535, /* max lines (4+8+4 bits)*/
- 1, /* step */
- 1000); /* default number of lines */
- ctrl->flags |= V4L2_CTRL_FLAG_EXECUTE_ON_WRITE;
- ctrl = v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,
- V4L2_CID_ANALOGUE_GAIN,
- 16, /* min, 16 = 1.0x */
- 1023, /* max (10 bits) */
- 1, /* step */
- 32); /* default, 32 = 2.0x */
- ctrl->flags |= V4L2_CTRL_FLAG_EXECUTE_ON_WRITE;
+ v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,
+ V4L2_CID_EXPOSURE,
+ 4, /* min lines */
+ 65535, /* max lines (4+8+4 bits)*/
+ 1, /* step */
+ 1000); /* default number of lines */
+ v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,
+ V4L2_CID_ANALOGUE_GAIN,
+ 16, /* min, 16 = 1.0x */
+ 1023, /* max (10 bits) */
+ 1, /* step */
+ 32); /* default, 32 = 2.0x */
/* Set the default mode before we init the subdev */
sensor->mode = OV5647_DEFAULT_MODE;

View File

@ -1,111 +0,0 @@
From 1073eef3ada930c9c35b2b0da30828cfe1ea4024 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Wed, 29 Apr 2020 22:11:01 +0100
Subject: [PATCH] media: i2c: ov5647: Use member names in mode tables
To make adding new members to the mode structures easier, use
the member names in the initialisers.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/ov5647.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
--- a/drivers/media/i2c/ov5647.c
+++ b/drivers/media/i2c/ov5647.c
@@ -592,7 +592,7 @@ static struct ov5647_mode supported_mode
* Uncentred crop (top left quarter) from 2x2 binned 1296x972 image.
*/
{
- {
+ .format = {
.code = MEDIA_BUS_FMT_SBGGR8_1X8,
.colorspace = V4L2_COLORSPACE_SRGB,
.field = V4L2_FIELD_NONE,
@@ -608,8 +608,8 @@ static struct ov5647_mode supported_mode
.pixel_rate = 77291670,
.hts = 1896,
.vts_def = 0x3d8,
- ov5647_640x480_8bit,
- ARRAY_SIZE(ov5647_640x480_8bit)
+ .reg_list = ov5647_640x480_8bit,
+ .num_regs = ARRAY_SIZE(ov5647_640x480_8bit)
},
};
@@ -618,7 +618,7 @@ static struct ov5647_mode supported_mode
* MODE 0: 2592x1944 full resolution full FOV 10-bit mode.
*/
{
- {
+ .format = {
.code = MEDIA_BUS_FMT_SBGGR10_1X10,
.colorspace = V4L2_COLORSPACE_SRGB,
.field = V4L2_FIELD_NONE,
@@ -634,15 +634,15 @@ static struct ov5647_mode supported_mode
.pixel_rate = 87500000,
.hts = 2844,
.vts_def = 0x7b0,
- ov5647_2592x1944_10bit,
- ARRAY_SIZE(ov5647_2592x1944_10bit)
+ .reg_list = ov5647_2592x1944_10bit,
+ .num_regs = ARRAY_SIZE(ov5647_2592x1944_10bit)
},
/*
* MODE 1: 1080p30 10-bit mode.
* Full resolution centre-cropped down to 1080p.
*/
{
- {
+ .format = {
.code = MEDIA_BUS_FMT_SBGGR10_1X10,
.colorspace = V4L2_COLORSPACE_SRGB,
.field = V4L2_FIELD_NONE,
@@ -658,14 +658,14 @@ static struct ov5647_mode supported_mode
.pixel_rate = 81666700,
.hts = 2416,
.vts_def = 0x450,
- ov5647_1080p30_10bit,
- ARRAY_SIZE(ov5647_1080p30_10bit)
+ .reg_list = ov5647_1080p30_10bit,
+ .num_regs = ARRAY_SIZE(ov5647_1080p30_10bit)
},
/*
* MODE 2: 2x2 binned full FOV 10-bit mode.
*/
{
- {
+ .format = {
.code = MEDIA_BUS_FMT_SBGGR10_1X10,
.colorspace = V4L2_COLORSPACE_SRGB,
.field = V4L2_FIELD_NONE,
@@ -681,15 +681,15 @@ static struct ov5647_mode supported_mode
.pixel_rate = 81666700,
.hts = 1896,
.vts_def = 0x59b,
- ov5647_2x2binned_10bit,
- ARRAY_SIZE(ov5647_2x2binned_10bit)
+ .reg_list = ov5647_2x2binned_10bit,
+ .num_regs = ARRAY_SIZE(ov5647_2x2binned_10bit)
},
/*
* MODE 3: 10-bit VGA full FOV mode 60fps.
* 2x2 binned and subsampled down to VGA.
*/
{
- {
+ .format = {
.code = MEDIA_BUS_FMT_SBGGR10_1X10,
.colorspace = V4L2_COLORSPACE_SRGB,
.field = V4L2_FIELD_NONE,
@@ -705,8 +705,8 @@ static struct ov5647_mode supported_mode
.pixel_rate = 55000000,
.hts = 1852,
.vts_def = 0x1f8,
- ov5647_640x480_10bit,
- ARRAY_SIZE(ov5647_640x480_10bit)
+ .reg_list = ov5647_640x480_10bit,
+ .num_regs = ARRAY_SIZE(ov5647_640x480_10bit)
},
};

View File

@ -1,119 +0,0 @@
From 7048b8678ac96eb512adfb18990eff0c9b8109f5 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Thu, 30 Apr 2020 11:03:00 +0100
Subject: [PATCH] media: i2c: ov5647: Advertise the correct exposure
range
Exposure is clipped by the VTS of the mode, so needs to be updated as
and when this is changed.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/ov5647.c | 47 +++++++++++++++++++++++++++++++-------
1 file changed, 39 insertions(+), 8 deletions(-)
--- a/drivers/media/i2c/ov5647.c
+++ b/drivers/media/i2c/ov5647.c
@@ -84,6 +84,11 @@
#define OV5647_VBLANK_MIN 4
#define OV5647_VTS_MAX 32767
+#define OV5647_EXPOSURE_MIN 4
+#define OV5647_EXPOSURE_STEP 1
+#define OV5647_EXPOSURE_DEFAULT 1000
+#define OV5647_EXPOSURE_MAX 65535
+
struct regval_list {
u16 addr;
u8 data;
@@ -117,6 +122,7 @@ struct ov5647 {
struct v4l2_ctrl *pixel_rate;
struct v4l2_ctrl *hblank;
struct v4l2_ctrl *vblank;
+ struct v4l2_ctrl *exposure;
bool write_mode_regs;
};
@@ -1202,7 +1208,7 @@ static int ov5647_set_fmt(struct v4l2_su
* If we have changed modes, write the I2C register list on
* a stream_on().
*/
- int hblank;
+ int exposure_max, exposure_def, hblank;
if (state->mode != mode)
state->write_mode_regs = true;
@@ -1223,6 +1229,15 @@ static int ov5647_set_fmt(struct v4l2_su
mode->vts_def - mode->format.height);
__v4l2_ctrl_s_ctrl(state->vblank,
mode->vts_def - mode->format.height);
+
+ exposure_max = mode->vts_def - 4;
+ exposure_def = (exposure_max < OV5647_EXPOSURE_DEFAULT) ?
+ exposure_max : OV5647_EXPOSURE_DEFAULT;
+ __v4l2_ctrl_modify_range(state->exposure,
+ state->exposure->minimum,
+ exposure_max,
+ state->exposure->step,
+ exposure_def);
}
mutex_unlock(&state->lock);
@@ -1415,6 +1430,19 @@ static int ov5647_s_ctrl(struct v4l2_ctr
/* v4l2_ctrl_lock() locks our own mutex */
+ if (ctrl->id == V4L2_CID_VBLANK) {
+ int exposure_max, exposure_def;
+
+ /* Update max exposure while meeting expected vblanking */
+ exposure_max = state->mode->format.height + ctrl->val - 4;
+ exposure_def = (exposure_max < OV5647_EXPOSURE_DEFAULT) ?
+ exposure_max : OV5647_EXPOSURE_DEFAULT;
+ __v4l2_ctrl_modify_range(state->exposure,
+ state->exposure->minimum,
+ exposure_max, state->exposure->step,
+ exposure_def);
+ }
+
/*
* If the device is not powered up by the host driver do
* not apply any controls to H/W at this time. Instead
@@ -1472,7 +1500,7 @@ static int ov5647_probe(struct i2c_clien
struct v4l2_subdev *sd;
struct device_node *np = client->dev.of_node;
u32 xclk_freq;
- int hblank;
+ int hblank, exposure_max, exposure_def;
sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL);
if (!sensor)
@@ -1525,12 +1553,6 @@ static int ov5647_probe(struct i2c_clien
0, /* skip_mask */
V4L2_EXPOSURE_MANUAL); /* default */
v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,
- V4L2_CID_EXPOSURE,
- 4, /* min lines */
- 65535, /* max lines (4+8+4 bits)*/
- 1, /* step */
- 1000); /* default number of lines */
- v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,
V4L2_CID_ANALOGUE_GAIN,
16, /* min, 16 = 1.0x */
1023, /* max (10 bits) */
@@ -1540,6 +1562,15 @@ static int ov5647_probe(struct i2c_clien
/* Set the default mode before we init the subdev */
sensor->mode = OV5647_DEFAULT_MODE;
+ exposure_max = sensor->mode->vts_def - 4;
+ exposure_def = (exposure_max < OV5647_EXPOSURE_DEFAULT) ?
+ exposure_max : OV5647_EXPOSURE_DEFAULT;
+ sensor->exposure = v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,
+ V4L2_CID_EXPOSURE,
+ OV5647_EXPOSURE_MIN, exposure_max,
+ OV5647_EXPOSURE_STEP,
+ exposure_def);
+
/* By default, PIXEL_RATE is read only, but it does change per mode */
sensor->pixel_rate = v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,
V4L2_CID_PIXEL_RATE,

View File

@ -1,27 +0,0 @@
From abc82e964df6c13999cff7b148b12efb255f19aa Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Fri, 22 May 2020 11:35:33 +0100
Subject: [PATCH] SQUASH: pinctrl: bcm2835: Set base for bcm2711 GPIO
to 0
Without this patch GPIOs don't seem to work properly, primarily
noticeable as broken LEDs.
Squash with "pinctrl-bcm2835: Set base to 0 give expected gpio numbering"
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
drivers/pinctrl/bcm/pinctrl-bcm2835.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
@@ -378,7 +378,7 @@ static const struct gpio_chip bcm2711_gp
.get = bcm2835_gpio_get,
.set = bcm2835_gpio_set,
.set_config = gpiochip_generic_config,
- .base = -1,
+ .base = 0,
.ngpio = BCM2711_NUM_GPIOS,
.can_sleep = false,
};

View File

@ -1,174 +0,0 @@
From 461092c036303037c0efe37002079ce6e9ed8ba5 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Wed, 20 May 2020 16:36:33 +0100
Subject: [PATCH] staging: vchiq_arm: Clean up 40-bit DMA support
Manage the split between addresses for the VPU and addresses for the
40-bit DMA controller with a dedicated DMA device pointer that on non-
BCM2711 platforms is the same as the main VCHIQ device. This allows
the VCHIQ node to stay in the usual place in the DT, and removes the
ugly VC_SAFE macros.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
staging: vchiq_arm: Use g_dma_dev for dma_unmap_sg
Commit "staging: vchiq_arm: Clean up 40-bit DMA support" failed to
change one of the calls to dma_unmap_sg to pass in g_dma_dev (rather
than g_dev). Correct that oversight.
See: https://github.com/raspberrypi/linux/issues/3647
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
.../interface/vchiq_arm/vchiq_2835_arm.c | 42 ++++++++++++-------
.../interface/vchiq_arm/vchiq_arm.c | 14 -------
2 files changed, 27 insertions(+), 29 deletions(-)
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -16,8 +16,6 @@
#include <soc/bcm2835/raspberrypi-firmware.h>
#define TOTAL_SLOTS (VCHIQ_SLOT_ZERO_SLOTS + 2 * 32)
-#define VC_SAFE(x) (g_use_36bit_addrs ? ((u32)(x) | 0xc0000000) : (u32)(x))
-#define IS_VC_SAFE(x) (g_use_36bit_addrs ? !((x) & ~0x3fffffffull) : 1)
#include "vchiq_arm.h"
#include "vchiq_connected.h"
@@ -66,6 +64,7 @@ static char *g_fragments_base;
static char *g_free_fragments;
static struct semaphore g_free_fragments_sema;
static struct device *g_dev;
+static struct device *g_dma_dev;
static DEFINE_SEMAPHORE(g_free_fragments_mutex);
@@ -82,6 +81,7 @@ free_pagelist(struct vchiq_pagelist_info
int vchiq_platform_init(struct platform_device *pdev, struct vchiq_state *state)
{
struct device *dev = &pdev->dev;
+ struct device *dma_dev = NULL;
struct vchiq_drvdata *drvdata = platform_get_drvdata(pdev);
struct rpi_firmware *fw = drvdata->fw;
struct vchiq_slot_zero *vchiq_slot_zero;
@@ -103,7 +103,23 @@ int vchiq_platform_init(struct platform_
g_cache_line_size = drvdata->cache_line_size;
g_fragments_size = 2 * g_cache_line_size;
- g_use_36bit_addrs = (dev->dma_pfn_offset == 0);
+ if (drvdata->use_36bit_addrs) {
+ struct device_node *dma_node =
+ of_find_compatible_node(NULL, NULL, "brcm,bcm2711-dma");
+
+ if (dma_node) {
+ struct platform_device *pdev;
+
+ pdev = of_find_device_by_node(dma_node);
+ if (pdev)
+ dma_dev = &pdev->dev;
+ of_node_put(dma_node);
+ g_use_36bit_addrs = true;
+ } else {
+ dev_err(dev, "40-bit DMA controller not found\n");
+ return -EINVAL;
+ }
+ }
/* Allocate space for the channels in coherent memory */
slot_mem_size = PAGE_ALIGN(TOTAL_SLOTS * VCHIQ_SLOT_SIZE);
@@ -116,14 +132,8 @@ int vchiq_platform_init(struct platform_
return -ENOMEM;
}
- if (!IS_VC_SAFE(slot_phys)) {
- dev_err(dev, "allocated DMA memory %pad is not VC-safe\n",
- &slot_phys);
- return -ENOMEM;
- }
-
WARN_ON(((unsigned long)slot_mem & (PAGE_SIZE - 1)) != 0);
- channelbase = VC_SAFE(slot_phys);
+ channelbase = slot_phys;
vchiq_slot_zero = vchiq_init_slots(slot_mem, slot_mem_size);
if (!vchiq_slot_zero)
@@ -171,6 +181,8 @@ int vchiq_platform_init(struct platform_
}
g_dev = dev;
+ g_dma_dev = dma_dev ?: dev;
+
vchiq_log_info(vchiq_arm_log_level,
"vchiq_init - done (slots %pK, phys %pad)",
vchiq_slot_zero, &slot_phys);
@@ -240,7 +252,7 @@ vchiq_prepare_bulk_data(struct vchiq_bul
if (!pagelistinfo)
return VCHIQ_ERROR;
- bulk->data = (void *)VC_SAFE(pagelistinfo->dma_addr);
+ bulk->data = pagelistinfo->dma_addr;
/*
* Store the pagelistinfo address in remote_data,
@@ -295,7 +307,7 @@ static void
cleanup_pagelistinfo(struct vchiq_pagelist_info *pagelistinfo)
{
if (pagelistinfo->scatterlist_mapped) {
- dma_unmap_sg(g_dev, pagelistinfo->scatterlist,
+ dma_unmap_sg(g_dma_dev, pagelistinfo->scatterlist,
pagelistinfo->num_pages, pagelistinfo->dma_dir);
}
@@ -444,7 +456,7 @@ create_pagelist(char *buf, char __user *
count -= len;
}
- dma_buffers = dma_map_sg(g_dev,
+ dma_buffers = dma_map_sg(g_dma_dev,
scatterlist,
num_pages,
pagelistinfo->dma_dir);
@@ -494,7 +506,7 @@ create_pagelist(char *buf, char __user *
} else {
for_each_sg(scatterlist, sg, dma_buffers, i) {
u32 len = sg_dma_len(sg);
- u32 addr = VC_SAFE(sg_dma_address(sg));
+ u32 addr = sg_dma_address(sg);
u32 new_pages = (len + PAGE_SIZE - 1) >> PAGE_SHIFT;
/* Note: addrs is the address + page_count - 1
@@ -555,7 +567,7 @@ free_pagelist(struct vchiq_pagelist_info
* NOTE: dma_unmap_sg must be called before the
* cpu can touch any of the data/pages.
*/
- dma_unmap_sg(g_dev, pagelistinfo->scatterlist,
+ dma_unmap_sg(g_dma_dev, pagelistinfo->scatterlist,
pagelistinfo->num_pages, pagelistinfo->dma_dir);
pagelistinfo->scatterlist_mapped = 0;
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -2720,22 +2720,8 @@ vchiq_register_child(struct platform_dev
child->dev.of_node = np;
- /*
- * We want the dma-ranges etc to be copied from a device with the
- * correct dma-ranges for the VPU.
- * VCHIQ on Pi4 is now under scb which doesn't get those dma-ranges.
- * Take the "dma" node as going to be suitable as it sees the world
- * through the same eyes as the VPU.
- */
- np = of_find_node_by_path("dma");
- if (!np)
- np = pdev->dev.of_node;
-
of_dma_configure(&child->dev, np, true);
- if (np != pdev->dev.of_node)
- of_node_put(np);
-
return child;
}

View File

@ -1,49 +0,0 @@
From 0f0998ed9620f676ee78eb6f606b0b2fa118bf68 Mon Sep 17 00:00:00 2001
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Date: Sat, 4 Jul 2020 01:45:08 +0300
Subject: [PATCH] media: i2c: ov5647: Parse and register properties
Parse device properties and register controls for them using the V4L2
fwnode properties helpers.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/media/i2c/ov5647.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
--- a/drivers/media/i2c/ov5647.c
+++ b/drivers/media/i2c/ov5647.c
@@ -1501,6 +1501,7 @@ static int ov5647_probe(struct i2c_clien
struct device_node *np = client->dev.of_node;
u32 xclk_freq;
int hblank, exposure_max, exposure_def;
+ struct v4l2_fwnode_device_properties props;
sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL);
if (!sensor)
@@ -1534,7 +1535,7 @@ static int ov5647_probe(struct i2c_clien
mutex_init(&sensor->lock);
/* Initialise controls. */
- v4l2_ctrl_handler_init(&sensor->ctrls, 7);
+ v4l2_ctrl_handler_init(&sensor->ctrls, 9);
v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,
V4L2_CID_AUTOGAIN,
0, /* min */
@@ -1598,6 +1599,16 @@ static int ov5647_probe(struct i2c_clien
__func__, ret);
goto error;
}
+
+ ret = v4l2_fwnode_device_parse(&client->dev, &props);
+ if (ret)
+ goto error;
+
+ ret = v4l2_ctrl_new_fwnode_properties(&sensor->ctrls, &ov5647_ctrl_ops,
+ &props);
+ if (ret)
+ goto error;
+
sensor->sd.ctrl_handler = &sensor->ctrls;
/* Write out the register set over I2C on stream-on. */

View File

@ -1,60 +0,0 @@
From 9e5b2debe12d4e840a7d3ec0cf22b215396ed46e Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Wed, 29 Jul 2020 13:47:55 +0100
Subject: [PATCH] ARM: proc-v7: Force misalignment of early stmia
In an attempt to prevent the problem of CPUn not starting, explicitly
misalign the scratch space used to save registers acros the cache
invalidation.
Notes:
At this stage in the boot process the core is running with its cache
disabled. Before enabling the cache its contents must be explicitly
invalidated, a process that requires quite a few registers that the
caller must preserve. Evidence suggests that something is writing a
block of zeroes over that space at a time when all other cores should
be idle, possibly some kind of write-combiner, and the misalignment is
designed to disrupt any write-coalescing.
In truth, I don't understand why this patch works, and when the failure
is so random it is hard to be certain that this isn't just rolling the
dice again. One interesting test would be to change the "addeq r12, #4"s
to "addeq r12, #0"s determine see if the offset itself is significant or
just the additional code.
See: https://github.com/Hexxeh/rpi-firmware/issues/232
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
arch/arm/mm/proc-v7.S | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -287,6 +287,8 @@ __v7_ca17mp_setup:
mov r10, #0
1: adr r0, __v7_setup_stack_ptr
ldr r12, [r0]
+ tst r12, #0x1f
+ addeq r12, r12, #4
add r12, r12, r0 @ the local stack
stmia r12, {r1-r6, lr} @ v7_invalidate_l1 touches r0-r6
bl v7_invalidate_l1
@@ -474,6 +476,8 @@ __v7_setup:
adr r0, __v7_setup_stack_ptr
ldr r12, [r0]
add r12, r12, r0 @ the local stack
+ tst r12, #0x1f
+ addeq r12, r12, #4
stmia r12, {r1-r6, lr} @ v7_invalidate_l1 touches r0-r6
bl v7_invalidate_l1
ldmia r12, {r1-r6, lr}
@@ -557,7 +561,7 @@ ENDPROC(__v7_setup)
.bss
.align 2
__v7_setup_stack:
- .space 4 * 7 @ 7 registers
+ .space 4 * 8 @ 7 registers + 1 spare
__INITDATA

View File

@ -1,20 +0,0 @@
From 99c87c4c80fb0dd24f6849d0846c0c4a418903a9 Mon Sep 17 00:00:00 2001
From: popcornmix <popcornmix@gmail.com>
Date: Thu, 3 Sep 2020 14:02:21 +0100
Subject: [PATCH] bcm2835-mmc: uninitialized_var is no more
---
drivers/mmc/host/bcm2835-mmc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/mmc/host/bcm2835-mmc.c
+++ b/drivers/mmc/host/bcm2835-mmc.c
@@ -367,7 +367,7 @@ static void bcm2835_bcm2835_mmc_read_blo
unsigned long flags;
size_t blksize, len, chunk;
- u32 uninitialized_var(scratch);
+ u32 scratch = 0;
u8 *buf;
blksize = host->data->blksz;

View File

@ -1,44 +0,0 @@
From 8dda85398458dc330758ef5e1408d66995ffa068 Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Thu, 7 May 2020 18:16:09 +0100
Subject: [PATCH] vc4_hdmi: Remove cec_available flag as always
supported
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
---
drivers/gpu/drm/vc4/vc4_hdmi.c | 4 ----
drivers/gpu/drm/vc4/vc4_hdmi.h | 3 ---
2 files changed, 7 deletions(-)
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -1493,9 +1493,6 @@ static int vc4_hdmi_cec_init(struct vc4_
u32 value;
int ret;
- if (!vc4_hdmi->variant->cec_available)
- return 0;
-
vc4_hdmi->cec_adap = cec_allocate_adapter(&vc4_hdmi_cec_adap_ops,
vc4_hdmi, "vc4",
CEC_CAP_DEFAULTS |
@@ -1928,7 +1925,6 @@ static const struct vc4_hdmi_variant bcm
.debugfs_name = "hdmi_regs",
.card_name = "vc4-hdmi",
.max_pixel_clock = 162000000,
- .cec_available = true,
.registers = vc4_hdmi_fields,
.num_registers = ARRAY_SIZE(vc4_hdmi_fields),
--- a/drivers/gpu/drm/vc4/vc4_hdmi.h
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.h
@@ -43,9 +43,6 @@ struct vc4_hdmi_variant {
/* Filename to expose the registers in debugfs */
const char *debugfs_name;
- /* Set to true when the CEC support is available */
- bool cec_available;
-
/* Maximum pixel clock supported by the controller (in Hz) */
unsigned long long max_pixel_clock;

View File

@ -1,124 +0,0 @@
From 80ba4d12d096a8f7855835ee54dc17d1e3a0d31a Mon Sep 17 00:00:00 2001
From: popcornmix <popcornmix@gmail.com>
Date: Tue, 10 Mar 2020 22:21:15 +0000
Subject: [PATCH] vc4_hdmi: Set HDMI_MAI_FMT
The hardware uses this for generating the right audio
data island packets when using formats other than PCM
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
---
drivers/gpu/drm/vc4/vc4_hdmi.c | 48 ++++++++++++++++++++++++++++++++++
drivers/gpu/drm/vc4/vc4_regs.h | 30 +++++++++++++++++++++
2 files changed, 78 insertions(+)
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -991,6 +991,44 @@ static void vc4_hdmi_audio_shutdown(stru
vc4_hdmi->audio.substream = NULL;
}
+static int sample_rate_to_mai_fmt(int samplerate)
+{
+ switch (samplerate) {
+ case 8000:
+ return VC4_HDMI_MAI_SAMPLE_RATE_8000;
+ case 11025:
+ return VC4_HDMI_MAI_SAMPLE_RATE_11025;
+ case 12000:
+ return VC4_HDMI_MAI_SAMPLE_RATE_12000;
+ case 16000:
+ return VC4_HDMI_MAI_SAMPLE_RATE_16000;
+ case 22050:
+ return VC4_HDMI_MAI_SAMPLE_RATE_22050;
+ case 24000:
+ return VC4_HDMI_MAI_SAMPLE_RATE_24000;
+ case 32000:
+ return VC4_HDMI_MAI_SAMPLE_RATE_32000;
+ case 44100:
+ return VC4_HDMI_MAI_SAMPLE_RATE_44100;
+ case 48000:
+ return VC4_HDMI_MAI_SAMPLE_RATE_48000;
+ case 64000:
+ return VC4_HDMI_MAI_SAMPLE_RATE_64000;
+ case 88200:
+ return VC4_HDMI_MAI_SAMPLE_RATE_88200;
+ case 96000:
+ return VC4_HDMI_MAI_SAMPLE_RATE_96000;
+ case 128000:
+ return VC4_HDMI_MAI_SAMPLE_RATE_128000;
+ case 176400:
+ return VC4_HDMI_MAI_SAMPLE_RATE_176400;
+ case 192000:
+ return VC4_HDMI_MAI_SAMPLE_RATE_192000;
+ default:
+ return VC4_HDMI_MAI_SAMPLE_RATE_NOT_INDICATED;
+ }
+}
+
/* HDMI audio codec callbacks */
static int vc4_hdmi_audio_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
@@ -1001,6 +1039,8 @@ static int vc4_hdmi_audio_hw_params(stru
struct device *dev = &vc4_hdmi->pdev->dev;
u32 audio_packet_config, channel_mask;
u32 channel_map;
+ u32 mai_audio_format;
+ u32 mai_sample_rate;
if (substream != vc4_hdmi->audio.substream)
return -EINVAL;
@@ -1021,6 +1061,14 @@ static int vc4_hdmi_audio_hw_params(stru
vc4_hdmi_audio_set_mai_clock(vc4_hdmi);
+ mai_sample_rate = sample_rate_to_mai_fmt(vc4_hdmi->audio.samplerate);
+ mai_audio_format = VC4_HDMI_MAI_FORMAT_PCM;
+ HDMI_WRITE(HDMI_MAI_FMT,
+ VC4_SET_FIELD(mai_sample_rate,
+ VC4_HDMI_MAI_FORMAT_SAMPLE_RATE) |
+ VC4_SET_FIELD(mai_audio_format,
+ VC4_HDMI_MAI_FORMAT_AUDIO_FORMAT));
+
/* The B frame identifier should match the value used by alsa-lib (8) */
audio_packet_config =
VC4_HDMI_AUDIO_PACKET_ZERO_DATA_ON_SAMPLE_FLAT |
--- a/drivers/gpu/drm/vc4/vc4_regs.h
+++ b/drivers/gpu/drm/vc4/vc4_regs.h
@@ -516,6 +516,36 @@
# define VC4_HDMI_AUDIO_PACKET_CEA_MASK_MASK VC4_MASK(7, 0)
# define VC4_HDMI_AUDIO_PACKET_CEA_MASK_SHIFT 0
+# define VC4_HDMI_MAI_FORMAT_AUDIO_FORMAT_MASK VC4_MASK(23, 16)
+# define VC4_HDMI_MAI_FORMAT_AUDIO_FORMAT_SHIFT 16
+
+enum {
+ VC4_HDMI_MAI_FORMAT_PCM = 2,
+ VC4_HDMI_MAI_FORMAT_HBR = 200,
+};
+
+# define VC4_HDMI_MAI_FORMAT_SAMPLE_RATE_MASK VC4_MASK(15, 8)
+# define VC4_HDMI_MAI_FORMAT_SAMPLE_RATE_SHIFT 8
+
+enum {
+ VC4_HDMI_MAI_SAMPLE_RATE_NOT_INDICATED = 0,
+ VC4_HDMI_MAI_SAMPLE_RATE_8000 = 1,
+ VC4_HDMI_MAI_SAMPLE_RATE_11025 = 2,
+ VC4_HDMI_MAI_SAMPLE_RATE_12000 = 3,
+ VC4_HDMI_MAI_SAMPLE_RATE_16000 = 4,
+ VC4_HDMI_MAI_SAMPLE_RATE_22050 = 5,
+ VC4_HDMI_MAI_SAMPLE_RATE_24000 = 6,
+ VC4_HDMI_MAI_SAMPLE_RATE_32000 = 7,
+ VC4_HDMI_MAI_SAMPLE_RATE_44100 = 8,
+ VC4_HDMI_MAI_SAMPLE_RATE_48000 = 9,
+ VC4_HDMI_MAI_SAMPLE_RATE_64000 = 10,
+ VC4_HDMI_MAI_SAMPLE_RATE_88200 = 11,
+ VC4_HDMI_MAI_SAMPLE_RATE_96000 = 12,
+ VC4_HDMI_MAI_SAMPLE_RATE_128000 = 13,
+ VC4_HDMI_MAI_SAMPLE_RATE_176400 = 14,
+ VC4_HDMI_MAI_SAMPLE_RATE_192000 = 15,
+};
+
# define VC4_HDMI_RAM_PACKET_ENABLE BIT(16)
/* When set, the CTS_PERIOD counts based on MAI bus sync pulse instead

View File

@ -1,119 +0,0 @@
From 29e5bf9305e98a57a895d6806fafa6e67f257fd8 Mon Sep 17 00:00:00 2001
From: Matthias Reichl <hias@horus.com>
Date: Tue, 17 Mar 2020 12:12:22 +0100
Subject: [PATCH] drm/vc4: add iec958 controls to vc4_hdmi
Although vc4 get an IEC958 formatted stream passed in from userspace
the driver needs the info from the channel status bits to properly
set up the hardware, eg for HBR passthrough.
Add iec958 controls so the channel status bits can be passed in
from userspace.
Signed-off-by: Matthias Reichl <hias@horus.com>
---
drivers/gpu/drm/vc4/vc4_hdmi.c | 60 ++++++++++++++++++++++++++++++++++
drivers/gpu/drm/vc4/vc4_hdmi.h | 2 ++
2 files changed, 62 insertions(+)
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -44,6 +44,7 @@
#include <linux/pm_runtime.h>
#include <linux/rational.h>
#include <linux/reset.h>
+#include <sound/asoundef.h>
#include <sound/dmaengine_pcm.h>
#include <sound/pcm_drm_eld.h>
#include <sound/pcm_params.h>
@@ -1182,6 +1183,47 @@ static int vc4_hdmi_audio_eld_ctl_get(st
return 0;
}
+static int vc4_spdif_info(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_info *uinfo)
+{
+ uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
+ uinfo->count = 1;
+ return 0;
+}
+
+static int vc4_spdif_playback_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct vc4_hdmi *vc4_hdmi = snd_component_to_hdmi(component);
+
+ memcpy(ucontrol->value.iec958.status, vc4_hdmi->audio.iec_status,
+ sizeof(vc4_hdmi->audio.iec_status));
+
+ return 0;
+}
+
+static int vc4_spdif_playback_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct vc4_hdmi *vc4_hdmi = snd_component_to_hdmi(component);
+
+ memcpy(vc4_hdmi->audio.iec_status, ucontrol->value.iec958.status,
+ sizeof(vc4_hdmi->audio.iec_status));
+
+ return 0;
+}
+
+static int vc4_spdif_mask_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ memset(ucontrol->value.iec958.status, 0xff,
+ sizeof_field(struct vc4_hdmi_audio, iec_status));
+
+ return 0;
+}
+
static const struct snd_kcontrol_new vc4_hdmi_audio_controls[] = {
{
.access = SNDRV_CTL_ELEM_ACCESS_READ |
@@ -1191,6 +1233,19 @@ static const struct snd_kcontrol_new vc4
.info = vc4_hdmi_audio_eld_ctl_info,
.get = vc4_hdmi_audio_eld_ctl_get,
},
+ {
+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+ .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT),
+ .info = vc4_spdif_info,
+ .get = vc4_spdif_playback_get,
+ .put = vc4_spdif_playback_put,
+ },
+ {
+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+ .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, MASK),
+ .info = vc4_spdif_info,
+ .get = vc4_spdif_mask_get,
+ },
};
static const struct snd_soc_dapm_widget vc4_hdmi_audio_widgets[] = {
@@ -1311,6 +1366,11 @@ static int vc4_hdmi_audio_init(struct vc
vc4_hdmi->audio.dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
vc4_hdmi->audio.dma_data.maxburst = 2;
+ vc4_hdmi->audio.iec_status[0] = IEC958_AES0_CON_NOT_COPYRIGHT;
+ vc4_hdmi->audio.iec_status[1] =
+ IEC958_AES1_CON_ORIGINAL | IEC958_AES1_CON_PCM_CODER;
+ vc4_hdmi->audio.iec_status[3] = IEC958_AES3_CON_FS_48000;
+
ret = devm_snd_dmaengine_pcm_register(dev, &pcm_conf, 0);
if (ret) {
dev_err(dev, "Could not register PCM component: %d\n", ret);
--- a/drivers/gpu/drm/vc4/vc4_hdmi.h
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.h
@@ -107,6 +107,8 @@ struct vc4_hdmi_audio {
struct snd_pcm_substream *substream;
bool streaming;
+
+ unsigned char iec_status[4];
};
/* General HDMI hardware state. */

View File

@ -1,58 +0,0 @@
From 7b6cfdfc74c7e9c00060a0c4146a6358b261f7db Mon Sep 17 00:00:00 2001
From: Matthias Reichl <hias@horus.com>
Date: Thu, 19 Mar 2020 20:00:35 +0100
Subject: [PATCH] drm/vc4: move setup from hw_params to prepare
Configuring HDMI audio registers in prepare allows us to take
IEC958 bits into account which are set by the alsa hook after
the hw_params call.
Signed-off-by: Matthias Reichl <hias@horus.com>
---
drivers/gpu/drm/vc4/vc4_hdmi.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -1031,9 +1031,8 @@ static int sample_rate_to_mai_fmt(int sa
}
/* HDMI audio codec callbacks */
-static int vc4_hdmi_audio_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params,
- struct snd_soc_dai *dai)
+static int vc4_hdmi_audio_prepare(struct snd_pcm_substream *substream,
+ struct snd_soc_dai *dai)
{
struct vc4_hdmi *vc4_hdmi = dai_to_hdmi(dai);
struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base;
@@ -1046,12 +1045,15 @@ static int vc4_hdmi_audio_hw_params(stru
if (substream != vc4_hdmi->audio.substream)
return -EINVAL;
- dev_dbg(dev, "%s: %u Hz, %d bit, %d channels\n", __func__,
- params_rate(params), params_width(params),
- params_channels(params));
+ dev_dbg(dev, "%s: %u Hz, %d bit, %d channels AES0=%02x\n",
+ __func__,
+ substream->runtime->rate,
+ snd_pcm_format_width(substream->runtime->format),
+ substream->runtime->channels,
+ vc4_hdmi->audio.iec_status[0]);
- vc4_hdmi->audio.channels = params_channels(params);
- vc4_hdmi->audio.samplerate = params_rate(params);
+ vc4_hdmi->audio.channels = substream->runtime->channels;
+ vc4_hdmi->audio.samplerate = substream->runtime->rate;
HDMI_WRITE(HDMI_MAI_CTL,
VC4_HD_MAI_CTL_RESET |
@@ -1273,7 +1275,7 @@ static const struct snd_soc_component_dr
static const struct snd_soc_dai_ops vc4_hdmi_audio_dai_ops = {
.startup = vc4_hdmi_audio_startup,
.shutdown = vc4_hdmi_audio_shutdown,
- .hw_params = vc4_hdmi_audio_hw_params,
+ .prepare = vc4_hdmi_audio_prepare,
.set_fmt = vc4_hdmi_audio_set_fmt,
.trigger = vc4_hdmi_audio_trigger,
};

View File

@ -1,25 +0,0 @@
From 465b5e6889b1af1c9c061751a0ee234a27644030 Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Fri, 10 Jul 2020 11:51:16 +0100
Subject: [PATCH] drm/vc4: enable HBR MAI format on HBR streams
Signed-off-by: Matthias Reichl <hias@horus.com>
---
drivers/gpu/drm/vc4/vc4_hdmi.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -1065,7 +1065,11 @@ static int vc4_hdmi_audio_prepare(struct
vc4_hdmi_audio_set_mai_clock(vc4_hdmi);
mai_sample_rate = sample_rate_to_mai_fmt(vc4_hdmi->audio.samplerate);
- mai_audio_format = VC4_HDMI_MAI_FORMAT_PCM;
+ if (vc4_hdmi->audio.iec_status[0] & IEC958_AES0_NONAUDIO &&
+ vc4_hdmi->audio.channels == 8)
+ mai_audio_format = VC4_HDMI_MAI_FORMAT_HBR;
+ else
+ mai_audio_format = VC4_HDMI_MAI_FORMAT_PCM;
HDMI_WRITE(HDMI_MAI_FMT,
VC4_SET_FIELD(mai_sample_rate,
VC4_HDMI_MAI_FORMAT_SAMPLE_RATE) |

View File

@ -1,47 +0,0 @@
From 3c398513990aa0edc5b9ebfbdd2395623562c6e4 Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Thu, 25 Jun 2020 18:48:40 +0100
Subject: [PATCH] vc4_hdmi: Remove firmware logic for MAI threshold
setting
This was a workaround for bugs in hardware on earlier Pi models
and wasn't totally successful.
It makes audio quality worse on a Pi4 at the higher sample rates
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
---
drivers/gpu/drm/vc4/vc4_hdmi.c | 22 ++++++----------------
1 file changed, 6 insertions(+), 16 deletions(-)
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -1086,22 +1086,12 @@ static int vc4_hdmi_audio_prepare(struct
audio_packet_config |= VC4_SET_FIELD(channel_mask,
VC4_HDMI_AUDIO_PACKET_CEA_MASK);
- /* Set the MAI threshold. This logic mimics the firmware's. */
- if (vc4_hdmi->audio.samplerate > 96000) {
- HDMI_WRITE(HDMI_MAI_THR,
- VC4_SET_FIELD(0x12, VC4_HD_MAI_THR_DREQHIGH) |
- VC4_SET_FIELD(0x12, VC4_HD_MAI_THR_DREQLOW));
- } else if (vc4_hdmi->audio.samplerate > 48000) {
- HDMI_WRITE(HDMI_MAI_THR,
- VC4_SET_FIELD(0x14, VC4_HD_MAI_THR_DREQHIGH) |
- VC4_SET_FIELD(0x12, VC4_HD_MAI_THR_DREQLOW));
- } else {
- HDMI_WRITE(HDMI_MAI_THR,
- VC4_SET_FIELD(0x10, VC4_HD_MAI_THR_PANICHIGH) |
- VC4_SET_FIELD(0x10, VC4_HD_MAI_THR_PANICLOW) |
- VC4_SET_FIELD(0x10, VC4_HD_MAI_THR_DREQHIGH) |
- VC4_SET_FIELD(0x10, VC4_HD_MAI_THR_DREQLOW));
- }
+ /* Set the MAI threshold */
+ HDMI_WRITE(HDMI_MAI_THR,
+ VC4_SET_FIELD(0x10, VC4_HD_MAI_THR_PANICHIGH) |
+ VC4_SET_FIELD(0x10, VC4_HD_MAI_THR_PANICLOW) |
+ VC4_SET_FIELD(0x10, VC4_HD_MAI_THR_DREQHIGH) |
+ VC4_SET_FIELD(0x10, VC4_HD_MAI_THR_DREQLOW));
HDMI_WRITE(HDMI_MAI_CONFIG,
VC4_HDMI_MAI_CONFIG_BIT_REVERSE |

View File

@ -1,24 +0,0 @@
From f4a590c59a65381a0b9aa045e5fc493b3dbb5945 Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Tue, 30 Jun 2020 11:23:49 +0100
Subject: [PATCH] vc_hdmi: Set VC4_HDMI_MAI_CONFIG_FORMAT_REVERSE
Without this bit set, HDMI_MAI_FORMAT doesn't pick up
the format and samplerate from DVP_CFG_MAI0_FMT and you
can't get HDMI_HDMI_13_AUDIO_STATUS_1 to indicate HBR mode
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
---
drivers/gpu/drm/vc4/vc4_hdmi.c | 1 +
1 file changed, 1 insertion(+)
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -1095,6 +1095,7 @@ static int vc4_hdmi_audio_prepare(struct
HDMI_WRITE(HDMI_MAI_CONFIG,
VC4_HDMI_MAI_CONFIG_BIT_REVERSE |
+ VC4_HDMI_MAI_CONFIG_FORMAT_REVERSE |
VC4_SET_FIELD(channel_mask, VC4_HDMI_MAI_CHANNEL_MASK));
channel_map = vc4_hdmi->variant->channel_map(vc4_hdmi, channel_mask);

View File

@ -1,67 +0,0 @@
From 97a2cff029c6c8f7f2550935e6110b81c69bc34a Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Thu, 19 Mar 2020 10:04:46 +0000
Subject: [PATCH] ARM: dts: bcm271x: Use a53 pmu, drop RPI364
The upstream bcm2837.dtsi uses cortex-a53-pmu, so we can do the same
but with a fallback to the cortex-a7-pmu which is supported by the
32-bit kernel.
Now that we're using the natural fallback mechanism of compatible
strings, the RPI364 macro no longer serves any purpose - remove it.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
arch/arm/boot/dts/bcm2710.dtsi | 6 +-----
arch/arm64/boot/dts/broadcom/bcm2710-rpi-2-b.dts | 2 --
arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b-plus.dts | 2 --
arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dts | 2 --
arch/arm64/boot/dts/broadcom/bcm2710-rpi-cm3.dts | 2 --
arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b.dts | 2 --
6 files changed, 1 insertion(+), 15 deletions(-)
--- a/arch/arm/boot/dts/bcm2710.dtsi
+++ b/arch/arm/boot/dts/bcm2710.dtsi
@@ -5,11 +5,7 @@
compatible = "brcm,bcm2837", "brcm,bcm2836";
arm-pmu {
-#ifdef RPI364
- compatible = "arm,armv8-pmuv3", "arm,cortex-a7-pmu";
-#else
- compatible = "arm,cortex-a7-pmu";
-#endif
+ compatible = "arm,cortex-a53-pmu", "arm,cortex-a7-pmu";
};
soc {
--- a/arch/arm64/boot/dts/broadcom/bcm2710-rpi-2-b.dts
+++ b/arch/arm64/boot/dts/broadcom/bcm2710-rpi-2-b.dts
@@ -1,3 +1 @@
-#define RPI364
-
#include "../../../../arm/boot/dts/bcm2710-rpi-2-b.dts"
--- a/arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b-plus.dts
+++ b/arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b-plus.dts
@@ -1,3 +1 @@
-#define RPI364
-
#include "../../../../arm/boot/dts/bcm2710-rpi-3-b-plus.dts"
--- a/arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dts
+++ b/arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dts
@@ -1,3 +1 @@
-#define RPI364
-
#include "../../../../arm/boot/dts/bcm2710-rpi-3-b.dts"
--- a/arch/arm64/boot/dts/broadcom/bcm2710-rpi-cm3.dts
+++ b/arch/arm64/boot/dts/broadcom/bcm2710-rpi-cm3.dts
@@ -1,3 +1 @@
-#define RPI364
-
#include "../../../../arm/boot/dts/bcm2710-rpi-cm3.dts"
--- a/arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b.dts
+++ b/arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b.dts
@@ -1,3 +1 @@
-#define RPI364
-
#include "../../../../arm/boot/dts/bcm2711-rpi-4-b.dts"

View File

@ -1,36 +0,0 @@
From 8c4205446ace4f14ec8725d11f46b570e9bc1fd3 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Fri, 23 Oct 2020 14:15:41 +0100
Subject: [PATCH] overlays: Add option to disable composite to
vc4-kms-v3d
Composite gets enabled automatically if HDMI isn't detected,
which can cause some grief in X should it be not connected
and touchscreens are in use.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
arch/arm/boot/dts/overlays/README | 2 ++
arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts | 1 +
2 files changed, 3 insertions(+)
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -2949,6 +2949,8 @@ Params: cma-512 CMA is 5
cma-default Use upstream's default value
audio Enable or disable audio over HDMI (default "on")
noaudio Disable all HDMI audio (default "off")
+ nocomposite Disable the composite video output (default
+ "off")
Name: vc4-kms-v3d-pi4
--- a/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts
+++ b/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts
@@ -118,5 +118,6 @@
__overrides__ {
audio = <0>,"!13", <0>,"=14";
noaudio = <0>,"=13", <0>,"!14";
+ nocomposite = <0>, "!11";
};
};

View File

@ -1,25 +0,0 @@
From 7ba47043d428bce18161417f134ca6492d097744 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Wed, 11 Mar 2020 12:07:57 +0000
Subject: [PATCH] overlays: imx219: Correct link frequency to match the
upstream driver
The upstream driver is checking the link frequency parameter, and
the overlay had the wrong value.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
arch/arm/boot/dts/overlays/imx219-overlay.dts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/arch/arm/boot/dts/overlays/imx219-overlay.dts
+++ b/arch/arm/boot/dts/overlays/imx219-overlay.dts
@@ -36,7 +36,7 @@
data-lanes = <1 2>;
clock-noncontinuous;
link-frequencies =
- /bits/ 64 <297000000>;
+ /bits/ 64 <456000000>;
};
};
};

View File

@ -1,28 +0,0 @@
From aa9f4bd2a82bc227bc5d11939ad3cacb7a2663e6 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Fri, 23 Oct 2020 15:45:11 +0100
Subject: [PATCH] dts: Add CM4 to arm64 dt files
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
arch/arm64/boot/dts/broadcom/Makefile | 3 ++-
arch/arm64/boot/dts/broadcom/bcm2711-rpi-cm4.dts | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
create mode 100644 arch/arm64/boot/dts/broadcom/bcm2711-rpi-cm4.dts
--- a/arch/arm64/boot/dts/broadcom/Makefile
+++ b/arch/arm64/boot/dts/broadcom/Makefile
@@ -7,7 +7,8 @@ dtb-$(CONFIG_ARCH_BCM2709) += bcm2710-rp
dtb-$(CONFIG_ARCH_BCM2709) += bcm2710-rpi-3-b.dtb
dtb-$(CONFIG_ARCH_BCM2835) += bcm2710-rpi-2-b.dtb
dtb-$(CONFIG_ARCH_BCM2835) += bcm2710-rpi-3-b.dtb
-dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-4-b.dtb
+dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-4-b.dtb \
+ bcm2711-rpi-cm4.dtb
dtb-$(CONFIG_ARCH_BCM2835) += bcm2710-rpi-3-b-plus.dtb
dtb-$(CONFIG_ARCH_BCM2709) += bcm2710-rpi-cm3.dtb
dtb-$(CONFIG_ARCH_BCM2835) += bcm2710-rpi-cm3.dtb
--- /dev/null
+++ b/arch/arm64/boot/dts/broadcom/bcm2711-rpi-cm4.dts
@@ -0,0 +1 @@
+#include "../../../../arm/boot/dts/bcm2711-rpi-cm4.dts"

View File

@ -1,43 +0,0 @@
From 8364d0445bde9900c7ef8e6f6d4ba2642dca0807 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Mon, 26 Oct 2020 15:01:21 +0000
Subject: [PATCH] dts: Tidy the Raspberry Pi Makefile entries
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
arch/arm/boot/dts/Makefile | 2 +-
arch/arm64/boot/dts/broadcom/Makefile | 7 ++-----
2 files changed, 3 insertions(+), 6 deletions(-)
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -10,8 +10,8 @@ dtb-$(CONFIG_ARCH_BCM2835) += \
bcm2709-rpi-2-b.dtb \
bcm2710-rpi-2-b.dtb \
bcm2710-rpi-3-b.dtb \
- bcm2711-rpi-4-b.dtb \
bcm2710-rpi-3-b-plus.dtb \
+ bcm2711-rpi-4-b.dtb \
bcm2710-rpi-cm3.dtb \
bcm2711-rpi-cm4.dtb
--- a/arch/arm64/boot/dts/broadcom/Makefile
+++ b/arch/arm64/boot/dts/broadcom/Makefile
@@ -3,15 +3,12 @@ dtb-$(CONFIG_ARCH_BCM2835) += bcm2837-rp
bcm2837-rpi-3-b.dtb \
bcm2837-rpi-3-b-plus.dtb \
bcm2837-rpi-cm3-io3.dtb
-dtb-$(CONFIG_ARCH_BCM2709) += bcm2710-rpi-2-b.dtb
-dtb-$(CONFIG_ARCH_BCM2709) += bcm2710-rpi-3-b.dtb
dtb-$(CONFIG_ARCH_BCM2835) += bcm2710-rpi-2-b.dtb
dtb-$(CONFIG_ARCH_BCM2835) += bcm2710-rpi-3-b.dtb
-dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-4-b.dtb \
- bcm2711-rpi-cm4.dtb
dtb-$(CONFIG_ARCH_BCM2835) += bcm2710-rpi-3-b-plus.dtb
-dtb-$(CONFIG_ARCH_BCM2709) += bcm2710-rpi-cm3.dtb
+dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-4-b.dtb
dtb-$(CONFIG_ARCH_BCM2835) += bcm2710-rpi-cm3.dtb
+dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-cm4.dtb
subdir-y += northstar2
subdir-y += stingray

View File

@ -1,42 +0,0 @@
From 895b2a5d3578ff5b91be41eb099280e2c63cb25c Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Mon, 26 Oct 2020 10:18:50 +0000
Subject: [PATCH] ARM: dts: Disable headphone audio on Zeroes, CM4
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
arch/arm/boot/dts/bcm2708-rpi-zero-w.dts | 1 +
arch/arm/boot/dts/bcm2708-rpi-zero.dts | 1 +
arch/arm/boot/dts/bcm2711-rpi-cm4.dts | 1 +
3 files changed, 3 insertions(+)
--- a/arch/arm/boot/dts/bcm2708-rpi-zero-w.dts
+++ b/arch/arm/boot/dts/bcm2708-rpi-zero-w.dts
@@ -152,6 +152,7 @@
&audio {
pinctrl-names = "default";
pinctrl-0 = <&audio_pins>;
+ brcm,disable-headphones = <1>;
};
/ {
--- a/arch/arm/boot/dts/bcm2708-rpi-zero.dts
+++ b/arch/arm/boot/dts/bcm2708-rpi-zero.dts
@@ -106,6 +106,7 @@
&audio {
pinctrl-names = "default";
pinctrl-0 = <&audio_pins>;
+ brcm,disable-headphones = <1>;
};
/ {
--- a/arch/arm/boot/dts/bcm2711-rpi-cm4.dts
+++ b/arch/arm/boot/dts/bcm2711-rpi-cm4.dts
@@ -574,6 +574,7 @@
&audio {
pinctrl-names = "default";
pinctrl-0 = <&audio_pins>;
+ brcm,disable-headphones = <1>;
};
/ {

View File

@ -1,26 +0,0 @@
From b16e7c1d42fafe29a34e8e0449c2d94debb38dc4 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Mon, 26 Oct 2020 10:21:23 +0000
Subject: [PATCH] overlays: Enable headphone audio in audremap
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
arch/arm/boot/dts/overlays/audremap-overlay.dts | 7 +++++++
1 file changed, 7 insertions(+)
--- a/arch/arm/boot/dts/overlays/audremap-overlay.dts
+++ b/arch/arm/boot/dts/overlays/audremap-overlay.dts
@@ -26,6 +26,13 @@
};
};
+ fragment@3 {
+ target = <&audio>;
+ __overlay__ {
+ brcm,disable-headphones = <0>;
+ };
+ };
+
__overrides__ {
swap_lr = <&frag0>, "swap_lr?";
enable_jack = <&frag0>, "enable_jack?";

View File

@ -1,30 +0,0 @@
From f78a15dcaf63a5ad478670fd1d52d85261e88f37 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Mon, 26 Oct 2020 10:35:43 +0000
Subject: [PATCH] ARM: dts: Expand PCIe space on BCM2711
Attempts to connect external GPUs to Compute Module 4's PCIe bus have
highlighted that the existing "outbound window" - the fraction of the
PCI address base that is appears in the host's memory map - is
restrictively small. Expand the window to a full 1GB.
See: https://www.raspberrypi.org/forums/viewtopic.php?f=98&t=288902
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
arch/arm/boot/dts/bcm2711.dtsi | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/arch/arm/boot/dts/bcm2711.dtsi
+++ b/arch/arm/boot/dts/bcm2711.dtsi
@@ -560,8 +560,8 @@
msi-controller;
msi-parent = <&pcie0>;
- ranges = <0x02000000 0x0 0xf8000000 0x6 0x00000000
- 0x0 0x04000000>;
+ ranges = <0x02000000 0x0 0xc0000000 0x6 0x00000000
+ 0x0 0x40000000>;
/*
* The wrapper around the PCIe block has a bug
* preventing it from accessing beyond the first 3GB of

View File

@ -1,22 +0,0 @@
From f6df23eb130f2407565db92e60b66a56b9b6fdea Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Tue, 27 Oct 2020 12:10:04 +0000
Subject: [PATCH] gpio-fsm: Fix a build warning
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
drivers/gpio/gpio-fsm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/gpio/gpio-fsm.c
+++ b/drivers/gpio/gpio-fsm.c
@@ -956,7 +956,8 @@ static int gpio_fsm_probe(struct platfor
// add reserved words to the symbol table
for (i = 0; i < ARRAY_SIZE(reserved_symbols); i++) {
if (reserved_symbols[i])
- add_symbol(&gf->symtab, reserved_symbols[i], (void *)i);
+ add_symbol(&gf->symtab, reserved_symbols[i],
+ (void *)(uintptr_t)i);
}
// parse the state

View File

@ -1,91 +0,0 @@
From 5dd5b4625a4435f64ee6a1c9f47e3609e771f14b Mon Sep 17 00:00:00 2001
From: David Knell <david.knell@gmail.com>
Date: Wed, 28 Oct 2020 14:20:56 +0000
Subject: [PATCH] PiFi-40 Devicetree files
Signed-off-by: David Knell <david.knell@gmail.com>
---
arch/arm/boot/dts/overlays/Makefile | 1 +
arch/arm/boot/dts/overlays/README | 6 +++
.../arm/boot/dts/overlays/pifi-40-overlay.dts | 50 +++++++++++++++++++
3 files changed, 57 insertions(+)
create mode 100644 arch/arm/boot/dts/overlays/pifi-40-overlay.dts
--- a/arch/arm/boot/dts/overlays/Makefile
+++ b/arch/arm/boot/dts/overlays/Makefile
@@ -125,6 +125,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
pca953x.dtbo \
pibell.dtbo \
pifacedigital.dtbo \
+ pifi-40.dtbo \
piglow.dtbo \
piscreen.dtbo \
piscreen2r.dtbo \
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -2000,6 +2000,12 @@ Params: spi-present-mask 8-bit in
0-3, which can be configured with JP1 and JP2.
+Name: pifi-40
+Info: Configures the PiFi 40W stereo amplifier
+Load: dtoverlay=pifi-40
+Params: <None>
+
+
Name: piglow
Info: Configures the PiGlow by pimoroni.com
Load: dtoverlay=piglow
--- /dev/null
+++ b/arch/arm/boot/dts/overlays/pifi-40-overlay.dts
@@ -0,0 +1,50 @@
+// Definitions for PiFi-40 Amp
+/dts-v1/;
+/plugin/;
+#include <dt-bindings/gpio/gpio.h>
+/ {
+ compatible = "brcm,bcm2835";
+
+ fragment@0 {
+ target = <&i2s>;
+ __overlay__ {
+ status = "okay";
+ };
+ };
+
+ fragment@1 {
+ target = <&i2c1>;
+ __overlay__ {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "okay";
+
+ tas5711l: audio-codec@1a {
+ compatible = "ti,tas5711";
+ reg = <0x1a>;
+ #sound-dai-cells = <0>;
+ sound-name-prefix = "Left";
+ status = "okay";
+ };
+
+ tas5711r: audio-codec@1b {
+ compatible = "ti,tas5711";
+ reg = <0x1b>;
+ #sound-dai-cells = <0>;
+ sound-name-prefix = "Right";
+ status = "okay";
+ };
+ };
+ };
+
+ fragment@2 {
+ target = <&sound>;
+ pifi_40: __overlay__ {
+ compatible = "pifi,pifi-40";
+ audio-codec = <&tas5711l &tas5711r>;
+ i2s-controller = <&i2s>;
+ pdn-gpios = <&gpio 23 1>;
+ status = "okay";
+ };
+ };
+};

View File

@ -1,332 +0,0 @@
From 0fa0f5932fff8c960862176fd61a7bccd2f28b90 Mon Sep 17 00:00:00 2001
From: David Knell <david.knell@gmail.com>
Date: Wed, 28 Oct 2020 14:21:37 +0000
Subject: [PATCH] PiFi-40 driver, Makefile and Kconfig
Signed-off-by: David Knell <david.knell@gmail.com>
---
sound/soc/bcm/Kconfig | 8 ++
sound/soc/bcm/Makefile | 3 +
sound/soc/bcm/pifi-40.c | 283 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 294 insertions(+)
create mode 100644 sound/soc/bcm/pifi-40.c
--- a/sound/soc/bcm/Kconfig
+++ b/sound/soc/bcm/Kconfig
@@ -100,6 +100,14 @@ config SND_BCM2708_SOC_HIFIBERRY_AMP
help
Say Y or M if you want to add support for the HifiBerry Amp amplifier board.
+ config SND_BCM2708_SOC_PIFI_40
+ tristate "Support for the PiFi-40 amp"
+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S
+ select SND_SOC_TAS571X
+ select SND_PIFI_40
+ help
+ Say Y or M if you want to add support for the PiFi40 amp board
+
config SND_BCM2708_SOC_RPI_CIRRUS
tristate "Support for Cirrus Logic Audio Card"
depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S
--- a/sound/soc/bcm/Makefile
+++ b/sound/soc/bcm/Makefile
@@ -45,6 +45,7 @@ snd-soc-pisound-objs := pisound.o
snd-soc-fe-pi-audio-objs := fe-pi-audio.o
snd-soc-rpi-simple-soundcard-objs := rpi-simple-soundcard.o
snd-soc-rpi-wm8804-soundcard-objs := rpi-wm8804-soundcard.o
+snd-soc-pifi-40-objs := pifi-40.o
obj-$(CONFIG_SND_BCM2708_SOC_GOOGLEVOICEHAT_SOUNDCARD) += snd-soc-googlevoicehat-codec.o
obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o
@@ -74,3 +75,5 @@ obj-$(CONFIG_SND_PISOUND) += snd-soc-pis
obj-$(CONFIG_SND_BCM2708_SOC_FE_PI_AUDIO) += snd-soc-fe-pi-audio.o
obj-$(CONFIG_SND_RPI_SIMPLE_SOUNDCARD) += snd-soc-rpi-simple-soundcard.o
obj-$(CONFIG_SND_RPI_WM8804_SOUNDCARD) += snd-soc-rpi-wm8804-soundcard.o
+obj-$(CONFIG_SND_BCM2708_SOC_PIFI_40) += snd-soc-pifi-40.o
+
--- /dev/null
+++ b/sound/soc/bcm/pifi-40.c
@@ -0,0 +1,283 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * ALSA ASoC Machine Driver for PiFi-40
+ *
+ * Author: David Knell <david.knell@gmail.com)
+ * based on code by Daniel Matuschek <info@crazy-audio.com>
+ * based on code by Florian Meier <florian.meier@koalo.de>
+ * Copyright (C) 2020
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/gpio/consumer.h>
+#include <sound/core.h>
+#include <sound/pcm.h>
+#include <sound/pcm_params.h>
+#include <sound/soc.h>
+#include <linux/firmware.h>
+#include <linux/delay.h>
+#include <sound/tlv.h>
+
+static struct gpio_desc *pdn_gpio;
+static int vol = 0x30;
+
+// Volume control
+static int pifi_40_vol_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ ucontrol->value.integer.value[0] = vol;
+ ucontrol->value.integer.value[1] = vol;
+ return 0;
+}
+
+static int pifi_40_vol_set(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
+ struct snd_soc_pcm_runtime *rtd;
+ unsigned int v = ucontrol->value.integer.value[0];
+ struct snd_soc_component *dac[2];
+
+ rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]);
+ dac[0] = asoc_rtd_to_codec(rtd, 0)->component;
+ dac[1] = asoc_rtd_to_codec(rtd, 1)->component;
+
+ snd_soc_component_write(dac[0], 0x07, 255 - v);
+ snd_soc_component_write(dac[1], 0x07, 255 - v);
+
+ vol = v;
+ return 1;
+}
+
+static const DECLARE_TLV_DB_SCALE(digital_tlv_master, -10350, 50, 1);
+static const struct snd_kcontrol_new pifi_40_controls[] = {
+ SOC_DOUBLE_R_EXT_TLV("Master Volume", 0x00, 0x01,
+ 0x00, // Min
+ 0xff, // Max
+ 0x01, // Invert
+ pifi_40_vol_get, pifi_40_vol_set,
+ digital_tlv_master)
+};
+
+static const char * const codec_ctl_pfx[] = { "Left", "Right" };
+
+static const char * const codec_ctl_name[] = { "Master Volume",
+ "Speaker Volume",
+ "Speaker Switch" };
+
+static int snd_pifi_40_init(struct snd_soc_pcm_runtime *rtd)
+{
+ struct snd_soc_card *card = rtd->card;
+ struct snd_soc_component *dac[2];
+ struct snd_kcontrol *kctl;
+ int i, j;
+
+ dac[0] = asoc_rtd_to_codec(rtd, 0)->component;
+ dac[1] = asoc_rtd_to_codec(rtd, 1)->component;
+
+
+ // Set up cards - pulse power down first
+ gpiod_set_value_cansleep(pdn_gpio, 1);
+ usleep_range(1000, 10000);
+ gpiod_set_value_cansleep(pdn_gpio, 0);
+ usleep_range(20000, 30000);
+
+ // Oscillator trim
+ snd_soc_component_write(dac[0], 0x1b, 0);
+ snd_soc_component_write(dac[1], 0x1b, 0);
+ usleep_range(60000, 80000);
+
+ // Common setup
+ for (i = 0; i < 2; i++) {
+ // MCLK at 64fs, sample rate 44.1 or 48kHz
+ snd_soc_component_write(dac[i], 0x00, 0x60);
+
+ // Set up for PBTL
+ snd_soc_component_write(dac[i], 0x19, 0x3A);
+ snd_soc_component_write(dac[i], 0x25, 0x01103245);
+
+ // Master vol to -10db
+ snd_soc_component_write(dac[i], 0x07, 0x44);
+ }
+ // Inputs set to L and R respectively
+ snd_soc_component_write(dac[0], 0x20, 0x00017772);
+ snd_soc_component_write(dac[1], 0x20, 0x00107772);
+
+ // Remove codec controls
+ for (i = 0; i < 2; i++) {
+ for (j = 0; j < 3; j++) {
+ char cname[256];
+
+ sprintf(cname, "%s %s", codec_ctl_pfx[i],
+ codec_ctl_name[j]);
+ kctl = snd_soc_card_get_kcontrol(card, cname);
+ if (!kctl) {
+ pr_info("Control %s not found\n",
+ cname);
+ } else {
+ kctl->vd[0].access =
+ SNDRV_CTL_ELEM_ACCESS_READWRITE;
+ snd_ctl_remove(card->snd_card, kctl);
+ }
+ }
+ }
+
+ return 0;
+}
+
+static int snd_pifi_40_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params)
+{
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
+ unsigned int sample_bits;
+
+ sample_bits = snd_pcm_format_physical_width(params_format(params));
+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 64);
+}
+
+static struct snd_soc_ops snd_pifi_40_ops = { .hw_params =
+ snd_pifi_40_hw_params };
+
+static struct snd_soc_dai_link_component pifi_40_codecs[] = {
+ {
+ .dai_name = "tas571x-hifi",
+ },
+ {
+ .dai_name = "tas571x-hifi",
+ },
+};
+
+SND_SOC_DAILINK_DEFS(
+ pifi_40_dai, DAILINK_COMP_ARRAY(COMP_EMPTY()),
+ DAILINK_COMP_ARRAY(COMP_CODEC("tas571x.1-001a", "tas571x-hifi"),
+ COMP_CODEC("tas571x.1-001b", "tas571x-hifi")),
+ DAILINK_COMP_ARRAY(COMP_EMPTY()));
+
+static struct snd_soc_dai_link snd_pifi_40_dai[] = {
+ {
+ .name = "PiFi40",
+ .stream_name = "PiFi40",
+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
+ SND_SOC_DAIFMT_CBS_CFS,
+ .ops = &snd_pifi_40_ops,
+ .init = snd_pifi_40_init,
+ SND_SOC_DAILINK_REG(pifi_40_dai),
+ },
+};
+
+// Machine driver
+static struct snd_soc_card snd_pifi_40 = {
+ .name = "PiFi40",
+ .owner = THIS_MODULE,
+ .dai_link = snd_pifi_40_dai,
+ .num_links = ARRAY_SIZE(snd_pifi_40_dai),
+ .controls = pifi_40_controls,
+ .num_controls = ARRAY_SIZE(pifi_40_controls)
+};
+
+static void snd_pifi_40_pdn(struct snd_soc_card *card, int on)
+{
+ if (pdn_gpio)
+ gpiod_set_value_cansleep(pdn_gpio, on ? 0 : 1);
+}
+
+static int snd_pifi_40_probe(struct platform_device *pdev)
+{
+ struct snd_soc_card *card = &snd_pifi_40;
+ int ret = 0, i = 0;
+
+ card->dev = &pdev->dev;
+ platform_set_drvdata(pdev, &snd_pifi_40);
+
+ if (pdev->dev.of_node) {
+ struct device_node *i2s_node;
+ struct snd_soc_dai_link *dai;
+
+ dai = &snd_pifi_40_dai[0];
+ i2s_node = of_parse_phandle(pdev->dev.of_node, "i2s-controller",
+ 0);
+ if (i2s_node) {
+ for (i = 0; i < card->num_links; i++) {
+ dai->cpus->dai_name = NULL;
+ dai->cpus->of_node = i2s_node;
+ dai->platforms->name = NULL;
+ dai->platforms->of_node = i2s_node;
+ }
+ }
+
+ pifi_40_codecs[0].of_node =
+ of_parse_phandle(pdev->dev.of_node, "audio-codec", 0);
+ pifi_40_codecs[1].of_node =
+ of_parse_phandle(pdev->dev.of_node, "audio-codec", 1);
+ if (!pifi_40_codecs[0].of_node || !pifi_40_codecs[1].of_node) {
+ dev_err(&pdev->dev,
+ "Property 'audio-codec' missing or invalid\n");
+ return -EINVAL;
+ }
+
+ pdn_gpio = devm_gpiod_get_optional(&pdev->dev, "pdn",
+ GPIOD_OUT_LOW);
+ if (IS_ERR(pdn_gpio)) {
+ ret = PTR_ERR(pdn_gpio);
+ dev_err(&pdev->dev, "failed to get pdn gpio: %d\n",
+ ret);
+ return ret;
+ }
+
+ ret = snd_soc_register_card(&snd_pifi_40);
+ if (ret < 0) {
+ dev_err(&pdev->dev,
+ "snd_soc_register_card() failed: %d\n", ret);
+ return ret;
+ }
+
+ return 0;
+ }
+
+ return -EINVAL;
+}
+
+static int snd_pifi_40_remove(struct platform_device *pdev)
+{
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ kfree(&card->drvdata);
+ snd_pifi_40_pdn(&snd_pifi_40, 0);
+ return snd_soc_unregister_card(&snd_pifi_40);
+}
+
+static const struct of_device_id snd_pifi_40_of_match[] = {
+ {
+ .compatible = "pifi,pifi-40",
+ },
+ { /* sentinel */ },
+};
+
+MODULE_DEVICE_TABLE(of, snd_pifi_40_of_match);
+
+static struct platform_driver snd_pifi_40_driver = {
+ .driver = {
+ .name = "snd-pifi-40",
+ .owner = THIS_MODULE,
+ .of_match_table = snd_pifi_40_of_match,
+ },
+ .probe = snd_pifi_40_probe,
+ .remove = snd_pifi_40_remove,
+};
+
+module_platform_driver(snd_pifi_40_driver);
+
+MODULE_AUTHOR("David Knell <david.knell@gmail.com>");
+MODULE_DESCRIPTION("ALSA ASoC Machine Driver for PiFi-40");
+MODULE_LICENSE("GPL v2");

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