commit_title
stringlengths
13
124
commit_body
stringlengths
0
1.9k
release_summary
stringclasses
52 values
changes_summary
stringlengths
1
758
release_affected_domains
stringclasses
33 values
release_affected_drivers
stringclasses
51 values
domain_of_changes
stringlengths
2
571
language_set
stringclasses
983 values
diffstat_files
int64
1
300
diffstat_insertions
int64
0
309k
diffstat_deletions
int64
0
168k
commit_diff
stringlengths
92
23.4M
category
stringclasses
108 values
commit_hash
stringlengths
34
40
related_people
stringlengths
0
370
domain
stringclasses
21 values
subdomain
stringclasses
241 values
leaf_module
stringlengths
0
912
media: venus: core: add sm8250 dt compatible and resource data
adds an sm8250 compatible binding to the venus core.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
enable 6xx support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['venus']
['c']
1
54
0
--- diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c +static const struct freq_tbl sm8250_freq_table[] = { + { 0, 444000000 }, + { 0, 366000000 }, + { 0, 338000000 }, + { 0, 240000000 }, +}; + +static const struct bw_tbl sm8250_bw_table_enc[] = { + { 1944000, 1954000, 0, 3711000, 0 }, /* 3840x2160@60 */ + { 972000, 996000, 0, 1905000, 0 }, /* 3840x2160@30 */ + { 489600, 645000, 0, 977000, 0 }, /* 1920x1080@60 */ + { 244800, 332000, 0, 498000, 0 }, /* 1920x1080@30 */ +}; + +static const struct bw_tbl sm8250_bw_table_dec[] = { + { 2073600, 2403000, 0, 4113000, 0 }, /* 4096x2160@60 */ + { 1036800, 1224000, 0, 2079000, 0 }, /* 4096x2160@30 */ + { 489600, 812000, 0, 998000, 0 }, /* 1920x1080@60 */ + { 244800, 416000, 0, 509000, 0 }, /* 1920x1080@30 */ +}; + +static const struct reg_val sm8250_reg_preset[] = { + { 0xb0088, 0 }, +}; + +static const struct venus_resources sm8250_res = { + .freq_tbl = sm8250_freq_table, + .freq_tbl_size = array_size(sm8250_freq_table), + .reg_tbl = sm8250_reg_preset, + .reg_tbl_size = array_size(sm8250_reg_preset), + .bw_tbl_enc = sm8250_bw_table_enc, + .bw_tbl_enc_size = array_size(sm8250_bw_table_enc), + .bw_tbl_dec = sm8250_bw_table_dec, + .bw_tbl_dec_size = array_size(sm8250_bw_table_dec), + .clks = {"core", "iface"}, + .clks_num = 2, + .resets = { "bus", "core" }, + .resets_num = 2, + .vcodec0_clks = { "vcodec0_core" }, + .vcodec_clks_num = 1, + .vcodec_pmdomains = { "venus", "vcodec0" }, + .vcodec_pmdomains_num = 2, + .opp_pmdomain = (const char *[]) { "mx", null }, + .vcodec_num = 1, + .max_load = 7833600, + .hfi_version = hfi_version_6xx, + .vmem_id = vidc_resource_none, + .vmem_size = 0, + .vmem_addr = 0, + .dma_mask = 0xe0000000 - 1, + .fwname = "qcom/sm8250/venus.mdt", +}; + + { .compatible = "qcom,sm8250-venus", .data = &sm8250_res, },
TV tuners, webcams, video capturers
0aeabfa29a9cb5b0fa62b9edc530da0ed114034f
bryan o donoghue
drivers
media
platform, qcom, venus
media: venus: core: add io base variables for each block
new silicon means that the pre-determined offsets we have been using in this driver no longer hold. existing blocks of registers can exist at different offsets relative to the io base address.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
enable 6xx support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['venus']
['h', 'c']
2
22
0
--- diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c +#include "hfi_venus_io.h" +static void venus_assign_register_offsets(struct venus_core *core) +{ + core->vbif_base = core->base + vbif_base; + core->cpu_base = core->base + cpu_base; + core->cpu_cs_base = core->base + cpu_cs_base; + core->cpu_ic_base = core->base + cpu_ic_base; + core->wrapper_base = core->base + wrapper_base; +} + + venus_assign_register_offsets(core); + diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h + * @vbif_base io memory vbif base address + * @cpu_base io memory cpu base address + * @cpu_cs_base io memory cpu_cs base address + * @cpu_ic_base io memory cpu_ic base address + * @wrapper_base io memory wrapper base address + void __iomem *vbif_base; + void __iomem *cpu_base; + void __iomem *cpu_cs_base; + void __iomem *cpu_ic_base; + void __iomem *wrapper_base;
TV tuners, webcams, video capturers
b4053a2097ec2f8ea622e817ae5a46a83b23aefe
bryan o donoghue
drivers
media
platform, qcom, venus
media: venus: hfi,pm,firmware: convert to block relative addressing
an upcoming silicon change places a number of existing blocks within the venus at different relative offsets to the base address of io region.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
enable 6xx support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['venus']
['h', 'c']
4
105
97
--- diff --git a/drivers/media/platform/qcom/venus/firmware.c b/drivers/media/platform/qcom/venus/firmware.c --- a/drivers/media/platform/qcom/venus/firmware.c +++ b/drivers/media/platform/qcom/venus/firmware.c - void __iomem *base = core->base; + void __iomem *wrapper_base = core->wrapper_base; - writel(0, base + wrapper_fw_start_addr); - writel(fw_size, base + wrapper_fw_end_addr); - writel(0, base + wrapper_cpa_start_addr); - writel(fw_size, base + wrapper_cpa_end_addr); - writel(fw_size, base + wrapper_nonpix_start_addr); - writel(fw_size, base + wrapper_nonpix_end_addr); - writel(0x0, base + wrapper_cpu_cgc_dis); - writel(0x0, base + wrapper_cpu_clock_config); + writel(0, wrapper_base + wrapper_fw_start_addr); + writel(fw_size, wrapper_base + wrapper_fw_end_addr); + writel(0, wrapper_base + wrapper_cpa_start_addr); + writel(fw_size, wrapper_base + wrapper_cpa_end_addr); + writel(fw_size, wrapper_base + wrapper_nonpix_start_addr); + writel(fw_size, wrapper_base + wrapper_nonpix_end_addr); + writel(0x0, wrapper_base + wrapper_cpu_cgc_dis); + writel(0x0, wrapper_base + wrapper_cpu_clock_config); - writel(0, base + wrapper_a9ss_sw_reset); + writel(0, wrapper_base + wrapper_a9ss_sw_reset); - writel(1, core->base + wrapper_a9ss_sw_reset); + writel(1, core->wrapper_base + wrapper_a9ss_sw_reset); - void __iomem *base = core->base; + void __iomem *wrapper_base = core->wrapper_base; - reg = readl_relaxed(base + wrapper_a9ss_sw_reset); + reg = readl_relaxed(wrapper_base + wrapper_a9ss_sw_reset); - writel_relaxed(reg, base + wrapper_a9ss_sw_reset); + writel_relaxed(reg, wrapper_base + wrapper_a9ss_sw_reset); diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c --- a/drivers/media/platform/qcom/venus/hfi_venus.c +++ b/drivers/media/platform/qcom/venus/hfi_venus.c -static void venus_writel(struct venus_hfi_device *hdev, u32 reg, u32 value) -{ - writel(value, hdev->core->base + reg); -} - -static u32 venus_readl(struct venus_hfi_device *hdev, u32 reg) -{ - return readl(hdev->core->base + reg); -} - - venus_writel(hdev, tbl[i].reg, tbl[i].value); + writel(tbl[i].value, hdev->core->base + tbl[i].reg); - venus_writel(hdev, cpu_ic_softint, bit(cpu_ic_softint_h2a_shift)); + void __iomem *cpu_ic_base = hdev->core->cpu_ic_base; + + writel(bit(cpu_ic_softint_h2a_shift), cpu_ic_base + cpu_ic_softint); + void __iomem *cpu_cs_base = hdev->core->cpu_cs_base; + void __iomem *wrapper_base = hdev->core->wrapper_base; - venus_writel(hdev, vidc_ctrl_init, bit(vidc_ctrl_init_ctrl_shift)); - venus_writel(hdev, wrapper_intr_mask, wrapper_intr_mask_a2hvcodec_mask); - venus_writel(hdev, cpu_cs_sciacmdarg3, 1); + writel(bit(vidc_ctrl_init_ctrl_shift), cpu_cs_base + vidc_ctrl_init); + writel(wrapper_intr_mask_a2hvcodec_mask, wrapper_base + wrapper_intr_mask); + writel(1, cpu_cs_base + cpu_cs_sciacmdarg3); - ctrl_status = venus_readl(hdev, cpu_cs_sciacmdarg0); + ctrl_status = readl(cpu_cs_base + cpu_cs_sciacmdarg0); - u32 ver = venus_readl(hdev, wrapper_hw_version); + void __iomem *wrapper_base = hdev->core->wrapper_base; + u32 ver; + ver = readl(wrapper_base + wrapper_hw_version); + void __iomem *cpu_cs_base = hdev->core->cpu_cs_base; - venus_writel(hdev, uc_region_addr, hdev->ifaceq_table.da); - venus_writel(hdev, uc_region_size, shared_qsize); - venus_writel(hdev, cpu_cs_sciacmdarg2, hdev->ifaceq_table.da); - venus_writel(hdev, cpu_cs_sciacmdarg1, 0x01); + writel(hdev->ifaceq_table.da, cpu_cs_base + uc_region_addr); + writel(shared_qsize, cpu_cs_base + uc_region_size); + writel(hdev->ifaceq_table.da, cpu_cs_base + cpu_cs_sciacmdarg2); + writel(0x01, cpu_cs_base + cpu_cs_sciacmdarg1); - venus_writel(hdev, sfr_addr, hdev->sfr.da); + writel(hdev->sfr.da, cpu_cs_base + sfr_addr); - void __iomem *base = hdev->core->base; + void __iomem *wrapper_base = hdev->core->wrapper_base; + void __iomem *vbif_base = hdev->core->vbif_base; - val = venus_readl(hdev, wrapper_cpu_axi_halt); + val = readl(wrapper_base + wrapper_cpu_axi_halt); - venus_writel(hdev, wrapper_cpu_axi_halt, val); + writel(val, wrapper_base + wrapper_cpu_axi_halt); - ret = readl_poll_timeout(base + wrapper_cpu_axi_halt_status, + ret = readl_poll_timeout(wrapper_base + wrapper_cpu_axi_halt_status, - val = venus_readl(hdev, vbif_axi_halt_ctrl0); + val = readl(vbif_base + vbif_axi_halt_ctrl0); - venus_writel(hdev, vbif_axi_halt_ctrl0, val); + writel(val, vbif_base + vbif_axi_halt_ctrl0); - ret = readl_poll_timeout(base + vbif_axi_halt_ctrl1, val, + ret = readl_poll_timeout(vbif_base + vbif_axi_halt_ctrl1, val, + void __iomem *cpu_cs_base = hdev->core->cpu_cs_base; + void __iomem *wrapper_base = hdev->core->wrapper_base; - status = venus_readl(hdev, wrapper_intr_status); + status = readl(wrapper_base + wrapper_intr_status); - venus_writel(hdev, cpu_cs_a2hsoftintclr, 1); - venus_writel(hdev, wrapper_intr_clear, status); + writel(1, cpu_cs_base + cpu_cs_a2hsoftintclr); + writel(status, wrapper_base + wrapper_intr_clear); + void __iomem *cpu_cs_base = hdev->core->cpu_cs_base; - ctrl_status = venus_readl(hdev, cpu_cs_sciacmdarg0); + ctrl_status = readl(cpu_cs_base + cpu_cs_sciacmdarg0); + void __iomem *wrapper_base = hdev->core->wrapper_base; + void __iomem *cpu_cs_base = hdev->core->cpu_cs_base; - cpu_status = venus_readl(hdev, wrapper_cpu_status); - ctrl_status = venus_readl(hdev, cpu_cs_sciacmdarg0); + cpu_status = readl(wrapper_base + wrapper_cpu_status); + ctrl_status = readl(cpu_cs_base + cpu_cs_sciacmdarg0); + void __iomem *wrapper_base = hdev->core->wrapper_base; + void __iomem *cpu_cs_base = hdev->core->cpu_cs_base; - cpu_status = venus_readl(hdev, wrapper_cpu_status); - ctrl_status = venus_readl(hdev, cpu_cs_sciacmdarg0); + cpu_status = readl(wrapper_base + wrapper_cpu_status); + ctrl_status = readl(cpu_cs_base + cpu_cs_sciacmdarg0); + void __iomem *cpu_cs_base = hdev->core->cpu_cs_base; - ctrl_status = venus_readl(hdev, cpu_cs_sciacmdarg0); + ctrl_status = readl(cpu_cs_base + cpu_cs_sciacmdarg0); diff --git a/drivers/media/platform/qcom/venus/hfi_venus_io.h b/drivers/media/platform/qcom/venus/hfi_venus_io.h --- a/drivers/media/platform/qcom/venus/hfi_venus_io.h +++ b/drivers/media/platform/qcom/venus/hfi_venus_io.h -#define vbif_axi_halt_ctrl0 (vbif_base + 0x208) -#define vbif_axi_halt_ctrl1 (vbif_base + 0x20c) +#define vbif_axi_halt_ctrl0 0x208 +#define vbif_axi_halt_ctrl1 0x20c + -#define cpu_cs_a2hsoftintclr (cpu_cs_base + 0x1c) +#define cpu_cs_a2hsoftintclr 0x1c -#define vidc_ctrl_init (cpu_cs_base + 0x48) +#define vidc_ctrl_init 0x48 -#define cpu_cs_sciacmdarg0 (cpu_cs_base + 0x4c) +#define cpu_cs_sciacmdarg0 0x4c -#define cpu_cs_sciacmdarg1 (cpu_cs_base + 0x50) +#define cpu_cs_sciacmdarg1 0x50 -#define cpu_cs_sciacmdarg2 (cpu_cs_base + 0x54) +#define cpu_cs_sciacmdarg2 0x54 -#define cpu_cs_sciacmdarg3 (cpu_cs_base + 0x58) +#define cpu_cs_sciacmdarg3 0x58 -#define sfr_addr (cpu_cs_base + 0x5c) -#define mmap_addr (cpu_cs_base + 0x60) -#define uc_region_addr (cpu_cs_base + 0x64) -#define uc_region_size (cpu_cs_base + 0x68) +#define sfr_addr 0x5c +#define mmap_addr 0x60 +#define uc_region_addr 0x64 +#define uc_region_size 0x68 -#define cpu_ic_softint (cpu_ic_base + 0x18) +/* relative to cpu_ic_base */ +#define cpu_ic_softint 0x18 -#define wrapper_hw_version (wrapper_base + 0x00) +#define wrapper_hw_version 0x00 -#define wrapper_clock_config (wrapper_base + 0x04) +#define wrapper_clock_config 0x04 -#define wrapper_intr_status (wrapper_base + 0x0c) +#define wrapper_intr_status 0x0c -#define wrapper_intr_mask (wrapper_base + 0x10) +#define wrapper_intr_mask 0x10 -#define wrapper_intr_clear (wrapper_base + 0x14) +#define wrapper_intr_clear 0x14 -#define wrapper_power_status (wrapper_base + 0x44) -#define wrapper_vdec_vcodec_power_control (wrapper_base + 0x48) -#define wrapper_venc_vcodec_power_control (wrapper_base + 0x4c) -#define wrapper_vdec_venc_ahb_bridge_sync_reset (wrapper_base + 0x64) +#define wrapper_power_status 0x44 +#define wrapper_vdec_vcodec_power_control 0x48 +#define wrapper_venc_vcodec_power_control 0x4c +#define wrapper_vdec_venc_ahb_bridge_sync_reset 0x64 -#define wrapper_cpu_clock_config (wrapper_base + 0x2000) -#define wrapper_cpu_axi_halt (wrapper_base + 0x2008) +#define wrapper_cpu_clock_config 0x2000 +#define wrapper_cpu_axi_halt 0x2008 -#define wrapper_cpu_axi_halt_status (wrapper_base + 0x200c) +#define wrapper_cpu_axi_halt_status 0x200c -#define wrapper_cpu_cgc_dis (wrapper_base + 0x2010) -#define wrapper_cpu_status (wrapper_base + 0x2014) +#define wrapper_cpu_cgc_dis 0x2010 +#define wrapper_cpu_status 0x2014 -#define wrapper_sw_reset (wrapper_base + 0x3000) -#define wrapper_cpa_start_addr (wrapper_base + 0x1020) -#define wrapper_cpa_end_addr (wrapper_base + 0x1024) -#define wrapper_fw_start_addr (wrapper_base + 0x1028) -#define wrapper_fw_end_addr (wrapper_base + 0x102c) -#define wrapper_nonpix_start_addr (wrapper_base + 0x1030) -#define wrapper_nonpix_end_addr (wrapper_base + 0x1034) -#define wrapper_a9ss_sw_reset (wrapper_base + 0x3000) +#define wrapper_sw_reset 0x3000 +#define wrapper_cpa_start_addr 0x1020 +#define wrapper_cpa_end_addr 0x1024 +#define wrapper_fw_start_addr 0x1028 +#define wrapper_fw_end_addr 0x102c +#define wrapper_nonpix_start_addr 0x1030 +#define wrapper_nonpix_end_addr 0x1034 +#define wrapper_a9ss_sw_reset 0x3000 -#define wrapper_vcodec0_mmcc_power_status (wrapper_base + 0x90) -#define wrapper_vcodec0_mmcc_power_control (wrapper_base + 0x94) +#define wrapper_vcodec0_mmcc_power_status 0x90 +#define wrapper_vcodec0_mmcc_power_control 0x94 -#define wrapper_vcodec1_mmcc_power_status (wrapper_base + 0x110) -#define wrapper_vcodec1_mmcc_power_control (wrapper_base + 0x114) +#define wrapper_vcodec1_mmcc_power_status 0x110 +#define wrapper_vcodec1_mmcc_power_control 0x114 diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c - ctrl = core->base + wrapper_vdec_vcodec_power_control; + ctrl = core->wrapper_base + wrapper_vdec_vcodec_power_control; - ctrl = core->base + wrapper_venc_vcodec_power_control; + ctrl = core->wrapper_base + wrapper_venc_vcodec_power_control; - ctrl = core->base + wrapper_vcodec0_mmcc_power_control; - stat = core->base + wrapper_vcodec0_mmcc_power_status; + ctrl = core->wrapper_base + wrapper_vcodec0_mmcc_power_control; + stat = core->wrapper_base + wrapper_vcodec0_mmcc_power_status; - ctrl = core->base + wrapper_vcodec1_mmcc_power_control; - stat = core->base + wrapper_vcodec1_mmcc_power_status; + ctrl = core->wrapper_base + wrapper_vcodec1_mmcc_power_control; + stat = core->wrapper_base + wrapper_vcodec1_mmcc_power_status;
TV tuners, webcams, video capturers
ff2a7013b3e6a3d34d2b5c7786b8a73093d25319
bryan o donoghue
drivers
media
platform, qcom, venus
media: venus: hfi: define block offsets for v6 hardware
this commit defines a range of new base addresses for already defined blocks.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
enable 6xx support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['venus']
['h']
1
4
0
- cpu_base_v6 - cpu_cs_base_v6 - cpu_ic_base_v6 - wrapper_base_v6 --- diff --git a/drivers/media/platform/qcom/venus/hfi_venus_io.h b/drivers/media/platform/qcom/venus/hfi_venus_io.h --- a/drivers/media/platform/qcom/venus/hfi_venus_io.h +++ b/drivers/media/platform/qcom/venus/hfi_venus_io.h +#define cpu_base_v6 0xa0000 +#define cpu_cs_base_v6 cpu_base_v6 +#define cpu_ic_base_v6 (cpu_base_v6 + 0x138) +#define wrapper_base_v6 0x000b0000
TV tuners, webcams, video capturers
3c5e894dd30a7180039abc45348dfdad8c189fe7
dikshita agarwal
drivers
media
platform, qcom, venus
media: venus: hfi: define additional 6xx registers
- add x2 rpmh registers and definitions from the downstream example. - add 6xx core power definitions - add 6xx aon definitions - add 6xx wrapper tz definitions - add 6xx wrapper interrupt definitions - add 6xx soft interrupt definitions - define wrapper lpi register offsets
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
enable 6xx support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['venus']
['h']
1
30
0
- add x2 rpmh registers and definitions from the downstream example. - add 6xx core power definitions - add 6xx aon definitions - add 6xx wrapper tz definitions - add 6xx wrapper interrupt definitions - add 6xx soft interrupt definitions - define wrapper lpi register offsets --- diff --git a/drivers/media/platform/qcom/venus/hfi_venus_io.h b/drivers/media/platform/qcom/venus/hfi_venus_io.h --- a/drivers/media/platform/qcom/venus/hfi_venus_io.h +++ b/drivers/media/platform/qcom/venus/hfi_venus_io.h +#define cpu_cs_h2xsoftinten_v6 0x148 + +#define cpu_cs_x2rpmh_v6 0x168 +#define cpu_cs_x2rpmh_mask0_bmsk_v6 0x1 +#define cpu_cs_x2rpmh_mask0_shft_v6 0x0 +#define cpu_cs_x2rpmh_mask1_bmsk_v6 0x2 +#define cpu_cs_x2rpmh_mask1_shft_v6 0x1 +#define cpu_cs_x2rpmh_swoverride_bmsk_v6 0x4 +#define cpu_cs_x2rpmh_swoverride_shft_v6 0x3 + +#define cpu_ic_softint_v6 0x150 +#define cpu_ic_softint_h2a_shift_v6 0x0 +#define wrapper_intr_status_a2hwd_mask_v6 0x8 +#define wrapper_intr_mask_a2hwd_bask_v6 0x8 + +#define wrapper_debug_bridge_lpi_control_v6 0x54 +#define wrapper_debug_bridge_lpi_status_v6 0x58 +/* venus 6xx */ +#define wrapper_core_power_status_v6 0x80 +#define wrapper_core_power_control_v6 0x84 + +/* wrapper tz 6xx */ +#define wrapper_tz_base_v6 0x000c0000 +#define wrapper_tz_cpu_status_v6 0x10 + +/* venus aon */ +#define aon_base_v6 0x000e0000 +#define aon_wrapper_mvp_noc_lpi_control 0x00 +#define aon_wrapper_mvp_noc_lpi_status 0x04 +
TV tuners, webcams, video capturers
7f6631295f46070ee5cdbe939136ce48cc617272
dikshita agarwal
drivers
media
platform, qcom, venus
media: venus: core: add differentiator is_v6(core)
this commit adds the macro helper is_v6() which will be used to differentiate iris2/v6 silicon from previous versions.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
enable 6xx support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['venus']
['h']
1
1
0
--- diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h +#define is_v6(core) ((core)->res->hfi_version == hfi_version_6xx)
TV tuners, webcams, video capturers
ff027906308fcda1661e05beac6abdcbe2b93f6d
bryan o donoghue
drivers
media
platform, qcom, venus
media: venus: core: add an io base for tz wrapper regs
6xx silicon needs to access registers from a wrapper trust-zone base address range. this commit defines the necessary variable for later use.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
enable 6xx support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['venus']
['h', 'c']
2
3
0
--- diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c + core->wrapper_tz_base = 0; diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h + * @wrapper_base io memory wrapper tz base address + void __iomem *wrapper_tz_base;
TV tuners, webcams, video capturers
94e6ed2b2db30bd3e4a821518ebbe8dd6a1920c9
bryan o donoghue
drivers
media
platform, qcom, venus
media: venus: core: add an io base for aon regs
6xx silicon needs to access registers from a aon base address range. this commit defines the necessary variable for later use.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
enable 6xx support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['venus']
['h', 'c']
2
3
0
--- diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c + core->aon_base = 0; diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h + * @aon_base aon base address + void __iomem *aon_base;
TV tuners, webcams, video capturers
e6dd8c3adf433a5ba4911d06c94e30324150283d
bryan o donoghue
drivers
media
platform, qcom, venus
media: venus: core: hook to v6 base registers when appropriate
this commit points the io base registers 6xx offsets when probing for 6xx hardware.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
enable 6xx support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['venus']
['c']
1
17
7
--- diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c - core->vbif_base = core->base + vbif_base; - core->cpu_base = core->base + cpu_base; - core->cpu_cs_base = core->base + cpu_cs_base; - core->cpu_ic_base = core->base + cpu_ic_base; - core->wrapper_base = core->base + wrapper_base; - core->wrapper_tz_base = 0; - core->aon_base = 0; + if (is_v6(core)) { + core->vbif_base = core->base + vbif_base; + core->cpu_base = core->base + cpu_base_v6; + core->cpu_cs_base = core->base + cpu_cs_base_v6; + core->cpu_ic_base = core->base + cpu_ic_base_v6; + core->wrapper_base = core->base + wrapper_base_v6; + core->wrapper_tz_base = core->base + wrapper_tz_base_v6; + core->aon_base = core->base + aon_base_v6; + } else { + core->vbif_base = core->base + vbif_base; + core->cpu_base = core->base + cpu_base; + core->cpu_cs_base = core->base + cpu_cs_base; + core->cpu_ic_base = core->base + cpu_ic_base; + core->wrapper_base = core->base + wrapper_base; + core->wrapper_tz_base = 0; + core->aon_base = 0; + }
TV tuners, webcams, video capturers
3f9acde81d6ed87399d4ac5a4f2e6174b17b82be
bryan o donoghue
drivers
media
platform, qcom, venus
media: venus: hfi: add a 6xx boot logic
this patch adds a 6xx specific boot logic. the goal is to share as much code as possible between 3xx, 4xx and 6xx silicon.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
enable 6xx support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['venus']
['c']
1
12
2
--- diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c --- a/drivers/media/platform/qcom/venus/hfi_venus.c +++ b/drivers/media/platform/qcom/venus/hfi_venus.c - u32 ctrl_status = 0; + u32 ctrl_status = 0, mask_val; - writel(wrapper_intr_mask_a2hvcodec_mask, wrapper_base + wrapper_intr_mask); + if (is_v6(hdev->core)) { + mask_val = readl(wrapper_base + wrapper_intr_mask); + mask_val &= ~(wrapper_intr_mask_a2hwd_bask_v6 | + wrapper_intr_mask_a2hcpu_mask); + } else { + mask_val = wrapper_intr_mask_a2hvcodec_mask; + } + writel(mask_val, wrapper_base + wrapper_intr_mask); + if (is_v6(hdev->core)) + writel(0x0, cpu_cs_base + cpu_cs_x2rpmh_v6); +
TV tuners, webcams, video capturers
255385ca433ce5ff621732f26a759211a27c8f85
dikshita agarwal
drivers
media
platform, qcom, venus
media: venus: hfi: add 6xx interrupt support
this commit adds 6xx specific interrupt support, some register offsets and bitmasks differ from 4xx, which we account for in this commit.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
enable 6xx support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['venus']
['c']
1
23
9
--- diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c --- a/drivers/media/platform/qcom/venus/hfi_venus.c +++ b/drivers/media/platform/qcom/venus/hfi_venus.c + u32 clear_bit; - writel(bit(cpu_ic_softint_h2a_shift), cpu_ic_base + cpu_ic_softint); + if (is_v6(hdev->core)) + clear_bit = bit(cpu_ic_softint_h2a_shift_v6); + else + clear_bit = bit(cpu_ic_softint_h2a_shift); + + writel(clear_bit, cpu_ic_base + cpu_ic_softint); - if (is_v6(hdev->core)) + if (is_v6(hdev->core)) { + writel(0x1, cpu_cs_base + cpu_cs_h2xsoftinten_v6); + } - - if (status & wrapper_intr_status_a2h_mask || - status & wrapper_intr_status_a2hwd_mask || - status & cpu_cs_sciacmdarg0_init_idle_msg_mask) - hdev->irq_status = status; - + if (is_v6(core)) { + if (status & wrapper_intr_status_a2h_mask || + status & wrapper_intr_status_a2hwd_mask_v6 || + status & cpu_cs_sciacmdarg0_init_idle_msg_mask) + hdev->irq_status = status; + } else { + if (status & wrapper_intr_status_a2h_mask || + status & wrapper_intr_status_a2hwd_mask || + status & cpu_cs_sciacmdarg0_init_idle_msg_mask) + hdev->irq_status = status; + } - writel(status, wrapper_base + wrapper_intr_clear); + if (!is_v6(core)) + writel(status, wrapper_base + wrapper_intr_clear);
TV tuners, webcams, video capturers
24fcc0522d8764c46ed109fb35c76f02468a56c7
dikshita agarwal
drivers
media
platform, qcom, venus
media: venus: hfi: read wrapper_tz_cpu_status_v6 on 6xx
on 6xx we should read wrapper cpu status from the wrapper tz register set.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
enable 6xx support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['venus']
['c']
1
10
2
--- diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c --- a/drivers/media/platform/qcom/venus/hfi_venus.c +++ b/drivers/media/platform/qcom/venus/hfi_venus.c + void __iomem *wrapper_tz_base = hdev->core->wrapper_tz_base; - cpu_status = readl(wrapper_base + wrapper_cpu_status); + if (is_v6(hdev->core)) + cpu_status = readl(wrapper_tz_base + wrapper_tz_cpu_status_v6); + else + cpu_status = readl(wrapper_base + wrapper_cpu_status); + void __iomem *wrapper_tz_base = hdev->core->wrapper_tz_base; - cpu_status = readl(wrapper_base + wrapper_cpu_status); + if (is_v6(hdev->core)) + cpu_status = readl(wrapper_tz_base + wrapper_tz_cpu_status_v6); + else + cpu_status = readl(wrapper_base + wrapper_cpu_status);
TV tuners, webcams, video capturers
e396e75fc2545f4136c464e97fcbbc9809fef279
bryan o donoghue
drivers
media
platform, qcom, venus
media: venus: hfi, vdec: v6 add is_v6() to existing is_v4() if locations
in various places in the venus codebase we have if (is_v4()) which takes the code down paths for 4xx silicon. this logic is broadly applicable to 6xx silicon also. in this patch we add is_v6() to various is_v4() decision locations.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
enable 6xx support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['venus']
['c']
3
7
8
--- diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c - if (is_v4(core)) + if (is_v4(core) || is_v6(core)) - if (!is_v4(inst->core)) + if (!is_v4(inst->core) && !is_v6(inst->core)) - diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c --- a/drivers/media/platform/qcom/venus/hfi_venus.c +++ b/drivers/media/platform/qcom/venus/hfi_venus.c - if (is_v4(hdev->core)) + if (is_v4(hdev->core) || is_v6(hdev->core)) - if (is_v3(core) || is_v4(core)) + if (is_v3(core) || is_v4(core) || is_v6(core)) diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c - /* for venus v4 ubwc format is mandatory */ - if (is_v4(core)) + /* for venus v4/v6 ubwc format is mandatory */ + if (is_v4(core) || is_v6(core)) - if (is_v3(core) || is_v4(core)) { + if (is_v3(core) || is_v4(core) || is_v6(core)) {
TV tuners, webcams, video capturers
7ed9e0b3393c8720e8a48e98bc88e30112ccb1bc
bryan o donoghue
drivers
media
platform, qcom, venus
media: venus: pm: hook 6xx pm ops into 4xx pm ops
at this time there is no need to differentiate between the two, we can reuse the 4xx pm ops callback structure for 6xx.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
enable 6xx support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['venus']
['c']
1
1
0
--- diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c + case hfi_version_6xx:
TV tuners, webcams, video capturers
f24afa95bb2e401e9267c722ec109808a0537e60
bryan o donoghue
drivers
media
platform, qcom, venus
media: venus: core,pm: vote for min clk freq during venus boot
vote for min clk frequency for core clks during prepare and enable clocks at boot sequence. without this the controller clock runs at very low value (9.6mhz) which is not sufficient to boot venus.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
enable 6xx support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['venus']
['c']
1
14
0
--- diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c + const struct freq_tbl *freq_tbl = core->res->freq_tbl; + unsigned int freq_tbl_size = core->res->freq_tbl_size; + unsigned long freq; + if (!freq_tbl) + return -einval; + + freq = freq_tbl[freq_tbl_size - 1].freq; + + if (is_v6(core)) { + ret = clk_set_rate(core->clks[i], freq); + if (ret) + goto err; + } +
TV tuners, webcams, video capturers
c22b1a29497c3919b86dc2c87292d24b5965e4a5
dikshita agarwal
drivers
media
platform, qcom, venus
media: venus: hfi: add 6xx axi halt logic
this patch takes the downstream axi halt routine and applies it when is_v6() is true.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
enable 6xx support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['venus']
['c']
1
32
0
--- diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c --- a/drivers/media/platform/qcom/venus/hfi_venus.c +++ b/drivers/media/platform/qcom/venus/hfi_venus.c + void __iomem *cpu_cs_base = hdev->core->cpu_cs_base; + void __iomem *aon_base = hdev->core->aon_base; + u32 mask_val; + if (is_v6(hdev->core)) { + writel(0x3, cpu_cs_base + cpu_cs_x2rpmh_v6); + + writel(0x1, aon_base + aon_wrapper_mvp_noc_lpi_control); + ret = readl_poll_timeout(aon_base + aon_wrapper_mvp_noc_lpi_status, + val, + val & bit(0), + poll_interval_us, + vbif_axi_halt_ack_timeout_us); + if (ret) + return -etimedout; + + mask_val = (bit(2) | bit(1) | bit(0)); + writel(mask_val, wrapper_base + wrapper_debug_bridge_lpi_control_v6); + + writel(0x00, wrapper_base + wrapper_debug_bridge_lpi_control_v6); + ret = readl_poll_timeout(wrapper_base + wrapper_debug_bridge_lpi_status_v6, + val, + val == 0, + poll_interval_us, + vbif_axi_halt_ack_timeout_us); + + if (ret) { + dev_err(dev, "dblp release: lpi_status %x ", val); + return -etimedout; + } + return 0; + } +
TV tuners, webcams, video capturers
4b0b6e147dc98a5985a9060b612041023896ec2b
dikshita agarwal
drivers
media
platform, qcom, venus
media: venus: pm: toggle 6xx wrapper power in vcodec_control
when in vcodec_control_v4() on the 4xx path we select between one of two vcodec cores to toggle power control bits. in 6xx there is only one core which offsets the relevant control registers to a slightly different address.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
enable 6xx support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['venus']
['c']
1
4
1
--- diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c - if (coreid == vidc_core_id_1) { + if (is_v6(core)) { + ctrl = core->wrapper_base + wrapper_core_power_control_v6; + stat = core->wrapper_base + wrapper_core_power_status_v6; + } else if (coreid == vidc_core_id_1) {
TV tuners, webcams, video capturers
64afe82740b3644d491c60d50b23e56310fe4be5
dikshita agarwal
drivers
media
platform, qcom, venus
media: venus: firmware: do not toggle wrapper_a9ss_sw_reset on 6xx
do not toggle the wrapper_a9ss_sw_reset on 6xx.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
enable 6xx support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['venus']
['c']
1
5
3
--- diff --git a/drivers/media/platform/qcom/venus/firmware.c b/drivers/media/platform/qcom/venus/firmware.c --- a/drivers/media/platform/qcom/venus/firmware.c +++ b/drivers/media/platform/qcom/venus/firmware.c - if (resume) + if (resume) { - else - writel(1, core->wrapper_base + wrapper_a9ss_sw_reset); + } else { + if (!is_v6(core)) + writel(1, core->wrapper_base + wrapper_a9ss_sw_reset); + }
TV tuners, webcams, video capturers
ec7ad11740b3b5798c0bd11169170d9572c2e1a2
dikshita agarwal
drivers
media
platform, qcom, venus
media: venus: helpers: add internal buffer list for v6
- internal buffers required by v6 are different than v4, add new list of internal buffers for v6. - differentiate encoder/decoder buffers for 6xx
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
enable 6xx support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['venus']
['h', 'c']
3
20
6
- internal buffers required by v6 are different than v4, - differentiate encoder/decoder buffers for 6xx --- diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c +static const unsigned int intbuf_types_6xx[] = { + hfi_buffer_internal_scratch(hfi_version_6xx), + hfi_buffer_internal_scratch_1(hfi_version_6xx), + hfi_buffer_internal_scratch_2(hfi_version_6xx), + hfi_buffer_internal_persist, + hfi_buffer_internal_persist_1, +}; + - if (is_v4(inst->core)) { + if (is_v6(inst->core)) { + arr_sz = array_size(intbuf_types_6xx); + intbuf = intbuf_types_6xx; + } else if (is_v4(inst->core)) { diff --git a/drivers/media/platform/qcom/venus/hfi_helper.h b/drivers/media/platform/qcom/venus/hfi_helper.h --- a/drivers/media/platform/qcom/venus/hfi_helper.h +++ b/drivers/media/platform/qcom/venus/hfi_helper.h - (((ver) == hfi_version_4xx) ? 0x6 : 0x1000001) + (((ver) == hfi_version_4xx || \ + (ver) == hfi_version_6xx) ? 0x6 : 0x1000001) - (((ver) == hfi_version_4xx) ? 0x7 : 0x1000005) + (((ver) == hfi_version_4xx || \ + (ver) == hfi_version_6xx) ? 0x7 : 0x1000005) - (((ver) == hfi_version_4xx) ? 0x8 : 0x1000006) + (((ver) == hfi_version_4xx || \ + (ver) == hfi_version_6xx) ? 0x8 : 0x1000006) diff --git a/drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c b/drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c --- a/drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c +++ b/drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c - return -einval; + bufreq->size = 0; - return -einval; + bufreq->size = 0;
TV tuners, webcams, video capturers
c934d9d4ca28d8f37f210e26dc88f3d34698114e
dikshita agarwal
drivers
media
platform, qcom, venus
media: venus: helpers, hfi, vdec: set actual plane constraints to fw
set actual plane alignments to fw with hfi_property_param_uncompressed_plane_actual_constraints_info to calculate correct buffer size.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
enable 6xx support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['venus']
['h', 'c']
4
42
0
--- diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c +int venus_helper_set_format_constraints(struct venus_inst *inst) +{ + const u32 ptype = hfi_property_param_uncompressed_plane_actual_constraints_info; + struct hfi_uncompressed_plane_actual_constraints_info pconstraint; + + if (!is_v6(inst->core)) + return 0; + + pconstraint.buffer_type = hfi_buffer_output2; + pconstraint.num_planes = 2; + pconstraint.plane_format[0].stride_multiples = 128; + pconstraint.plane_format[0].max_stride = 8192; + pconstraint.plane_format[0].min_plane_buffer_height_multiple = 32; + pconstraint.plane_format[0].buffer_alignment = 256; + + pconstraint.plane_format[1].stride_multiples = 128; + pconstraint.plane_format[1].max_stride = 8192; + pconstraint.plane_format[1].min_plane_buffer_height_multiple = 16; + pconstraint.plane_format[1].buffer_alignment = 256; + + return hfi_session_set_property(inst, ptype, &pconstraint); +} +export_symbol_gpl(venus_helper_set_format_constraints); + diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h +int venus_helper_set_format_constraints(struct venus_inst *inst); diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.c b/drivers/media/platform/qcom/venus/hfi_cmds.c --- a/drivers/media/platform/qcom/venus/hfi_cmds.c +++ b/drivers/media/platform/qcom/venus/hfi_cmds.c + case hfi_property_param_uncompressed_plane_actual_constraints_info: { + struct hfi_uncompressed_plane_actual_constraints_info *in = pdata; + struct hfi_uncompressed_plane_actual_constraints_info *info = prop_data; + + info->buffer_type = in->buffer_type; + info->num_planes = in->num_planes; + info->plane_format[0] = in->plane_format[0]; + if (in->num_planes > 1) + info->plane_format[1] = in->plane_format[1]; + + pkt->shdr.hdr.size += sizeof(u32) + sizeof(*info); + break; + } diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c + ret = venus_helper_set_format_constraints(inst); + if (ret) + return ret; +
TV tuners, webcams, video capturers
bc28936bbba9995b843d17de12f98f861e52cd58
dikshita agarwal
drivers
media
platform, qcom, venus
media: venus: hfi: increase plat_buf_v6 o/p buffer count.
presently, minimum buffer count for output buffers for h264 & hevc codec is kept as 8 which might not be sufficient for few use cases so increasing the value to 18.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
enable 6xx support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['venus']
['c']
1
1
1
--- diff --git a/drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c b/drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c --- a/drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c +++ b/drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c - output_min_count = 8; + output_min_count = 18;
TV tuners, webcams, video capturers
df67e358447564f204e7966eec35765e0a68d3fa
dikshita agarwal
drivers
media
platform, qcom, venus
media: venus: helper: decide work mode
decide work mode for encoder and decoder based on different use-cases.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
enable 6xx support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['venus']
['h', 'c']
4
31
4
--- diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c +#define num_mbs_720p (((1280 + 15) >> 4) * ((720 + 15) >> 4)) +#define num_mbs_4k (((4096 + 15) >> 4) * ((2304 + 15) >> 4)) + -int venus_helper_set_work_mode(struct venus_inst *inst, u32 mode) +static u32 venus_helper_get_work_mode(struct venus_inst *inst) +{ + u32 mode; + u32 num_mbs; + + mode = vidc_work_mode_2; + if (inst->session_type == vidc_session_type_dec) { + num_mbs = (align(inst->height, 16) * align(inst->width, 16)) / 256; + if (inst->hfi_codec == hfi_video_codec_mpeg2 || + inst->pic_struct != hfi_interlace_frame_progressive || + num_mbs <= num_mbs_720p) + mode = vidc_work_mode_1; + } else { + num_mbs = (align(inst->out_height, 16) * align(inst->out_width, 16)) / 256; + if (inst->hfi_codec == hfi_video_codec_vp8 && + num_mbs <= num_mbs_4k) + mode = vidc_work_mode_1; + } + + return mode; +} + +int venus_helper_set_work_mode(struct venus_inst *inst) + u32 mode; + mode = venus_helper_get_work_mode(inst); diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h -int venus_helper_set_work_mode(struct venus_inst *inst, u32 mode); +int venus_helper_set_work_mode(struct venus_inst *inst); diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c - ret = venus_helper_set_work_mode(inst, vidc_work_mode_2); + ret = venus_helper_set_work_mode(inst); diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c - ret = venus_helper_set_work_mode(inst, vidc_work_mode_2); + ret = venus_helper_set_work_mode(inst);
TV tuners, webcams, video capturers
1ad175952bbcafabd75b399e7fb656ac8ca5d7a5
dikshita agarwal
drivers
media
platform, qcom, venus
media: venus: vdec: fix decoder cmd stop issue
fixes an issue when issuing a stop command to the controller, negating the following firmware error.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
enable 6xx support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['venus']
['c']
2
5
2
--- diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.c b/drivers/media/platform/qcom/venus/hfi_cmds.c --- a/drivers/media/platform/qcom/venus/hfi_cmds.c +++ b/drivers/media/platform/qcom/venus/hfi_cmds.c - if (!cookie || !in_frame->device_addr) + if (!cookie) diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c - fdata.device_addr = 0xdeadb000; + if (is_v6(inst->core)) + fdata.device_addr = 0; + else + fdata.device_addr = 0xdeadb000;
TV tuners, webcams, video capturers
83af5738dc13b407d653d6b6fa725d459fa2ab46
stanimir varbanov
drivers
media
platform, qcom, venus
media: v4l2-ctrl: add decoder conceal color control
add decoder v4l2 control to set conceal color.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add decoder conceal color ctrl
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['h', 'c', 'rst']
3
43
0
--- diff --git a/documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/documentation/userspace-api/media/v4l/ext-ctrls-codec.rst --- a/documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +''v4l2_cid_mpeg_video_dec_conceal_color (integer64)'' + this control sets the conceal color in yuv color space. it describes + the client preference of the error conceal color in case of an error + where the reference frame is missing. the decoder should fill the + reference buffer with the preferred color and use it for future + decoding. the control is using 16 bits per channel. + applicable to decoders. + +.. flat-table:: + :header-rows: 0 + :stub-columns: 0 + + * - + - 8bit format + - 10bit format + - 12bit format + * - y luminance + - bit 0:7 + - bit 0:9 + - bit 0:11 + * - cb chrominance + - bit 16:23 + - bit 16:25 + - bit 16:27 + * - cr chrominance + - bit 32:39 + - bit 32:41 + - bit 32:43 + * - must be zero + - bit 48:63 + - bit 48:63 + - bit 48:63 + diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c + case v4l2_cid_mpeg_video_dec_conceal_color: return "video decoder conceal color"; + case v4l2_cid_mpeg_video_dec_conceal_color: + *type = v4l2_ctrl_type_integer64; + *min = 0; + /* default for 8 bit black, luma is 16, chroma is 128 */ + *def = 0x8000800010ll; + *max = 0xffffffffffffll; + *step = 1; + break; diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h +#define v4l2_cid_mpeg_video_dec_conceal_color (v4l2_cid_codec_base+235)
TV tuners, webcams, video capturers
b52051a40908b3867fcab077d4afda47e1bd4c1b
stanimir varbanov hans verkuil hverkuil cisco xs all nl
documentation
userspace-api
linux, media, v4l, v4l2-core
media: venus: vdec: add support for conceal control
adds support for decoder conceal color control.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add decoder conceal color ctrl
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['h', 'c']
5
45
4
--- diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h + u64 conceal_color; diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.c b/drivers/media/platform/qcom/venus/hfi_cmds.c --- a/drivers/media/platform/qcom/venus/hfi_cmds.c +++ b/drivers/media/platform/qcom/venus/hfi_cmds.c - color->conceal_color = *in; + color->conceal_color = *in & 0xff; + color->conceal_color |= ((*in >> 10) & 0xff) << 8; + color->conceal_color |= ((*in >> 20) & 0xff) << 16; - } default: + } + case hfi_property_param_vdec_conceal_color: { + struct hfi_conceal_color_v4 *color = prop_data; + u32 *in = pdata; + + color->conceal_color_8bit = *in & 0xff; + color->conceal_color_8bit |= ((*in >> 10) & 0xff) << 8; + color->conceal_color_8bit |= ((*in >> 20) & 0xff) << 16; + color->conceal_color_10bit = *in; + pkt->shdr.hdr.size += sizeof(u32) + sizeof(*color); + break; + } + default: diff --git a/drivers/media/platform/qcom/venus/hfi_helper.h b/drivers/media/platform/qcom/venus/hfi_helper.h --- a/drivers/media/platform/qcom/venus/hfi_helper.h +++ b/drivers/media/platform/qcom/venus/hfi_helper.h +/* + * 0 - 7bit -> luma (def: 16) + * 8 - 15bit -> chroma (def: 128) + * format is valid up to v4 + */ +struct hfi_conceal_color_v4 { + u32 conceal_color_8bit; + u32 conceal_color_10bit; +}; + diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c - u32 ptype, decode_order; + u32 ptype, decode_order, conceal; + ptype = hfi_property_param_vdec_conceal_color; + conceal = ctr->conceal_color & 0xffff; + conceal |= ((ctr->conceal_color >> 16) & 0xffff) << 10; + conceal |= ((ctr->conceal_color >> 32) & 0xffff) << 20; + + ret = hfi_session_set_property(inst, ptype, &conceal); + if (ret) + return ret; + diff --git a/drivers/media/platform/qcom/venus/vdec_ctrls.c b/drivers/media/platform/qcom/venus/vdec_ctrls.c --- a/drivers/media/platform/qcom/venus/vdec_ctrls.c +++ b/drivers/media/platform/qcom/venus/vdec_ctrls.c + case v4l2_cid_mpeg_video_dec_conceal_color: + ctr->conceal_color = *ctrl->p_new.p_s64; + break; - ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 11); + ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 12); + v4l2_ctrl_new_std(&inst->ctrl_handler, &vdec_ctrl_ops, + v4l2_cid_mpeg_video_dec_conceal_color, 0, + 0xffffffffffffll, 1, 0x8000800010ll); +
TV tuners, webcams, video capturers
4ef6039fad8f910738f4be604b20bc397665a7ea
stanimir varbanov
drivers
media
platform, qcom, venus
media: v4l2-ctrl: make display delay and display enable std controls
make display delay and display delay enable mfc controls standard v4l controls. this will allow reuse of the controls for other decoder drivers. also the new proposed controls are now codec agnostic because they could be used for any codec.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
mfc private ctrls to std ctrls
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['h', 'c', 'rst']
3
22
0
--- diff --git a/documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/documentation/userspace-api/media/v4l/ext-ctrls-codec.rst --- a/documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +''v4l2_cid_mpeg_video_dec_display_delay_enable (boolean)'' + if the display delay is enabled then the decoder is forced to return + a capture buffer (decoded frame) after processing a certain number + of output buffers. the delay can be set through + ''v4l2_cid_mpeg_video_dec_display_delay''. this + feature can be used for example for generating thumbnails of videos. + applicable to the decoder. + +''v4l2_cid_mpeg_video_dec_display_delay (integer)'' + display delay value for decoder. the decoder is forced to + return a decoded frame after the set 'display delay' number of + frames. if this number is low it may result in frames returned out + of display order, in addition the hardware may still be using the + returned buffer as a reference picture for subsequent frames. + diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c + case v4l2_cid_mpeg_video_dec_display_delay: return "display delay"; + case v4l2_cid_mpeg_video_dec_display_delay_enable: return "display delay enable"; + case v4l2_cid_mpeg_video_dec_display_delay_enable: + case v4l2_cid_mpeg_video_dec_display_delay: diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h +#define v4l2_cid_mpeg_video_dec_display_delay (v4l2_cid_codec_base + 653) +#define v4l2_cid_mpeg_video_dec_display_delay_enable (v4l2_cid_codec_base + 654) +
TV tuners, webcams, video capturers
9f3d1056ea54170bfcc678ca69f802492cc69f93
stanimir varbanov hans verkuil hverkuil cisco xs all nl
documentation
userspace-api
linux, media, v4l, v4l2-core
media: venus: vdec: add support for display delay and delay enable controls
add support for display delay and display delay enable std controls. with this we implement decoder decode output order (decode vs display). once firmware implement few new features the controls will be used for other use-cases.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
mfc private ctrls to std ctrls
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['h', 'c']
3
26
2
--- diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h + u32 display_delay; + u32 display_delay_enable; diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c - u32 ptype; + u32 ptype, decode_order; + if (ctr->display_delay_enable && ctr->display_delay == 0) { + ptype = hfi_property_param_vdec_output_order; + decode_order = hfi_output_order_decode; + ret = hfi_session_set_property(inst, ptype, &decode_order); + if (ret) + return ret; + } + diff --git a/drivers/media/platform/qcom/venus/vdec_ctrls.c b/drivers/media/platform/qcom/venus/vdec_ctrls.c --- a/drivers/media/platform/qcom/venus/vdec_ctrls.c +++ b/drivers/media/platform/qcom/venus/vdec_ctrls.c + case v4l2_cid_mpeg_video_dec_display_delay: + ctr->display_delay = ctrl->val; + break; + case v4l2_cid_mpeg_video_dec_display_delay_enable: + ctr->display_delay_enable = ctrl->val; + break; - ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 9); + ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 11); + v4l2_ctrl_new_std(&inst->ctrl_handler, &vdec_ctrl_ops, + v4l2_cid_mpeg_video_dec_display_delay, + 0, 16383, 1, 0); + + v4l2_ctrl_new_std(&inst->ctrl_handler, &vdec_ctrl_ops, + v4l2_cid_mpeg_video_dec_display_delay_enable, + 0, 1, 1, 0); +
TV tuners, webcams, video capturers
8ec0b7b0b5981c58704194af17a2a981e164900f
stanimir varbanov
drivers
media
platform, qcom, venus
media: s5p-mfc: use display delay and display enable std controls
use the standard display_delay and display_delay_enable controls, the legacy private mfc controls are kept for backward compatibility.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
mfc private ctrls to std ctrls
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['c']
1
16
0
--- diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c + { + .id = v4l2_cid_mpeg_video_dec_display_delay, + .type = v4l2_ctrl_type_integer, + .minimum = 0, + .maximum = 16383, + .default_value = 0, + }, + { + .id = v4l2_cid_mpeg_video_dec_display_delay_enable, + .type = v4l2_ctrl_type_boolean, + .minimum = 0, + .maximum = 1, + .default_value = 0, + }, + case v4l2_cid_mpeg_video_dec_display_delay: + case v4l2_cid_mpeg_video_dec_display_delay_enable:
TV tuners, webcams, video capturers
c3042bff918a25c0cb3120d6da18a9d8b00da617
stanimir varbanov marek szyprowski m szyprowski samsung com
drivers
media
platform, s5p-mfc
media: docs: deprecate mfc display delay controls
deprecate mfc private display delay and display enable controls for new clients and use the standard controls instead.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
mfc private ctrls to std ctrls
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['rst']
1
10
0
--- diff --git a/documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/documentation/userspace-api/media/v4l/ext-ctrls-codec.rst --- a/documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/documentation/userspace-api/media/v4l/ext-ctrls-codec.rst + .. note:: + + this control is deprecated. use the standard + ''v4l2_cid_mpeg_video_dec_display_delay_enable'' control instead. + + .. note:: + + this control is deprecated. use the standard + ''v4l2_cid_mpeg_video_dec_display_delay'' control instead. +
TV tuners, webcams, video capturers
644bcc0315f2b1c438132c46f78221cd6a6f67f3
stanimir varbanov hans verkuil hverkuil cisco xs all nl
documentation
userspace-api
media, v4l
thunderbolt: add details to router uevent
expose two environment variables for routers as part of the initial uevent:
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add details to router uevent
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['thunderbolt ']
['c']
1
34
0
--- diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c --- a/drivers/thunderbolt/switch.c +++ b/drivers/thunderbolt/switch.c +static int tb_switch_uevent(struct device *dev, struct kobj_uevent_env *env) +{ + struct tb_switch *sw = tb_to_switch(dev); + const char *type; + + if (sw->config.thunderbolt_version == usb4_version_1_0) { + if (add_uevent_var(env, "usb4_version=1.0")) + return -enomem; + } + + if (!tb_route(sw)) { + type = "host"; + } else { + const struct tb_port *port; + bool hub = false; + + /* device is hub if it has any downstream ports */ + tb_switch_for_each_port(sw, port) { + if (!port->disabled && !tb_is_upstream_port(port) && + tb_port_is_null(port)) { + hub = true; + break; + } + } + + type = hub ? "hub" : "device"; + } + + if (add_uevent_var(env, "usb4_type=%s", type)) + return -enomem; + return 0; +} + + .uevent = tb_switch_uevent,
Universal Serial Bus
2f608ba19610e9b05c38747d41b97af75455a478
mika westerberg
drivers
thunderbolt
thunderbolt: disable retry logic for intra-domain control packets
in most cases the response packet is lost because the router in question was disconnected by the user. resending the control packet in that case just adds unnecessary delays, so disable that for intra-domain control packets. for inter-domain (xdomain) packets we continue retrying.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
align with usb4 inter-domain and drom specs
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['thunderbolt ']
['c']
1
1
1
--- diff --git a/drivers/thunderbolt/ctl.c b/drivers/thunderbolt/ctl.c --- a/drivers/thunderbolt/ctl.c +++ b/drivers/thunderbolt/ctl.c -#define tb_ctl_retries 4 +#define tb_ctl_retries 1
Universal Serial Bus
61ec15e5534b1adcfc30cb2cf408144c6cd621f2
mika westerberg
drivers
thunderbolt
thunderbolt: do not pass timeout for tb_cfg_reset()
there is only one user for this function and it passes the default timeout to it anyway, so remove the parameter completely. this is also needed in the subsequent patch where we allow connection manager implementations to use different timeout for non-raw control channel messages.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
align with usb4 inter-domain and drom specs
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['thunderbolt ']
['h', 'c']
3
4
7
--- diff --git a/drivers/thunderbolt/ctl.c b/drivers/thunderbolt/ctl.c --- a/drivers/thunderbolt/ctl.c +++ b/drivers/thunderbolt/ctl.c - * @timeout_msec: timeout in ms how long to wait for the response -struct tb_cfg_result tb_cfg_reset(struct tb_ctl *ctl, u64 route, - int timeout_msec) +struct tb_cfg_result tb_cfg_reset(struct tb_ctl *ctl, u64 route) - res = tb_cfg_request_sync(ctl, req, timeout_msec); + res = tb_cfg_request_sync(ctl, req, tb_cfg_default_timeout); diff --git a/drivers/thunderbolt/ctl.h b/drivers/thunderbolt/ctl.h --- a/drivers/thunderbolt/ctl.h +++ b/drivers/thunderbolt/ctl.h -struct tb_cfg_result tb_cfg_reset(struct tb_ctl *ctl, u64 route, - int timeout_msec); +struct tb_cfg_result tb_cfg_reset(struct tb_ctl *ctl, u64 route); diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c --- a/drivers/thunderbolt/switch.c +++ b/drivers/thunderbolt/switch.c - res = tb_cfg_reset(sw->tb->ctl, tb_route(sw), tb_cfg_default_timeout); + res = tb_cfg_reset(sw->tb->ctl, tb_route(sw));
Universal Serial Bus
bda83aeca3cfa8a5aacfe93ba4baf1be81c21f61
mika westerberg
drivers
thunderbolt
thunderbolt: decrease control channel timeout for software connection manager
when the firmware connection manager is not proxying between the software and the hardware we can decrease the timeout for control packets significantly. the usb4 spec recommends 10 ms +- 1 ms but we use slightly larger value (100 ms) which is recommendation from intel thunderbolt firmware folks. when firmware connection manager is running then we keep using the existing 5000 ms.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
align with usb4 inter-domain and drom specs
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['thunderbolt ']
['h', 'c']
6
49
45
--- diff --git a/drivers/thunderbolt/ctl.c b/drivers/thunderbolt/ctl.c --- a/drivers/thunderbolt/ctl.c +++ b/drivers/thunderbolt/ctl.c + * @timeout_msec: default timeout for non-raw control messages + int timeout_msec; + * @timeout_msec: default timeout used with non-raw control messages -struct tb_ctl *tb_ctl_alloc(struct tb_nhi *nhi, event_cb cb, void *cb_data) +struct tb_ctl *tb_ctl_alloc(struct tb_nhi *nhi, int timeout_msec, event_cb cb, + void *cb_data) + ctl->timeout_msec = timeout_msec; - res = tb_cfg_request_sync(ctl, req, tb_cfg_default_timeout); + res = tb_cfg_request_sync(ctl, req, ctl->timeout_msec); - space, offset, length, tb_cfg_default_timeout); + space, offset, length, ctl->timeout_msec); - space, offset, length, tb_cfg_default_timeout); + space, offset, length, ctl->timeout_msec); - tb_cfg_default_timeout); + ctl->timeout_msec); diff --git a/drivers/thunderbolt/ctl.h b/drivers/thunderbolt/ctl.h --- a/drivers/thunderbolt/ctl.h +++ b/drivers/thunderbolt/ctl.h -struct tb_ctl *tb_ctl_alloc(struct tb_nhi *nhi, event_cb cb, void *cb_data); +struct tb_ctl *tb_ctl_alloc(struct tb_nhi *nhi, int timeout_msec, event_cb cb, + void *cb_data); -#define tb_cfg_default_timeout 5000 /* msec */ - diff --git a/drivers/thunderbolt/domain.c b/drivers/thunderbolt/domain.c --- a/drivers/thunderbolt/domain.c +++ b/drivers/thunderbolt/domain.c +static bool tb_domain_event_cb(void *data, enum tb_cfg_pkg_type type, + const void *buf, size_t size) +{ + struct tb *tb = data; + + if (!tb->cm_ops->handle_event) { + tb_warn(tb, "domain does not have event handler "); + return true; + } + + switch (type) { + case tb_cfg_pkg_xdomain_req: + case tb_cfg_pkg_xdomain_resp: + if (tb_is_xdomain_enabled()) + return tb_xdomain_handle_request(tb, type, buf, size); + break; + + default: + tb->cm_ops->handle_event(tb, type, buf, size); + } + + return true; +} + + * @timeout_msec: control channel timeout for non-raw messages -struct tb *tb_domain_alloc(struct tb_nhi *nhi, size_t privsize) +struct tb *tb_domain_alloc(struct tb_nhi *nhi, int timeout_msec, size_t privsize) + tb->ctl = tb_ctl_alloc(nhi, timeout_msec, tb_domain_event_cb, tb); + if (!tb->ctl) + goto err_destroy_wq; + +err_destroy_wq: + destroy_workqueue(tb->wq); -static bool tb_domain_event_cb(void *data, enum tb_cfg_pkg_type type, - const void *buf, size_t size) -{ - struct tb *tb = data; - - if (!tb->cm_ops->handle_event) { - tb_warn(tb, "domain does not have event handler "); - return true; - } - - switch (type) { - case tb_cfg_pkg_xdomain_req: - case tb_cfg_pkg_xdomain_resp: - if (tb_is_xdomain_enabled()) - return tb_xdomain_handle_request(tb, type, buf, size); - break; - - default: - tb->cm_ops->handle_event(tb, type, buf, size); - } - - return true; -} - - - tb->ctl = tb_ctl_alloc(tb->nhi, tb_domain_event_cb, tb); - if (!tb->ctl) { - ret = -enomem; - goto err_unlock; - } - -err_unlock: - mutex_unlock(&tb->lock); diff --git a/drivers/thunderbolt/icm.c b/drivers/thunderbolt/icm.c --- a/drivers/thunderbolt/icm.c +++ b/drivers/thunderbolt/icm.c - tb = tb_domain_alloc(nhi, sizeof(struct icm)); + tb = tb_domain_alloc(nhi, icm_timeout, sizeof(struct icm)); diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c --- a/drivers/thunderbolt/tb.c +++ b/drivers/thunderbolt/tb.c +#define tb_timeout 100 /* ms */ + - tb = tb_domain_alloc(nhi, sizeof(*tcm)); + tb = tb_domain_alloc(nhi, tb_timeout, sizeof(*tcm)); diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h --- a/drivers/thunderbolt/tb.h +++ b/drivers/thunderbolt/tb.h -struct tb *tb_domain_alloc(struct tb_nhi *nhi, size_t privsize); +struct tb *tb_domain_alloc(struct tb_nhi *nhi, int timeout_msec, size_t privsize);
Universal Serial Bus
7f0a34d7900b8403d3068755856b86bcc790c5a3
mika westerberg
drivers
thunderbolt
documentation / thunderbolt: drop speed/lanes entries for xdomain
these are actually not needed as we already have similar entries that apply to all devices on the thunderbolt bus.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
align with usb4 inter-domain and drom specs
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['thunderbolt ']
['sysfs-bus-thunderbolt']
1
0
28
--- diff --git a/documentation/abi/testing/sysfs-bus-thunderbolt b/documentation/abi/testing/sysfs-bus-thunderbolt --- a/documentation/abi/testing/sysfs-bus-thunderbolt +++ b/documentation/abi/testing/sysfs-bus-thunderbolt -what: /sys/bus/thunderbolt/devices/<xdomain>/rx_speed -date: feb 2021 -kernelversion: 5.11 -contact: isaac hazan <isaac.hazan@intel.com> -description: this attribute reports the xdomain rx speed per lane. - all rx lanes run at the same speed. - -what: /sys/bus/thunderbolt/devices/<xdomain>/rx_lanes -date: feb 2021 -kernelversion: 5.11 -contact: isaac hazan <isaac.hazan@intel.com> -description: this attribute reports the number of rx lanes the xdomain - is using simultaneously through its upstream port. - -what: /sys/bus/thunderbolt/devices/<xdomain>/tx_speed -date: feb 2021 -kernelversion: 5.11 -contact: isaac hazan <isaac.hazan@intel.com> -description: this attribute reports the xdomain tx speed per lane. - all tx lanes run at the same speed. - -what: /sys/bus/thunderbolt/devices/<xdomain>/tx_lanes -date: feb 2021 -kernelversion: 5.11 -contact: isaac hazan <isaac.hazan@intel.com> -description: this attribute reports number of tx lanes the xdomain - is using simultaneously through its upstream port. -
Universal Serial Bus
fea627003606d4220d3f7dcb65e8a144c8b4d5d9
mika westerberg
documentation
abi
testing
thunderbolt: add more logging to xdomain connections
currently the driver is pretty quiet when another host is connected which makes debugging possible issues harder. for this reason add more logging on debug level that can be turned on as needed.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
align with usb4 inter-domain and drom specs
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['thunderbolt ']
['c']
1
31
3
--- diff --git a/drivers/thunderbolt/xdomain.c b/drivers/thunderbolt/xdomain.c --- a/drivers/thunderbolt/xdomain.c +++ b/drivers/thunderbolt/xdomain.c + tb_dbg(tb, "%llx: received xdomain request %#x ", route, pkg->type); + + dev_dbg(&xd->dev, "requesting remote uuid "); + + dev_dbg(&xd->dev, "failed to request uuid, retrying "); + dev_dbg(&xd->dev, "got remote uuid %pub ", &uuid); + + dev_dbg(&xd->dev, "requesting remote properties "); + + dev_dbg(&xd->dev, + "failed to request remote properties, retrying "); + dev_info(&xd->dev, "new host found, vendor=%#x device=%#x ", + xd->vendor, xd->device); + if (xd->vendor_name && xd->device_name) + dev_info(&xd->dev, "%s %s ", xd->vendor_name, + xd->device_name); + dev_dbg(&xd->dev, "sending properties changed notification "); + - if (xd->properties_changed_retries-- > 0) + if (xd->properties_changed_retries-- > 0) { + dev_dbg(&xd->dev, + "failed to send properties changed notification, retrying "); + } + dev_err(&xd->dev, "failed to send properties changed notification "); + dev_dbg(&xd->dev, "local uuid %pub ", local_uuid); + if (remote_uuid) + dev_dbg(&xd->dev, "remote uuid %pub ", remote_uuid); + - if (!device_is_registered(&xd->dev)) + if (!device_is_registered(&xd->dev)) { - else + } else { + dev_info(&xd->dev, "host disconnected "); + }
Universal Serial Bus
d29c59b1a4dc74ab0b27c540f39e766906d30e29
mika westerberg
drivers
thunderbolt
thunderbolt: do not re-establish xdomain dma paths automatically
this step is actually not needed. the service drivers themselves will handle this once they have negotiated the service up and running again with the remote side. also dropping this makes it easier to add support for multiple dma tunnels over a single xdomain connection.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
align with usb4 inter-domain and drom specs
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['thunderbolt ']
['h', 'c']
2
2
35
--- diff --git a/drivers/thunderbolt/xdomain.c b/drivers/thunderbolt/xdomain.c --- a/drivers/thunderbolt/xdomain.c +++ b/drivers/thunderbolt/xdomain.c -/* called with @xd->lock held */ -static void tb_xdomain_restore_paths(struct tb_xdomain *xd) -{ - if (!xd->resume) - return; - - xd->resume = false; - if (xd->transmit_path) { - dev_dbg(&xd->dev, "re-establishing dma path "); - tb_domain_approve_xdomain_paths(xd->tb, xd); - } -} - - if (xd->properties && gen <= xd->property_block_gen) { - /* - * on resume it is likely that the properties block is - * not changed (unless the other end added or removed - * services). however, we need to make sure the existing - * dma paths are restored properly. - */ - tb_xdomain_restore_paths(xd); + if (xd->properties && gen <= xd->property_block_gen) - } - tb_xdomain_restore_paths(xd); - - struct tb_xdomain *xd = tb_to_xdomain(dev); - - /* - * ask tb_xdomain_get_properties() restore any existing dma - * paths after properties are re-read. - */ - xd->resume = true; - start_handshake(xd); - + start_handshake(tb_to_xdomain(dev)); diff --git a/include/linux/thunderbolt.h b/include/linux/thunderbolt.h --- a/include/linux/thunderbolt.h +++ b/include/linux/thunderbolt.h - * @resume: the xdomain is being resumed - bool resume;
Universal Serial Bus
8ccbed2476f2a615d5045a7c5c7b459db7dd9263
mika westerberg
include
linux
thunderbolt: use pseudo-random number as initial property block generation
as recommended by usb4 inter-domain service spec use pseudo-random value instead of zero as initial xdomain property block generation value.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
align with usb4 inter-domain and drom specs
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['thunderbolt ']
['c']
1
2
0
--- diff --git a/drivers/thunderbolt/xdomain.c b/drivers/thunderbolt/xdomain.c --- a/drivers/thunderbolt/xdomain.c +++ b/drivers/thunderbolt/xdomain.c +#include <linux/prandom.h> + xdomain_property_block_gen = prandom_u32();
Universal Serial Bus
a6932c3f9ef3aa0c61fae4ff591f1f01783a45b4
mika westerberg
drivers
thunderbolt
thunderbolt: align xdomain protocol timeouts with the spec
the usb4 inter-domain service spec has slightly different recommended timeouts for the xdomain protocol so align the driver with those.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
align with usb4 inter-domain and drom specs
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['thunderbolt ']
['c']
1
2
2
--- diff --git a/drivers/thunderbolt/xdomain.c b/drivers/thunderbolt/xdomain.c --- a/drivers/thunderbolt/xdomain.c +++ b/drivers/thunderbolt/xdomain.c -#define xdomain_default_timeout 5000 /* ms */ +#define xdomain_default_timeout 1000 /* ms */ -#define xdomain_properties_retries 60 +#define xdomain_properties_retries 10
Universal Serial Bus
3bb163331e3acafb217f4259b1987e5f56b0456a
mika westerberg
drivers
thunderbolt
thunderbolt: add tb_property_copy_dir()
this function takes a deep copy of the properties. we need this in order to support more dynamic properties per xdomain connection as required by the usb4 inter-domain service spec.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
align with usb4 inter-domain and drom specs
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['thunderbolt ']
['h', 'c']
2
72
0
--- diff --git a/drivers/thunderbolt/property.c b/drivers/thunderbolt/property.c --- a/drivers/thunderbolt/property.c +++ b/drivers/thunderbolt/property.c +/** + * tb_property_copy_dir() - take a deep copy of directory + * @dir: directory to copy + * + * this function takes a deep copy of @dir and returns back the copy. in + * case of error returns %null. the resulting directory needs to be + * released by calling tb_property_free_dir(). + */ +struct tb_property_dir *tb_property_copy_dir(const struct tb_property_dir *dir) +{ + struct tb_property *property, *p = null; + struct tb_property_dir *d; + + if (!dir) + return null; + + d = tb_property_create_dir(dir->uuid); + if (!d) + return null; + + list_for_each_entry(property, &dir->properties, list) { + struct tb_property *p; + + p = tb_property_alloc(property->key, property->type); + if (!p) + goto err_free; + + p->length = property->length; + + switch (property->type) { + case tb_property_type_directory: + p->value.dir = tb_property_copy_dir(property->value.dir); + if (!p->value.dir) + goto err_free; + break; + + case tb_property_type_data: + p->value.data = kmemdup(property->value.data, + property->length * 4, + gfp_kernel); + if (!p->value.data) + goto err_free; + break; + + case tb_property_type_text: + p->value.text = kzalloc(p->length * 4, gfp_kernel); + if (!p->value.text) + goto err_free; + strcpy(p->value.text, property->value.text); + break; + + case tb_property_type_value: + p->value.immediate = property->value.immediate; + break; + + default: + break; + } + + list_add_tail(&p->list, &d->properties); + } + + return d; + +err_free: + kfree(p); + tb_property_free_dir(d); + + return null; +} + diff --git a/include/linux/thunderbolt.h b/include/linux/thunderbolt.h --- a/include/linux/thunderbolt.h +++ b/include/linux/thunderbolt.h +struct tb_property_dir *tb_property_copy_dir(const struct tb_property_dir *dir);
Universal Serial Bus
7d3084c0b77c6c417a16fc1c5bf3bc3149d20fab
mika westerberg
include
linux
thunderbolt: add support for maxhopid xdomain property
usb4 inter-domain spec mandates that the compatible hosts expose a new property "maxhopid" that tells the connection manager on the other side what is the maximum supported input hopid over the connection. since this is depend on the lane adapter the cable is connected it needs to be filled in dynamically.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
align with usb4 inter-domain and drom specs
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['thunderbolt ']
['sysfs-bus-thunderbolt', 'h', 'c']
3
138
94
--- diff --git a/documentation/abi/testing/sysfs-bus-thunderbolt b/documentation/abi/testing/sysfs-bus-thunderbolt --- a/documentation/abi/testing/sysfs-bus-thunderbolt +++ b/documentation/abi/testing/sysfs-bus-thunderbolt +what: /sys/bus/thunderbolt/devices/.../maxhopid +date: jul 2021 +kernelversion: 5.13 +contact: mika westerberg <mika.westerberg@linux.intel.com> +description: only set for xdomains. the maximum hopid the other host + supports as its input hopid. + diff --git a/drivers/thunderbolt/xdomain.c b/drivers/thunderbolt/xdomain.c --- a/drivers/thunderbolt/xdomain.c +++ b/drivers/thunderbolt/xdomain.c +#define xdomain_default_max_hopid 15 -/* serializes access to the properties and protocol handlers below */ +/* + * serializes access to the properties and protocol handlers below. if + * you need to take both this lock and the struct tb_xdomain lock, take + * this one first. + */ -static u32 *xdomain_property_block; -static u32 xdomain_property_block_len; - u64 route, u8 sequence, const uuid_t *src_uuid, - const struct tb_xdp_properties *req) + struct tb_xdomain *xd, u8 sequence, const struct tb_xdp_properties *req) - if (!uuid_equal(src_uuid, &req->dst_uuid)) { - tb_xdp_error_response(ctl, route, sequence, + if (!uuid_equal(xd->local_uuid, &req->dst_uuid)) { + tb_xdp_error_response(ctl, xd->route, sequence, - mutex_lock(&xdomain_lock); + mutex_lock(&xd->lock); - if (req->offset >= xdomain_property_block_len) { - mutex_unlock(&xdomain_lock); + if (req->offset >= xd->local_property_block_len) { + mutex_unlock(&xd->lock); - len = xdomain_property_block_len - req->offset; + len = xd->local_property_block_len - req->offset; - mutex_unlock(&xdomain_lock); + mutex_unlock(&xd->lock); - tb_xdp_fill_header(&res->hdr, route, sequence, properties_response, + tb_xdp_fill_header(&res->hdr, xd->route, sequence, properties_response, - res->generation = xdomain_property_block_gen; - res->data_length = xdomain_property_block_len; + res->generation = xd->local_property_block_gen; + res->data_length = xd->local_property_block_len; - uuid_copy(&res->src_uuid, src_uuid); + uuid_copy(&res->src_uuid, xd->local_uuid); - memcpy(res->data, &xdomain_property_block[req->offset], len * 4); + memcpy(res->data, &xd->local_property_block[req->offset], len * 4); - mutex_unlock(&xdomain_lock); + mutex_unlock(&xd->lock); -static int rebuild_property_block(void) +static void update_property_block(struct tb_xdomain *xd) - u32 *block, len; - int ret; - - ret = tb_property_format_dir(xdomain_property_dir, null, 0); - if (ret < 0) - return ret; - - len = ret; - - block = kcalloc(len, sizeof(u32), gfp_kernel); - if (!block) - return -enomem; + mutex_lock(&xdomain_lock); + mutex_lock(&xd->lock); + /* + * if the local property block is not up-to-date, rebuild it now + * based on the global property template. + */ + if (!xd->local_property_block || + xd->local_property_block_gen < xdomain_property_block_gen) { + struct tb_property_dir *dir; + int ret, block_len; + u32 *block; + + dir = tb_property_copy_dir(xdomain_property_dir); + if (!dir) { + dev_warn(&xd->dev, "failed to copy properties "); + goto out_unlock; + } - ret = tb_property_format_dir(xdomain_property_dir, block, len); - if (ret) { - kfree(block); - return ret; - } + /* fill in non-static properties now */ + tb_property_add_text(dir, "deviceid", utsname()->nodename); + tb_property_add_immediate(dir, "maxhopid", xd->local_max_hopid); - kfree(xdomain_property_block); - xdomain_property_block = block; - xdomain_property_block_len = len; - xdomain_property_block_gen++; + ret = tb_property_format_dir(dir, null, 0); + if (ret < 0) { + dev_warn(&xd->dev, "local property block creation failed "); + tb_property_free_dir(dir); + goto out_unlock; + } - return 0; -} + block_len = ret; + block = kcalloc(block_len, sizeof(*block), gfp_kernel); + if (!block) { + tb_property_free_dir(dir); + goto out_unlock; + } -static void finalize_property_block(void) -{ - const struct tb_property *nodename; + ret = tb_property_format_dir(dir, block, block_len); + if (ret) { + dev_warn(&xd->dev, "property block generation failed "); + tb_property_free_dir(dir); + kfree(block); + goto out_unlock; + } - /* - * on first xdomain connection we set up the the system - * nodename. this delayed here because userspace may not have it - * set when the driver is first probed. - */ - mutex_lock(&xdomain_lock); - nodename = tb_property_find(xdomain_property_dir, "deviceid", - tb_property_type_text); - if (!nodename) { - tb_property_add_text(xdomain_property_dir, "deviceid", - utsname()->nodename); - rebuild_property_block(); + tb_property_free_dir(dir); + /* release the previous block */ + kfree(xd->local_property_block); + /* assign new one */ + xd->local_property_block = block; + xd->local_property_block_len = block_len; + xd->local_property_block_gen = xdomain_property_block_gen; + +out_unlock: + mutex_unlock(&xd->lock); + struct tb_xdomain *xd; - finalize_property_block(); - + xd = tb_xdomain_find_by_route_locked(tb, route); + if (xd) + update_property_block(xd); + - ret = tb_xdp_properties_response(tb, ctl, route, sequence, uuid, - (const struct tb_xdp_properties *)pkg); + if (xd) { + ret = tb_xdp_properties_response(tb, ctl, xd, sequence, + (const struct tb_xdp_properties *)pkg); + } - case properties_changed_request: { - struct tb_xdomain *xd; - + case properties_changed_request: - xd = tb_xdomain_find_by_route_locked(tb, route); - if (xd) { - if (device_is_registered(&xd->dev)) { - queue_delayed_work(tb->wq, &xd->get_properties_work, - msecs_to_jiffies(50)); - } - tb_xdomain_put(xd); + if (xd && device_is_registered(&xd->dev)) { + queue_delayed_work(tb->wq, &xd->get_properties_work, + msecs_to_jiffies(50)); - - } + tb_xdomain_put(xd); + - if (!tb_property_find(xd->properties, svc->key, + if (!tb_property_find(xd->remote_properties, svc->key, - tb_property_for_each(xd->properties, p) { + tb_property_for_each(xd->remote_properties, p) { + p = tb_property_find(dir, "maxhopid", tb_property_type_value); + /* + * usb4 inter-domain spec suggests using 15 as hopid if the + * other end does not announce it in a property. this is for + * tbt3 compatibility. + */ + xd->remote_max_hopid = p ? p->value.immediate : xdomain_default_max_hopid; + - if (xd->properties && gen <= xd->property_block_gen) + if (xd->remote_properties && gen <= xd->remote_property_block_gen) - if (xd->properties) { - tb_property_free_dir(xd->properties); + if (xd->remote_properties) { + tb_property_free_dir(xd->remote_properties); - xd->properties = dir; - xd->property_block_gen = gen; + xd->remote_properties = dir; + xd->remote_property_block_gen = gen; +static ssize_t maxhopid_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct tb_xdomain *xd = container_of(dev, struct tb_xdomain, dev); + + return sprintf(buf, "%d ", xd->remote_max_hopid); +} +static device_attr_ro(maxhopid); + + &dev_attr_maxhopid.attr, - tb_property_free_dir(xd->properties); + kfree(xd->local_property_block); + tb_property_free_dir(xd->remote_properties); + xd->local_max_hopid = down->config.max_in_hop_id; - ret = rebuild_property_block(); - if (ret) { - remove_directory(key, dir); - goto err_unlock; - } + xdomain_property_block_gen++; - ret = rebuild_property_block(); + xdomain_property_block_gen++; - * we also add node name later when first connection is made. + * rest of the properties are filled dynamically based on these + * when the p2p connection is made. - kfree(xdomain_property_block); diff --git a/include/linux/thunderbolt.h b/include/linux/thunderbolt.h --- a/include/linux/thunderbolt.h +++ b/include/linux/thunderbolt.h + * @local_max_hopid: maximum input hopid of this host + * @remote_max_hopid: maximum input hopid of the remote host - * @properties: properties exported by the remote domain - * @property_block_gen: generation of @properties - * @properties_lock: lock protecting @properties. + * @local_property_block: local block of properties + * @local_property_block_gen: generation of @local_property_block + * @local_property_block_len: length of the @local_property_block in dwords + * @remote_properties: properties exported by the remote domain + * @remote_property_block_gen: generation of @remote_properties + unsigned int local_max_hopid; + unsigned int remote_max_hopid; - struct tb_property_dir *properties; - u32 property_block_gen; + u32 *local_property_block; + u32 local_property_block_gen; + u32 local_property_block_len; + struct tb_property_dir *remote_properties; + u32 remote_property_block_gen;
Universal Serial Bus
46b494f286812a88caba28dd0810cf3a55747431
mika westerberg
drivers
thunderbolt
testing
thunderbolt: use dedicated flow control for dma tunnels
the usb4 inter-domain service spec recommends using dedicated flow control scheme so update the driver accordingly.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
align with usb4 inter-domain and drom specs
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['thunderbolt ']
['c']
1
4
16
--- diff --git a/drivers/thunderbolt/tunnel.c b/drivers/thunderbolt/tunnel.c --- a/drivers/thunderbolt/tunnel.c +++ b/drivers/thunderbolt/tunnel.c -static int tb_dma_activate(struct tb_tunnel *tunnel, bool active) -{ - struct tb_port *nhi = tunnel->src_port; - u32 credits; - - credits = active ? tb_dma_credits(nhi) : 0; - return tb_port_set_initial_credits(nhi, credits); -} - -static void tb_dma_init_path(struct tb_path *path, unsigned int isb, - unsigned int efc, u32 credits) +static void tb_dma_init_path(struct tb_path *path, unsigned int efc, u32 credits) - path->ingress_shared_buffer = isb; + path->ingress_shared_buffer = tb_path_none; - tunnel->activate = tb_dma_activate; - tb_dma_init_path(path, tb_path_none, tb_path_source | tb_path_internal, - credits); + tb_dma_init_path(path, tb_path_source | tb_path_internal, credits); - tb_dma_init_path(path, tb_path_source, tb_path_all, credits); + tb_dma_init_path(path, tb_path_all, credits);
Universal Serial Bus
e5876559b579975e054fdf747c08077628fad175
mika westerberg
drivers
thunderbolt
thunderbolt: drop unused tb_port_set_initial_credits()
this function is not used anymore in the driver so we can remove it.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
align with usb4 inter-domain and drom specs
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['thunderbolt ']
['h', 'c']
2
0
23
--- diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c --- a/drivers/thunderbolt/switch.c +++ b/drivers/thunderbolt/switch.c -/** - * tb_port_set_initial_credits() - set initial port link credits allocated - * @port: port to set the initial credits - * @credits: number of credits to to allocate - * - * set initial credits value to be used for ingress shared buffering. - */ -int tb_port_set_initial_credits(struct tb_port *port, u32 credits) -{ - u32 data; - int ret; - - ret = tb_port_read(port, &data, tb_cfg_port, adp_cs_5, 1); - if (ret) - return ret; - - data &= ~adp_cs_5_lca_mask; - data |= (credits << adp_cs_5_lca_shift) & adp_cs_5_lca_mask; - - return tb_port_write(port, &data, tb_cfg_port, adp_cs_5, 1); -} - diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h --- a/drivers/thunderbolt/tb.h +++ b/drivers/thunderbolt/tb.h -int tb_port_set_initial_credits(struct tb_port *port, u32 credits);
Universal Serial Bus
5cfdd300b7b1e6f2390cf0d71040a8c26297bef7
mika westerberg
drivers
thunderbolt
thunderbolt: allow multiple dma tunnels over a single xdomain connection
currently we have had an artificial limitation of a single dma tunnel per xdomain connection. however, hardware wise there is no such limit and software based connection manager can take advantage of all the dma rings available on the host to establish tunnels.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
align with usb4 inter-domain and drom specs
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['thunderbolt ']
['h', 'c']
10
340
125
--- diff --git a/drivers/net/thunderbolt.c b/drivers/net/thunderbolt.c --- a/drivers/net/thunderbolt.c +++ b/drivers/net/thunderbolt.c -#define tbnet_local_path 0xf - * @transmit_path: hopid the other end needs to use building the - * opposite side path. + * @local_transmit_path: hopid we are using to send out packets + * @remote_transmit_path: hopid the other end is using to send packets to us - u32 transmit_path; + int local_transmit_path; + int remote_transmit_path; - request.transmit_path = tbnet_local_path; + request.transmit_path = net->local_transmit_path; - int retries = tbnet_logout_retries; + int ret, retries = tbnet_logout_retries; - int ret = tbnet_logout_request(net); + ret = tbnet_logout_request(net); - if (tb_xdomain_disable_paths(net->xd)) + ret = tb_xdomain_disable_paths(net->xd, + net->local_transmit_path, + net->rx_ring.ring->hop, + net->remote_transmit_path, + net->tx_ring.ring->hop); + if (ret) + + tb_xdomain_release_in_hopid(net->xd, net->remote_transmit_path); + net->remote_transmit_path = 0; - net->transmit_path = pkg->transmit_path; + net->remote_transmit_path = pkg->transmit_path; + ret = tb_xdomain_alloc_in_hopid(net->xd, net->remote_transmit_path); + if (ret != net->remote_transmit_path) { + netdev_err(net->dev, "failed to allocate rx hopid "); + return; + } + - ret = tb_xdomain_enable_paths(net->xd, tbnet_local_path, + ret = tb_xdomain_enable_paths(net->xd, net->local_transmit_path, - net->transmit_path, + net->remote_transmit_path, + tb_xdomain_release_in_hopid(net->xd, net->remote_transmit_path); + int hopid; + hopid = tb_xdomain_alloc_out_hopid(xd, -1); + if (hopid < 0) { + netdev_err(dev, "failed to allocate tx hopid "); + tb_ring_free(net->tx_ring.ring); + net->tx_ring.ring = null; + return hopid; + } + net->local_transmit_path = hopid; + + + tb_xdomain_release_out_hopid(net->xd, net->local_transmit_path); diff --git a/drivers/thunderbolt/dma_test.c b/drivers/thunderbolt/dma_test.c --- a/drivers/thunderbolt/dma_test.c +++ b/drivers/thunderbolt/dma_test.c -#define dma_test_hopid 8 + * @rx_hopid: hopid used for receiving frames + * @tx_hopid: hopid used for sending fames + int rx_hopid; + int tx_hopid; + tb_xdomain_release_in_hopid(dt->xd, dt->rx_hopid); + tb_xdomain_release_out_hopid(dt->xd, dt->tx_hopid); + + ret = tb_xdomain_alloc_out_hopid(xd, -1); + if (ret < 0) { + dma_test_free_rings(dt); + return ret; + } + + dt->tx_hopid = ret; + + ret = tb_xdomain_alloc_in_hopid(xd, -1); + if (ret < 0) { + dma_test_free_rings(dt); + return ret; + } + + dt->rx_hopid = ret; - ret = tb_xdomain_enable_paths(dt->xd, dma_test_hopid, + ret = tb_xdomain_enable_paths(dt->xd, dt->tx_hopid, - dma_test_hopid, + dt->rx_hopid, + int ret; + - if (tb_xdomain_disable_paths(dt->xd)) + ret = tb_xdomain_disable_paths(dt->xd, dt->tx_hopid, + dt->tx_ring ? dt->tx_ring->hop : 0, + dt->rx_hopid, + dt->rx_ring ? dt->rx_ring->hop : 0); + if (ret) diff --git a/drivers/thunderbolt/domain.c b/drivers/thunderbolt/domain.c --- a/drivers/thunderbolt/domain.c +++ b/drivers/thunderbolt/domain.c + * @transmit_path: hopid we are using to send out packets + * @transmit_ring: dma ring used to send out packets + * @receive_path: hopid the other end is using to send packets to us + * @receive_ring: dma ring used to receive packets from @receive_path -int tb_domain_approve_xdomain_paths(struct tb *tb, struct tb_xdomain *xd) +int tb_domain_approve_xdomain_paths(struct tb *tb, struct tb_xdomain *xd, + int transmit_path, int transmit_ring, + int receive_path, int receive_ring) - return tb->cm_ops->approve_xdomain_paths(tb, xd); + return tb->cm_ops->approve_xdomain_paths(tb, xd, transmit_path, + transmit_ring, receive_path, receive_ring); + * @transmit_path: hopid we are using to send out packets + * @transmit_ring: dma ring used to send out packets + * @receive_path: hopid the other end is using to send packets to us + * @receive_ring: dma ring used to receive packets from @receive_path -int tb_domain_disconnect_xdomain_paths(struct tb *tb, struct tb_xdomain *xd) +int tb_domain_disconnect_xdomain_paths(struct tb *tb, struct tb_xdomain *xd, + int transmit_path, int transmit_ring, + int receive_path, int receive_ring) - return tb->cm_ops->disconnect_xdomain_paths(tb, xd); + return tb->cm_ops->disconnect_xdomain_paths(tb, xd, transmit_path, + transmit_ring, receive_path, receive_ring); - ret = tb_xdomain_disable_paths(xd); + ret = tb_xdomain_disable_all_paths(xd); diff --git a/drivers/thunderbolt/icm.c b/drivers/thunderbolt/icm.c --- a/drivers/thunderbolt/icm.c +++ b/drivers/thunderbolt/icm.c -static int icm_fr_approve_xdomain_paths(struct tb *tb, struct tb_xdomain *xd) +static int icm_fr_approve_xdomain_paths(struct tb *tb, struct tb_xdomain *xd, + int transmit_path, int transmit_ring, + int receive_path, int receive_ring) - request.transmit_path = xd->transmit_path; - request.transmit_ring = xd->transmit_ring; - request.receive_path = xd->receive_path; - request.receive_ring = xd->receive_ring; + request.transmit_path = transmit_path; + request.transmit_ring = transmit_ring; + request.receive_path = receive_path; + request.receive_ring = receive_ring; -static int icm_fr_disconnect_xdomain_paths(struct tb *tb, struct tb_xdomain *xd) +static int icm_fr_disconnect_xdomain_paths(struct tb *tb, struct tb_xdomain *xd, + int transmit_path, int transmit_ring, + int receive_path, int receive_ring) -static int icm_tr_approve_xdomain_paths(struct tb *tb, struct tb_xdomain *xd) +static int icm_tr_approve_xdomain_paths(struct tb *tb, struct tb_xdomain *xd, + int transmit_path, int transmit_ring, + int receive_path, int receive_ring) - request.transmit_path = xd->transmit_path; - request.transmit_ring = xd->transmit_ring; - request.receive_path = xd->receive_path; - request.receive_ring = xd->receive_ring; + request.transmit_path = transmit_path; + request.transmit_ring = transmit_ring; + request.receive_path = receive_path; + request.receive_ring = receive_ring; -static int icm_tr_disconnect_xdomain_paths(struct tb *tb, struct tb_xdomain *xd) +static int icm_tr_disconnect_xdomain_paths(struct tb *tb, struct tb_xdomain *xd, + int transmit_path, int transmit_ring, + int receive_path, int receive_ring) diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c --- a/drivers/thunderbolt/tb.c +++ b/drivers/thunderbolt/tb.c -static int tb_approve_xdomain_paths(struct tb *tb, struct tb_xdomain *xd) +static int tb_approve_xdomain_paths(struct tb *tb, struct tb_xdomain *xd, + int transmit_path, int transmit_ring, + int receive_path, int receive_ring) - tunnel = tb_tunnel_alloc_dma(tb, nhi_port, dst_port, xd->transmit_ring, - xd->transmit_path, xd->receive_ring, - xd->receive_path); + tunnel = tb_tunnel_alloc_dma(tb, nhi_port, dst_port, transmit_path, + transmit_ring, receive_path, receive_ring); -static void __tb_disconnect_xdomain_paths(struct tb *tb, struct tb_xdomain *xd) +static void __tb_disconnect_xdomain_paths(struct tb *tb, struct tb_xdomain *xd, + int transmit_path, int transmit_ring, + int receive_path, int receive_ring) - struct tb_port *dst_port; - struct tb_tunnel *tunnel; + struct tb_cm *tcm = tb_priv(tb); + struct tb_port *nhi_port, *dst_port; + struct tb_tunnel *tunnel, *n; + nhi_port = tb_switch_find_port(tb->root_switch, tb_type_nhi); - /* - * it is possible that the tunnel was already teared down (in - * case of cable disconnect) so it is fine if we cannot find it - * here anymore. - */ - tunnel = tb_find_tunnel(tb, tb_tunnel_dma, null, dst_port); - tb_deactivate_and_free_tunnel(tunnel); + list_for_each_entry_safe(tunnel, n, &tcm->tunnel_list, list) { + if (!tb_tunnel_is_dma(tunnel)) + continue; + if (tunnel->src_port != nhi_port || tunnel->dst_port != dst_port) + continue; + + if (tb_tunnel_match_dma(tunnel, transmit_path, transmit_ring, + receive_path, receive_ring)) + tb_deactivate_and_free_tunnel(tunnel); + } -static int tb_disconnect_xdomain_paths(struct tb *tb, struct tb_xdomain *xd) +static int tb_disconnect_xdomain_paths(struct tb *tb, struct tb_xdomain *xd, + int transmit_path, int transmit_ring, + int receive_path, int receive_ring) - __tb_disconnect_xdomain_paths(tb, xd); + __tb_disconnect_xdomain_paths(tb, xd, transmit_path, + transmit_ring, receive_path, + receive_ring); - * the path below. + * all the tunnels below. - __tb_disconnect_xdomain_paths(tb, xd); + __tb_disconnect_xdomain_paths(tb, xd, -1, -1, -1, -1); diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h --- a/drivers/thunderbolt/tb.h +++ b/drivers/thunderbolt/tb.h - int (*approve_xdomain_paths)(struct tb *tb, struct tb_xdomain *xd); - int (*disconnect_xdomain_paths)(struct tb *tb, struct tb_xdomain *xd); + int (*approve_xdomain_paths)(struct tb *tb, struct tb_xdomain *xd, + int transmit_path, int transmit_ring, + int receive_path, int receive_ring); + int (*disconnect_xdomain_paths)(struct tb *tb, struct tb_xdomain *xd, + int transmit_path, int transmit_ring, + int receive_path, int receive_ring); -int tb_domain_approve_xdomain_paths(struct tb *tb, struct tb_xdomain *xd); -int tb_domain_disconnect_xdomain_paths(struct tb *tb, struct tb_xdomain *xd); +int tb_domain_approve_xdomain_paths(struct tb *tb, struct tb_xdomain *xd, + int transmit_path, int transmit_ring, + int receive_path, int receive_ring); +int tb_domain_disconnect_xdomain_paths(struct tb *tb, struct tb_xdomain *xd, + int transmit_path, int transmit_ring, + int receive_path, int receive_ring); diff --git a/drivers/thunderbolt/tunnel.c b/drivers/thunderbolt/tunnel.c --- a/drivers/thunderbolt/tunnel.c +++ b/drivers/thunderbolt/tunnel.c - * @transmit_ring: nhi ring number used to send packets towards the - * other domain. set to %0 if tx path is not needed. - * @receive_ring: nhi ring number used to receive packets from the - * other domain. set to %0 if rx path is not needed. + * @transmit_ring: nhi ring number used to send packets towards the + * other domain. set to %-1 if tx path is not needed. + * @receive_ring: nhi ring number used to receive packets from the + * other domain. set to %-1 if rx path is not needed. - struct tb_port *dst, int transmit_ring, - int transmit_path, int receive_ring, - int receive_path) + struct tb_port *dst, int transmit_path, + int transmit_ring, int receive_path, + int receive_ring) - if (receive_ring) + if (receive_ring > 0) - if (transmit_ring) + if (transmit_ring > 0) - if (receive_ring) { + if (receive_ring > 0) { - if (transmit_ring) { + if (transmit_ring > 0) { +/** + * tb_tunnel_match_dma() - match dma tunnel + * @tunnel: tunnel to match + * @transmit_path: hopid used for transmitting packets. pass %-1 to ignore. + * @transmit_ring: nhi ring number used to send packets towards the + * other domain. pass %-1 to ignore. + * @receive_path: hopid used for receiving packets. pass %-1 to ignore. + * @receive_ring: nhi ring number used to receive packets from the + * other domain. pass %-1 to ignore. + * + * this function can be used to match specific dma tunnel, if there are + * multiple dma tunnels going through the same xdomain connection. + * returns true if there is match and false otherwise. + */ +bool tb_tunnel_match_dma(const struct tb_tunnel *tunnel, int transmit_path, + int transmit_ring, int receive_path, int receive_ring) +{ + const struct tb_path *tx_path = null, *rx_path = null; + int i; + + if (!receive_ring || !transmit_ring) + return false; + + for (i = 0; i < tunnel->npaths; i++) { + const struct tb_path *path = tunnel->paths[i]; + + if (!path) + continue; + + if (tb_port_is_nhi(path->hops[0].in_port)) + tx_path = path; + else if (tb_port_is_nhi(path->hops[path->path_length - 1].out_port)) + rx_path = path; + } + + if (transmit_ring > 0 || transmit_path > 0) { + if (!tx_path) + return false; + if (transmit_ring > 0 && + (tx_path->hops[0].in_hop_index != transmit_ring)) + return false; + if (transmit_path > 0 && + (tx_path->hops[tx_path->path_length - 1].next_hop_index != transmit_path)) + return false; + } + + if (receive_ring > 0 || receive_path > 0) { + if (!rx_path) + return false; + if (receive_path > 0 && + (rx_path->hops[0].in_hop_index != receive_path)) + return false; + if (receive_ring > 0 && + (rx_path->hops[rx_path->path_length - 1].next_hop_index != receive_ring)) + return false; + } + + return true; +} + diff --git a/drivers/thunderbolt/tunnel.h b/drivers/thunderbolt/tunnel.h --- a/drivers/thunderbolt/tunnel.h +++ b/drivers/thunderbolt/tunnel.h - struct tb_port *dst, int transmit_ring, - int transmit_path, int receive_ring, - int receive_path); + struct tb_port *dst, int transmit_path, + int transmit_ring, int receive_path, + int receive_ring); +bool tb_tunnel_match_dma(const struct tb_tunnel *tunnel, int transmit_path, + int transmit_ring, int receive_path, int receive_ring); diff --git a/drivers/thunderbolt/xdomain.c b/drivers/thunderbolt/xdomain.c --- a/drivers/thunderbolt/xdomain.c +++ b/drivers/thunderbolt/xdomain.c + ida_destroy(&xd->out_hopids); + ida_destroy(&xd->in_hopids); + ida_init(&xd->in_hopids); + ida_init(&xd->out_hopids); - * tb_xdomain_enable_paths() - enable dma paths for xdomain connection + * tb_xdomain_alloc_in_hopid() - allocate input hopid for tunneling - * @transmit_path: hopid of the transmit path the other end is using to - * send packets - * @transmit_ring: dma ring used to receive packets from the other end - * @receive_path: hopid of the receive path the other end is using to - * receive packets - * @receive_ring: dma ring used to send packets to the other end - * - * the function enables dma paths accordingly so that after successful - * return the caller can send and receive packets using high-speed dma - * path. + * @hopid: preferred hopid or %-1 for next available - * return: %0 in case of success and negative errno in case of error + * returns allocated hopid or negative errno. specifically returns + * %-enospc if there are no more available hopids. returned hopid is + * guaranteed to be within range supported by the input lane adapter. + * call tb_xdomain_release_in_hopid() to release the allocated hopid. -int tb_xdomain_enable_paths(struct tb_xdomain *xd, u16 transmit_path, - u16 transmit_ring, u16 receive_path, - u16 receive_ring) +int tb_xdomain_alloc_in_hopid(struct tb_xdomain *xd, int hopid) - int ret; + if (hopid < 0) + hopid = tb_path_min_hopid; + if (hopid < tb_path_min_hopid || hopid > xd->local_max_hopid) + return -einval; - mutex_lock(&xd->lock); + return ida_alloc_range(&xd->in_hopids, hopid, xd->local_max_hopid, + gfp_kernel); +} +export_symbol_gpl(tb_xdomain_alloc_in_hopid); - if (xd->transmit_path) { - ret = xd->transmit_path == transmit_path ? 0 : -ebusy; - goto exit_unlock; - } +/** + * tb_xdomain_alloc_out_hopid() - allocate output hopid for tunneling + * @xd: xdomain connection + * @hopid: preferred hopid or %-1 for next available + * + * returns allocated hopid or negative errno. specifically returns + * %-enospc if there are no more available hopids. returned hopid is + * guaranteed to be within range supported by the output lane adapter. + * call tb_xdomain_release_in_hopid() to release the allocated hopid. + */ +int tb_xdomain_alloc_out_hopid(struct tb_xdomain *xd, int hopid) +{ + if (hopid < 0) + hopid = tb_path_min_hopid; + if (hopid < tb_path_min_hopid || hopid > xd->remote_max_hopid) + return -einval; - xd->transmit_path = transmit_path; - xd->transmit_ring = transmit_ring; - xd->receive_path = receive_path; - xd->receive_ring = receive_ring; + return ida_alloc_range(&xd->out_hopids, hopid, xd->remote_max_hopid, + gfp_kernel); +} +export_symbol_gpl(tb_xdomain_alloc_out_hopid); - ret = tb_domain_approve_xdomain_paths(xd->tb, xd); +/** + * tb_xdomain_release_in_hopid() - release input hopid + * @xd: xdomain connection + * @hopid: hopid to release + */ +void tb_xdomain_release_in_hopid(struct tb_xdomain *xd, int hopid) +{ + ida_free(&xd->in_hopids, hopid); +} +export_symbol_gpl(tb_xdomain_release_in_hopid); -exit_unlock: - mutex_unlock(&xd->lock); +/** + * tb_xdomain_release_out_hopid() - release output hopid + * @xd: xdomain connection + * @hopid: hopid to release + */ +void tb_xdomain_release_out_hopid(struct tb_xdomain *xd, int hopid) +{ + ida_free(&xd->out_hopids, hopid); +} +export_symbol_gpl(tb_xdomain_release_out_hopid); - return ret; +/** + * tb_xdomain_enable_paths() - enable dma paths for xdomain connection + * @xd: xdomain connection + * @transmit_path: hopid we are using to send out packets + * @transmit_ring: dma ring used to send out packets + * @receive_path: hopid the other end is using to send packets to us + * @receive_ring: dma ring used to receive packets from @receive_path + * + * the function enables dma paths accordingly so that after successful + * return the caller can send and receive packets using high-speed dma + * path. if a transmit or receive path is not needed, pass %-1 for those + * parameters. + * + * return: %0 in case of success and negative errno in case of error + */ +int tb_xdomain_enable_paths(struct tb_xdomain *xd, int transmit_path, + int transmit_ring, int receive_path, + int receive_ring) +{ + return tb_domain_approve_xdomain_paths(xd->tb, xd, transmit_path, + transmit_ring, receive_path, + receive_ring); + * @transmit_path: hopid we are using to send out packets + * @transmit_ring: dma ring used to send out packets + * @receive_path: hopid the other end is using to send packets to us + * @receive_ring: dma ring used to receive packets from @receive_path - * this the caller is not expected to use the rings anymore. + * this the caller is not expected to use the rings anymore. passing %-1 + * as path/ring parameter means don't care. normally the callers should + * pass the same values here as they do when paths are enabled. -int tb_xdomain_disable_paths(struct tb_xdomain *xd) +int tb_xdomain_disable_paths(struct tb_xdomain *xd, int transmit_path, + int transmit_ring, int receive_path, + int receive_ring) - int ret = 0; - - mutex_lock(&xd->lock); - if (xd->transmit_path) { - xd->transmit_path = 0; - xd->transmit_ring = 0; - xd->receive_path = 0; - xd->receive_ring = 0; - - ret = tb_domain_disconnect_xdomain_paths(xd->tb, xd); - } - mutex_unlock(&xd->lock); - - return ret; + return tb_domain_disconnect_xdomain_paths(xd->tb, xd, transmit_path, + transmit_ring, receive_path, + receive_ring); diff --git a/include/linux/thunderbolt.h b/include/linux/thunderbolt.h --- a/include/linux/thunderbolt.h +++ b/include/linux/thunderbolt.h - * @transmit_path: hopid which the remote end expects us to transmit - * @transmit_ring: local ring (hop) where outgoing packets are pushed - * @receive_path: hopid which we expect the remote end to transmit - * @receive_ring: local ring (hop) where incoming packets arrive + * @in_hopids: input hopids for dma tunneling + * @out_hopids; output hopids for dma tunneling - u16 transmit_path; - u16 transmit_ring; - u16 receive_path; - u16 receive_ring; + struct ida in_hopids; + struct ida out_hopids; -int tb_xdomain_enable_paths(struct tb_xdomain *xd, u16 transmit_path, - u16 transmit_ring, u16 receive_path, - u16 receive_ring); -int tb_xdomain_disable_paths(struct tb_xdomain *xd); +int tb_xdomain_alloc_in_hopid(struct tb_xdomain *xd, int hopid); +void tb_xdomain_release_in_hopid(struct tb_xdomain *xd, int hopid); +int tb_xdomain_alloc_out_hopid(struct tb_xdomain *xd, int hopid); +void tb_xdomain_release_out_hopid(struct tb_xdomain *xd, int hopid); +int tb_xdomain_enable_paths(struct tb_xdomain *xd, int transmit_path, + int transmit_ring, int receive_path, + int receive_ring); +int tb_xdomain_disable_paths(struct tb_xdomain *xd, int transmit_path, + int transmit_ring, int receive_path, + int receive_ring); + +static inline int tb_xdomain_disable_all_paths(struct tb_xdomain *xd) +{ + return tb_xdomain_disable_paths(xd, -1, -1, -1, -1); +} +
Universal Serial Bus
180b0689425c6fb2b35e69a3316ee38371a782df
mika westerberg
include
linux
net: thunderbolt: align the driver to the usb4 networking spec
the usb4 networking spec (usb4net) recommends different timeouts, and also suggest that the driver sets the 64k frame support flag in the properties block. make the networking driver to honor this.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
align with usb4 inter-domain and drom specs
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['thunderbolt ']
['c']
1
4
3
--- diff --git a/drivers/net/thunderbolt.c b/drivers/net/thunderbolt.c --- a/drivers/net/thunderbolt.c +++ b/drivers/net/thunderbolt.c -#define tbnet_logout_timeout 100 +#define tbnet_logout_timeout 1000 -#define tbnet_logout_retries 5 +#define tbnet_logout_retries 10 +#define tbnet_64k_frames bit(2) - tbnet_match_frags_id); + tbnet_match_frags_id | tbnet_64k_frames);
Universal Serial Bus
952400756dfc7311defbcafca795efe85dd858b3
mika westerberg
drivers
net
thunderbolt: add kunit tests for xdomain properties
this adds kunit tests for parsing, formatting and copying of xdomain properties.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
align with usb4 inter-domain and drom specs
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['thunderbolt ']
['c']
1
252
0
--- diff --git a/drivers/thunderbolt/test.c b/drivers/thunderbolt/test.c --- a/drivers/thunderbolt/test.c +++ b/drivers/thunderbolt/test.c +static const u32 root_directory[] = { + 0x55584401, /* "uxd" v1 */ + 0x00000018, /* root directory length */ + 0x76656e64, /* "vend" */ + 0x6f726964, /* "orid" */ + 0x76000001, /* "v" r 1 */ + 0x00000a27, /* immediate value, ! vendor id */ + 0x76656e64, /* "vend" */ + 0x6f726964, /* "orid" */ + 0x74000003, /* "t" r 3 */ + 0x0000001a, /* text leaf offset, ("apple inc.") */ + 0x64657669, /* "devi" */ + 0x63656964, /* "ceid" */ + 0x76000001, /* "v" r 1 */ + 0x0000000a, /* immediate value, ! device id */ + 0x64657669, /* "devi" */ + 0x63656964, /* "ceid" */ + 0x74000003, /* "t" r 3 */ + 0x0000001d, /* text leaf offset, ("macintosh") */ + 0x64657669, /* "devi" */ + 0x63657276, /* "cerv" */ + 0x76000001, /* "v" r 1 */ + 0x80000100, /* immediate value, device revision */ + 0x6e657477, /* "netw" */ + 0x6f726b00, /* "ork" */ + 0x44000014, /* "d" r 20 */ + 0x00000021, /* directory data offset, (network directory) */ + 0x4170706c, /* "appl" */ + 0x6520496e, /* "e in" */ + 0x632e0000, /* "c." ! */ + 0x4d616369, /* "maci" */ + 0x6e746f73, /* "ntos" */ + 0x68000000, /* "h" */ + 0x00000000, /* padding */ + 0xca8961c6, /* directory uuid, network directory */ + 0x9541ce1c, /* directory uuid, network directory */ + 0x5949b8bd, /* directory uuid, network directory */ + 0x4f5a5f2e, /* directory uuid, network directory */ + 0x70727463, /* "prtc" */ + 0x69640000, /* "id" */ + 0x76000001, /* "v" r 1 */ + 0x00000001, /* immediate value, network protocol id */ + 0x70727463, /* "prtc" */ + 0x76657273, /* "vers" */ + 0x76000001, /* "v" r 1 */ + 0x00000001, /* immediate value, network protocol version */ + 0x70727463, /* "prtc" */ + 0x72657673, /* "revs" */ + 0x76000001, /* "v" r 1 */ + 0x00000001, /* immediate value, network protocol revision */ + 0x70727463, /* "prtc" */ + 0x73746e73, /* "stns" */ + 0x76000001, /* "v" r 1 */ + 0x00000000, /* immediate value, network protocol settings */ +}; + +static const uuid_t network_dir_uuid = + uuid_init(0xc66189ca, 0x1cce, 0x4195, + 0xbd, 0xb8, 0x49, 0x59, 0x2e, 0x5f, 0x5a, 0x4f); + +static void tb_test_property_parse(struct kunit *test) +{ + struct tb_property_dir *dir, *network_dir; + struct tb_property *p; + + dir = tb_property_parse_dir(root_directory, array_size(root_directory)); + kunit_assert_true(test, dir != null); + + p = tb_property_find(dir, "foo", tb_property_type_text); + kunit_assert_true(test, !p); + + p = tb_property_find(dir, "vendorid", tb_property_type_text); + kunit_assert_true(test, p != null); + kunit_expect_streq(test, p->value.text, "apple inc."); + + p = tb_property_find(dir, "vendorid", tb_property_type_value); + kunit_assert_true(test, p != null); + kunit_expect_eq(test, p->value.immediate, (u32)0xa27); + + p = tb_property_find(dir, "deviceid", tb_property_type_text); + kunit_assert_true(test, p != null); + kunit_expect_streq(test, p->value.text, "macintosh"); + + p = tb_property_find(dir, "deviceid", tb_property_type_value); + kunit_assert_true(test, p != null); + kunit_expect_eq(test, p->value.immediate, (u32)0xa); + + p = tb_property_find(dir, "missing", tb_property_type_directory); + kunit_assert_true(test, !p); + + p = tb_property_find(dir, "network", tb_property_type_directory); + kunit_assert_true(test, p != null); + + network_dir = p->value.dir; + kunit_expect_true(test, uuid_equal(network_dir->uuid, &network_dir_uuid)); + + p = tb_property_find(network_dir, "prtcid", tb_property_type_value); + kunit_assert_true(test, p != null); + kunit_expect_eq(test, p->value.immediate, (u32)0x1); + + p = tb_property_find(network_dir, "prtcvers", tb_property_type_value); + kunit_assert_true(test, p != null); + kunit_expect_eq(test, p->value.immediate, (u32)0x1); + + p = tb_property_find(network_dir, "prtcrevs", tb_property_type_value); + kunit_assert_true(test, p != null); + kunit_expect_eq(test, p->value.immediate, (u32)0x1); + + p = tb_property_find(network_dir, "prtcstns", tb_property_type_value); + kunit_assert_true(test, p != null); + kunit_expect_eq(test, p->value.immediate, (u32)0x0); + + p = tb_property_find(network_dir, "deviceid", tb_property_type_value); + kunit_expect_true(test, !p); + p = tb_property_find(network_dir, "deviceid", tb_property_type_text); + kunit_expect_true(test, !p); + + tb_property_free_dir(dir); +} + +static void tb_test_property_format(struct kunit *test) +{ + struct tb_property_dir *dir; + ssize_t block_len; + u32 *block; + int ret, i; + + dir = tb_property_parse_dir(root_directory, array_size(root_directory)); + kunit_assert_true(test, dir != null); + + ret = tb_property_format_dir(dir, null, 0); + kunit_assert_eq(test, ret, (int)array_size(root_directory)); + + block_len = ret; + + block = kunit_kzalloc(test, block_len * sizeof(u32), gfp_kernel); + kunit_assert_true(test, block != null); + + ret = tb_property_format_dir(dir, block, block_len); + kunit_expect_eq(test, ret, 0); + + for (i = 0; i < array_size(root_directory); i++) + kunit_expect_eq(test, root_directory[i], block[i]); + + tb_property_free_dir(dir); +} + +static void compare_dirs(struct kunit *test, struct tb_property_dir *d1, + struct tb_property_dir *d2) +{ + struct tb_property *p1, *p2, *tmp; + int n1, n2, i; + + if (d1->uuid) { + kunit_assert_true(test, d2->uuid != null); + kunit_assert_true(test, uuid_equal(d1->uuid, d2->uuid)); + } else { + kunit_assert_true(test, d2->uuid == null); + } + + n1 = 0; + tb_property_for_each(d1, tmp) + n1++; + kunit_assert_ne(test, n1, 0); + + n2 = 0; + tb_property_for_each(d2, tmp) + n2++; + kunit_assert_ne(test, n2, 0); + + kunit_assert_eq(test, n1, n2); + + p1 = null; + p2 = null; + for (i = 0; i < n1; i++) { + p1 = tb_property_get_next(d1, p1); + kunit_assert_true(test, p1 != null); + p2 = tb_property_get_next(d2, p2); + kunit_assert_true(test, p2 != null); + + kunit_assert_streq(test, &p1->key[0], &p2->key[0]); + kunit_assert_eq(test, p1->type, p2->type); + kunit_assert_eq(test, p1->length, p2->length); + + switch (p1->type) { + case tb_property_type_directory: + kunit_assert_true(test, p1->value.dir != null); + kunit_assert_true(test, p2->value.dir != null); + compare_dirs(test, p1->value.dir, p2->value.dir); + break; + + case tb_property_type_data: + kunit_assert_true(test, p1->value.data != null); + kunit_assert_true(test, p2->value.data != null); + kunit_assert_true(test, + !memcmp(p1->value.data, p2->value.data, + p1->length * 4) + ); + break; + + case tb_property_type_text: + kunit_assert_true(test, p1->value.text != null); + kunit_assert_true(test, p2->value.text != null); + kunit_assert_streq(test, p1->value.text, p2->value.text); + break; + + case tb_property_type_value: + kunit_assert_eq(test, p1->value.immediate, + p2->value.immediate); + break; + default: + kunit_fail(test, "unexpected property type"); + break; + } + } +} + +static void tb_test_property_copy(struct kunit *test) +{ + struct tb_property_dir *src, *dst; + u32 *block; + int ret, i; + + src = tb_property_parse_dir(root_directory, array_size(root_directory)); + kunit_assert_true(test, src != null); + + dst = tb_property_copy_dir(src); + kunit_assert_true(test, dst != null); + + /* compare the structures */ + compare_dirs(test, src, dst); + + /* compare the resulting property block */ + ret = tb_property_format_dir(dst, null, 0); + kunit_assert_eq(test, ret, (int)array_size(root_directory)); + + block = kunit_kzalloc(test, sizeof(root_directory), gfp_kernel); + kunit_assert_true(test, block != null); + + ret = tb_property_format_dir(dst, block, array_size(root_directory)); + kunit_expect_true(test, !ret); + + for (i = 0; i < array_size(root_directory); i++) + kunit_expect_eq(test, root_directory[i], block[i]); + + tb_property_free_dir(dst); + tb_property_free_dir(src); +} + + kunit_case(tb_test_property_parse), + kunit_case(tb_test_property_format), + kunit_case(tb_test_property_copy),
Universal Serial Bus
15a4c7e8f916f4826b0bb541663798af3a1294bd
mika westerberg
drivers
thunderbolt
thunderbolt: add kunit tests for dma tunnels
add a couple of tests to check dma tunneling functionality.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
align with usb4 inter-domain and drom specs
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['thunderbolt ']
['c']
1
240
0
--- diff --git a/drivers/thunderbolt/test.c b/drivers/thunderbolt/test.c --- a/drivers/thunderbolt/test.c +++ b/drivers/thunderbolt/test.c + sw->ports[7].config.nfc_credits = 0x41800000; +static void tb_test_tunnel_dma(struct kunit *test) +{ + struct tb_port *nhi, *port; + struct tb_tunnel *tunnel; + struct tb_switch *host; + + /* + * create dma tunnel from nhi to port 1 and back. + * + * [host 1] + * 1 ^ in hopid 1 -> out hopid 8 + * | + * v in hopid 8 -> out hopid 1 + * ............ domain border + * | + * [host 2] + */ + host = alloc_host(test); + nhi = &host->ports[7]; + port = &host->ports[1]; + + tunnel = tb_tunnel_alloc_dma(null, nhi, port, 8, 1, 8, 1); + kunit_assert_true(test, tunnel != null); + kunit_expect_eq(test, tunnel->type, (enum tb_tunnel_type)tb_tunnel_dma); + kunit_expect_ptr_eq(test, tunnel->src_port, nhi); + kunit_expect_ptr_eq(test, tunnel->dst_port, port); + kunit_assert_eq(test, tunnel->npaths, (size_t)2); + /* rx path */ + kunit_assert_eq(test, tunnel->paths[0]->path_length, 1); + kunit_expect_ptr_eq(test, tunnel->paths[0]->hops[0].in_port, port); + kunit_expect_eq(test, tunnel->paths[0]->hops[0].in_hop_index, 8); + kunit_expect_ptr_eq(test, tunnel->paths[0]->hops[0].out_port, nhi); + kunit_expect_eq(test, tunnel->paths[0]->hops[0].next_hop_index, 1); + /* tx path */ + kunit_assert_eq(test, tunnel->paths[1]->path_length, 1); + kunit_expect_ptr_eq(test, tunnel->paths[1]->hops[0].in_port, nhi); + kunit_expect_eq(test, tunnel->paths[1]->hops[0].in_hop_index, 1); + kunit_expect_ptr_eq(test, tunnel->paths[1]->hops[0].out_port, port); + kunit_expect_eq(test, tunnel->paths[1]->hops[0].next_hop_index, 8); + + tb_tunnel_free(tunnel); +} + +static void tb_test_tunnel_dma_rx(struct kunit *test) +{ + struct tb_port *nhi, *port; + struct tb_tunnel *tunnel; + struct tb_switch *host; + + /* + * create dma rx tunnel from port 1 to nhi. + * + * [host 1] + * 1 ^ + * | + * | in hopid 15 -> out hopid 2 + * ............ domain border + * | + * [host 2] + */ + host = alloc_host(test); + nhi = &host->ports[7]; + port = &host->ports[1]; + + tunnel = tb_tunnel_alloc_dma(null, nhi, port, -1, -1, 15, 2); + kunit_assert_true(test, tunnel != null); + kunit_expect_eq(test, tunnel->type, (enum tb_tunnel_type)tb_tunnel_dma); + kunit_expect_ptr_eq(test, tunnel->src_port, nhi); + kunit_expect_ptr_eq(test, tunnel->dst_port, port); + kunit_assert_eq(test, tunnel->npaths, (size_t)1); + /* rx path */ + kunit_assert_eq(test, tunnel->paths[0]->path_length, 1); + kunit_expect_ptr_eq(test, tunnel->paths[0]->hops[0].in_port, port); + kunit_expect_eq(test, tunnel->paths[0]->hops[0].in_hop_index, 15); + kunit_expect_ptr_eq(test, tunnel->paths[0]->hops[0].out_port, nhi); + kunit_expect_eq(test, tunnel->paths[0]->hops[0].next_hop_index, 2); + + tb_tunnel_free(tunnel); +} + +static void tb_test_tunnel_dma_tx(struct kunit *test) +{ + struct tb_port *nhi, *port; + struct tb_tunnel *tunnel; + struct tb_switch *host; + + /* + * create dma tx tunnel from nhi to port 1. + * + * [host 1] + * 1 | in hopid 2 -> out hopid 15 + * | + * v + * ............ domain border + * | + * [host 2] + */ + host = alloc_host(test); + nhi = &host->ports[7]; + port = &host->ports[1]; + + tunnel = tb_tunnel_alloc_dma(null, nhi, port, 15, 2, -1, -1); + kunit_assert_true(test, tunnel != null); + kunit_expect_eq(test, tunnel->type, (enum tb_tunnel_type)tb_tunnel_dma); + kunit_expect_ptr_eq(test, tunnel->src_port, nhi); + kunit_expect_ptr_eq(test, tunnel->dst_port, port); + kunit_assert_eq(test, tunnel->npaths, (size_t)1); + /* tx path */ + kunit_assert_eq(test, tunnel->paths[0]->path_length, 1); + kunit_expect_ptr_eq(test, tunnel->paths[0]->hops[0].in_port, nhi); + kunit_expect_eq(test, tunnel->paths[0]->hops[0].in_hop_index, 2); + kunit_expect_ptr_eq(test, tunnel->paths[0]->hops[0].out_port, port); + kunit_expect_eq(test, tunnel->paths[0]->hops[0].next_hop_index, 15); + + tb_tunnel_free(tunnel); +} + +static void tb_test_tunnel_dma_chain(struct kunit *test) +{ + struct tb_switch *host, *dev1, *dev2; + struct tb_port *nhi, *port; + struct tb_tunnel *tunnel; + + /* + * create dma tunnel from nhi to device #2 port 3 and back. + * + * [host 1] + * 1 ^ in hopid 1 -> out hopid x + * | + * 1 | in hopid x -> out hopid 1 + * [device #1] + * 7 \ + * 1 \ + * [device #2] + * 3 | in hopid x -> out hopid 8 + * | + * v in hopid 8 -> out hopid x + * ............ domain border + * | + * [host 2] + */ + host = alloc_host(test); + dev1 = alloc_dev_default(test, host, 0x1, true); + dev2 = alloc_dev_default(test, dev1, 0x701, true); + + nhi = &host->ports[7]; + port = &dev2->ports[3]; + tunnel = tb_tunnel_alloc_dma(null, nhi, port, 8, 1, 8, 1); + kunit_assert_true(test, tunnel != null); + kunit_expect_eq(test, tunnel->type, (enum tb_tunnel_type)tb_tunnel_dma); + kunit_expect_ptr_eq(test, tunnel->src_port, nhi); + kunit_expect_ptr_eq(test, tunnel->dst_port, port); + kunit_assert_eq(test, tunnel->npaths, (size_t)2); + /* rx path */ + kunit_assert_eq(test, tunnel->paths[0]->path_length, 3); + kunit_expect_ptr_eq(test, tunnel->paths[0]->hops[0].in_port, port); + kunit_expect_eq(test, tunnel->paths[0]->hops[0].in_hop_index, 8); + kunit_expect_ptr_eq(test, tunnel->paths[0]->hops[0].out_port, + &dev2->ports[1]); + kunit_expect_ptr_eq(test, tunnel->paths[0]->hops[1].in_port, + &dev1->ports[7]); + kunit_expect_ptr_eq(test, tunnel->paths[0]->hops[1].out_port, + &dev1->ports[1]); + kunit_expect_ptr_eq(test, tunnel->paths[0]->hops[2].in_port, + &host->ports[1]); + kunit_expect_ptr_eq(test, tunnel->paths[0]->hops[2].out_port, nhi); + kunit_expect_eq(test, tunnel->paths[0]->hops[2].next_hop_index, 1); + /* tx path */ + kunit_assert_eq(test, tunnel->paths[1]->path_length, 3); + kunit_expect_ptr_eq(test, tunnel->paths[1]->hops[0].in_port, nhi); + kunit_expect_eq(test, tunnel->paths[1]->hops[0].in_hop_index, 1); + kunit_expect_ptr_eq(test, tunnel->paths[1]->hops[1].in_port, + &dev1->ports[1]); + kunit_expect_ptr_eq(test, tunnel->paths[1]->hops[1].out_port, + &dev1->ports[7]); + kunit_expect_ptr_eq(test, tunnel->paths[1]->hops[2].in_port, + &dev2->ports[1]); + kunit_expect_ptr_eq(test, tunnel->paths[1]->hops[2].out_port, port); + kunit_expect_eq(test, tunnel->paths[1]->hops[2].next_hop_index, 8); + + tb_tunnel_free(tunnel); +} + +static void tb_test_tunnel_dma_match(struct kunit *test) +{ + struct tb_port *nhi, *port; + struct tb_tunnel *tunnel; + struct tb_switch *host; + + host = alloc_host(test); + nhi = &host->ports[7]; + port = &host->ports[1]; + + tunnel = tb_tunnel_alloc_dma(null, nhi, port, 15, 1, 15, 1); + kunit_assert_true(test, tunnel != null); + + kunit_assert_true(test, tb_tunnel_match_dma(tunnel, 15, 1, 15, 1)); + kunit_assert_false(test, tb_tunnel_match_dma(tunnel, 8, 1, 15, 1)); + kunit_assert_true(test, tb_tunnel_match_dma(tunnel, -1, -1, 15, 1)); + kunit_assert_true(test, tb_tunnel_match_dma(tunnel, 15, 1, -1, -1)); + kunit_assert_true(test, tb_tunnel_match_dma(tunnel, 15, -1, -1, -1)); + kunit_assert_true(test, tb_tunnel_match_dma(tunnel, -1, 1, -1, -1)); + kunit_assert_true(test, tb_tunnel_match_dma(tunnel, -1, -1, 15, -1)); + kunit_assert_true(test, tb_tunnel_match_dma(tunnel, -1, -1, -1, 1)); + kunit_assert_true(test, tb_tunnel_match_dma(tunnel, -1, -1, -1, -1)); + kunit_assert_false(test, tb_tunnel_match_dma(tunnel, 8, -1, 8, -1)); + + tb_tunnel_free(tunnel); + + tunnel = tb_tunnel_alloc_dma(null, nhi, port, 15, 1, -1, -1); + kunit_assert_true(test, tunnel != null); + kunit_assert_true(test, tb_tunnel_match_dma(tunnel, 15, 1, -1, -1)); + kunit_assert_true(test, tb_tunnel_match_dma(tunnel, 15, -1, -1, -1)); + kunit_assert_true(test, tb_tunnel_match_dma(tunnel, -1, 1, -1, -1)); + kunit_assert_true(test, tb_tunnel_match_dma(tunnel, -1, -1, -1, -1)); + kunit_assert_false(test, tb_tunnel_match_dma(tunnel, 15, 1, 15, 1)); + kunit_assert_false(test, tb_tunnel_match_dma(tunnel, -1, -1, 15, 1)); + kunit_assert_false(test, tb_tunnel_match_dma(tunnel, 15, 11, -1, -1)); + + tb_tunnel_free(tunnel); + + tunnel = tb_tunnel_alloc_dma(null, nhi, port, -1, -1, 15, 11); + kunit_assert_true(test, tunnel != null); + kunit_assert_true(test, tb_tunnel_match_dma(tunnel, -1, -1, 15, 11)); + kunit_assert_true(test, tb_tunnel_match_dma(tunnel, -1, -1, 15, -1)); + kunit_assert_true(test, tb_tunnel_match_dma(tunnel, -1, -1, -1, 11)); + kunit_assert_true(test, tb_tunnel_match_dma(tunnel, -1, -1, -1, -1)); + kunit_assert_false(test, tb_tunnel_match_dma(tunnel, -1, -1, 15, 1)); + kunit_assert_false(test, tb_tunnel_match_dma(tunnel, -1, -1, 10, 11)); + kunit_assert_false(test, tb_tunnel_match_dma(tunnel, 15, 11, -1, -1)); + + tb_tunnel_free(tunnel); +} + + kunit_case(tb_test_tunnel_dma), + kunit_case(tb_test_tunnel_dma_rx), + kunit_case(tb_test_tunnel_dma_tx), + kunit_case(tb_test_tunnel_dma_chain), + kunit_case(tb_test_tunnel_dma_match),
Universal Serial Bus
5adab6cc45c448dd329fceec9aca4f4d4c0559c5
mika westerberg
drivers
thunderbolt
thunderbolt: check quirks in tb_switch_add()
this makes it more visible on the main path of adding router.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
align with usb4 inter-domain and drom specs
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['thunderbolt ']
['c']
2
2
1
--- diff --git a/drivers/thunderbolt/eeprom.c b/drivers/thunderbolt/eeprom.c --- a/drivers/thunderbolt/eeprom.c +++ b/drivers/thunderbolt/eeprom.c - tb_check_quirks(sw); diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c --- a/drivers/thunderbolt/switch.c +++ b/drivers/thunderbolt/switch.c + tb_check_quirks(sw); +
Universal Serial Bus
e23a5afd013c15909169c56751f8d7dac67a68eb
mika westerberg
drivers
thunderbolt
thunderbolt: add support for usb4 drom
usb4 router drom differs sligthly from thunderbolt 1-3 drom. for instance it does not include uid and crc8 in the header section, and it has product descriptor genereric entry to describe the product ids and related information. if the "version" field in the drom header section reads 3 it means the router only has usb4 drom and if it reads 1 it means the router supports tbt3 compatible drom.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
align with usb4 inter-domain and drom specs
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['thunderbolt ']
['c']
1
80
24
--- diff --git a/drivers/thunderbolt/eeprom.c b/drivers/thunderbolt/eeprom.c --- a/drivers/thunderbolt/eeprom.c +++ b/drivers/thunderbolt/eeprom.c +/* usb4 product descriptor */ +struct tb_drom_entry_desc { + struct tb_drom_entry_header header; + u16 bcdusbspec; + u16 idvendor; + u16 idproduct; + u16 bcdproductfwrevision; + u32 tid; + u8 producthwrevision; +}; + case 9: { + const struct tb_drom_entry_desc *desc = + (const struct tb_drom_entry_desc *)entry; + + if (!sw->vendor && !sw->device) { + sw->vendor = desc->idvendor; + sw->device = desc->idproduct; + } + break; + } +static int tb_drom_parse(struct tb_switch *sw) +{ + const struct tb_drom_header *header = + (const struct tb_drom_header *)sw->drom; + u32 crc; + + crc = tb_crc8((u8 *) &header->uid, 8); + if (crc != header->uid_crc8) { + tb_sw_warn(sw, + "drom uid crc8 mismatch (expected: %#x, got: %#x), aborting ", + header->uid_crc8, crc); + return -einval; + } + if (!sw->uid) + sw->uid = header->uid; + sw->vendor = header->vendor_id; + sw->device = header->model_id; + + crc = tb_crc32(sw->drom + tb_drom_data_start, header->data_len); + if (crc != header->data_crc32) { + tb_sw_warn(sw, + "drom data crc32 mismatch (expected: %#x, got: %#x), continuing ", + header->data_crc32, crc); + } + + return tb_drom_parse_entries(sw); +} + +static int usb4_drom_parse(struct tb_switch *sw) +{ + const struct tb_drom_header *header = + (const struct tb_drom_header *)sw->drom; + u32 crc; + + crc = tb_crc32(sw->drom + tb_drom_data_start, header->data_len); + if (crc != header->data_crc32) { + tb_sw_warn(sw, + "drom data crc32 mismatch (expected: %#x, got: %#x), aborting ", + header->data_crc32, crc); + return -einval; + } + + return tb_drom_parse_entries(sw); +} + - u32 crc; - crc = tb_crc8((u8 *) &header->uid, 8); - if (crc != header->uid_crc8) { - tb_sw_warn(sw, - "drom uid crc8 mismatch (expected: %#x, got: %#x), aborting ", - header->uid_crc8, crc); - goto err; - } - if (!sw->uid) - sw->uid = header->uid; - sw->vendor = header->vendor_id; - sw->device = header->model_id; + tb_sw_dbg(sw, "drom version: %d ", header->device_rom_revision); - crc = tb_crc32(sw->drom + tb_drom_data_start, header->data_len); - if (crc != header->data_crc32) { - tb_sw_warn(sw, - "drom data crc32 mismatch (expected: %#x, got: %#x), continuing ", - header->data_crc32, crc); + switch (header->device_rom_revision) { + case 3: + res = usb4_drom_parse(sw); + break; + default: + tb_sw_warn(sw, "drom device_rom_revision %#x unknown ", + header->device_rom_revision); + fallthrough; + case 1: + res = tb_drom_parse(sw); + break; - if (header->device_rom_revision > 2) - tb_sw_warn(sw, "drom device_rom_revision %#x unknown ", - header->device_rom_revision); - - res = tb_drom_parse_entries(sw); - return res; + if (!res) + return 0; + -
Universal Serial Bus
3231307e399a411db07d7d7927df38c4a4b88353
mika westerberg
drivers
thunderbolt
iio: add relative sensitivity support
some hid sensors may use relative sensitivity such as als sensor. this patch adds relative sensitivity checking for all hid sensors.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add relative hysteresis support for hid sensors
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['h', 'c']
5
78
4
--- diff --git a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c --- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c +int hid_sensor_read_raw_hyst_rel_value(struct hid_sensor_common *st, int *val1, + int *val2) +{ + s32 value; + int ret; + + ret = sensor_hub_get_feature(st->hsdev, + st->sensitivity_rel.report_id, + st->sensitivity_rel.index, sizeof(value), + &value); + if (ret < 0 || value < 0) { + *val1 = *val2 = 0; + return -einval; + } + + convert_from_vtf_format(value, st->sensitivity_rel.size, + st->sensitivity_rel.unit_expo, val1, val2); + + return iio_val_int_plus_micro; +} +export_symbol(hid_sensor_read_raw_hyst_rel_value); + + +int hid_sensor_write_raw_hyst_rel_value(struct hid_sensor_common *st, + int val1, int val2) +{ + s32 value; + int ret; + + if (val1 < 0 || val2 < 0) + return -einval; + + value = convert_to_vtf_format(st->sensitivity_rel.size, + st->sensitivity_rel.unit_expo, + val1, val2); + ret = sensor_hub_set_feature(st->hsdev, st->sensitivity_rel.report_id, + st->sensitivity_rel.index, sizeof(value), + &value); + if (ret < 0 || value < 0) + return -einval; + + ret = sensor_hub_get_feature(st->hsdev, + st->sensitivity_rel.report_id, + st->sensitivity_rel.index, sizeof(value), + &value); + if (ret < 0 || value < 0) + return -einval; + + st->raw_hystersis = value; + + return 0; +} +export_symbol(hid_sensor_write_raw_hyst_rel_value); + + sensor_hub_input_get_attribute_info(hsdev, + hid_feature_report, usage_id, + hid_usage_sensor_prop_sensitivity_rel_pct, + &st->sensitivity_rel); - * check absolute sensitivity of data field + * check absolute sensitivity and relative sensitivity of data field - for (i = 0; i < sensitivity_addresses_len && st->sensitivity.index < 0; i++) { - sensor_hub_input_get_attribute_info(hsdev, - hid_feature_report, usage_id, + for (i = 0; i < sensitivity_addresses_len; i++) { + if (st->sensitivity.index < 0) + sensor_hub_input_get_attribute_info( + hsdev, hid_feature_report, usage_id, + + if (st->sensitivity_rel.index < 0) + sensor_hub_input_get_attribute_info( + hsdev, hid_feature_report, usage_id, + hid_usage_sensor_data_mod_change_sensitivity_rel_pct | + sensitivity_addresses[i], + &st->sensitivity_rel); diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c + [iio_chan_info_hysteresis_relative] = "hysteresis_relative", diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h --- a/include/linux/hid-sensor-hub.h +++ b/include/linux/hid-sensor-hub.h + struct hid_sensor_hub_attribute_info sensitivity_rel; +int hid_sensor_write_raw_hyst_rel_value(struct hid_sensor_common *st, int val1, + int val2); +int hid_sensor_read_raw_hyst_rel_value(struct hid_sensor_common *st, + int *val1, int *val2); diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h --- a/include/linux/hid-sensor-ids.h +++ b/include/linux/hid-sensor-ids.h +#define hid_usage_sensor_data_mod_change_sensitivity_rel_pct 0xe000 diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h --- a/include/linux/iio/types.h +++ b/include/linux/iio/types.h + iio_chan_info_hysteresis_relative,
Universal Serial Bus
1c71a2863a0c56123e5a67880cf658083c0a0b1e
ye xiang jiri kosina jkosina suse cz
include
linux
common, hid-sensors, iio
iio: hid-sensor-als: add relative hysteresis support
hid sensor als use relative hysteresis, this patch adds the support.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add relative hysteresis support for hid sensors
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['c']
1
12
2
--- diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c --- a/drivers/iio/light/hid-sensor-als.c +++ b/drivers/iio/light/hid-sensor-als.c - bit(iio_chan_info_hysteresis), + bit(iio_chan_info_hysteresis) | + bit(iio_chan_info_hysteresis_relative), - bit(iio_chan_info_hysteresis), + bit(iio_chan_info_hysteresis) | + bit(iio_chan_info_hysteresis_relative), + case iio_chan_info_hysteresis_relative: + ret_type = hid_sensor_read_raw_hyst_rel_value( + &als_state->common_attributes, val, val2); + break; + case iio_chan_info_hysteresis_relative: + ret = hid_sensor_write_raw_hyst_rel_value( + &als_state->common_attributes, val, val2); + break;
Universal Serial Bus
84dbc231a6f56c810fdd1908c723c0c23c9e169b
ye xiang
drivers
iio
light
iio: add relative hysteresis in abi documentation
add relative hysteresis in abi documentation for als sensor.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add relative hysteresis support for hid sensors
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['sysfs-bus-iio']
1
9
0
--- diff --git a/documentation/abi/testing/sysfs-bus-iio b/documentation/abi/testing/sysfs-bus-iio --- a/documentation/abi/testing/sysfs-bus-iio +++ b/documentation/abi/testing/sysfs-bus-iio + +what: /sys/bus/iio/devices/iio:devicex/in_illuminance_hysteresis_relative +what: /sys/bus/iio/devices/iio:devicex/in_intensity_hysteresis_relative +kernelversion: 5.12 +contact: linux-iio@vger.kernel.org +description: + specify the percent for light sensor relative to the channel + absolute value that a data field should change before an event + is generated. units are a percentage of the prior reading.
Universal Serial Bus
3a826f7c64080ec2789abc229d8012430fa092b7
ye xiang
documentation
abi
testing
usb: typec: port mapping utility
adding functions that can be used to link/unlink ports - usb ports, tbt3/usb4 ports, displayports and so on - to the usb type-c connectors they are attached to inside a system. the symlink that is created for the port device is named "connector".
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
linking ports to their type-c connectors
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['h', 'c', 'makefile']
5
248
2
--- diff --git a/drivers/usb/typec/makefile b/drivers/usb/typec/makefile --- a/drivers/usb/typec/makefile +++ b/drivers/usb/typec/makefile -typec-y := class.o mux.o bus.o +typec-y := class.o mux.o bus.o port-mapper.o diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c --- a/drivers/usb/typec/class.c +++ b/drivers/usb/typec/class.c -static struct class typec_class = { +struct class typec_class = { + free_pld(port->pld); + mutex_init(&port->port_list_lock); + init_list_head(&port->port_list); + port->pld = get_pld(&port->dev); + diff --git a/drivers/usb/typec/class.h b/drivers/usb/typec/class.h --- a/drivers/usb/typec/class.h +++ b/drivers/usb/typec/class.h + + struct list_head port_list; + struct mutex port_list_lock; /* port list lock */ + + void *pld; +extern struct class typec_class; + +void *get_pld(struct device *dev); +void free_pld(void *pld); diff --git a/drivers/usb/typec/port-mapper.c b/drivers/usb/typec/port-mapper.c --- /dev/null +++ b/drivers/usb/typec/port-mapper.c +// spdx-license-identifier: gpl-2.0 +/* + * usb type-c connector class port mapping utility + * + * copyright (c) 2021, intel corporation + * author: heikki krogerus <heikki.krogerus@linux.intel.com> + */ + +#include <linux/acpi.h> +#include <linux/usb.h> +#include <linux/usb/typec.h> + +#include "class.h" + +struct port_node { + struct list_head list; + struct device *dev; + void *pld; +}; + +static int acpi_pld_match(const struct acpi_pld_info *pld1, + const struct acpi_pld_info *pld2) +{ + if (!pld1 || !pld2) + return 0; + + /* + * to speed things up, first checking only the group_position. it seems + * to often have the first unique value in the _pld. + */ + if (pld1->group_position == pld2->group_position) + return !memcmp(pld1, pld2, sizeof(struct acpi_pld_info)); + + return 0; +} + +void *get_pld(struct device *dev) +{ +#ifdef config_acpi + struct acpi_pld_info *pld; + acpi_status status; + + if (!has_acpi_companion(dev)) + return null; + + status = acpi_get_physical_device_location(acpi_handle(dev), &pld); + if (acpi_failure(status)) + return null; + + return pld; +#else + return null; +#endif +} + +void free_pld(void *pld) +{ +#ifdef config_acpi + acpi_free(pld); +#endif +} + +static int __link_port(struct typec_port *con, struct port_node *node) +{ + int ret; + + ret = sysfs_create_link(&node->dev->kobj, &con->dev.kobj, "connector"); + if (ret) + return ret; + + ret = sysfs_create_link(&con->dev.kobj, &node->dev->kobj, + dev_name(node->dev)); + if (ret) { + sysfs_remove_link(&node->dev->kobj, "connector"); + return ret; + } + + list_add_tail(&node->list, &con->port_list); + + return 0; +} + +static int link_port(struct typec_port *con, struct port_node *node) +{ + int ret; + + mutex_lock(&con->port_list_lock); + ret = __link_port(con, node); + mutex_unlock(&con->port_list_lock); + + return ret; +} + +static void __unlink_port(struct typec_port *con, struct port_node *node) +{ + sysfs_remove_link(&con->dev.kobj, dev_name(node->dev)); + sysfs_remove_link(&node->dev->kobj, "connector"); + list_del(&node->list); +} + +static void unlink_port(struct typec_port *con, struct port_node *node) +{ + mutex_lock(&con->port_list_lock); + __unlink_port(con, node); + mutex_unlock(&con->port_list_lock); +} + +static struct port_node *create_port_node(struct device *port) +{ + struct port_node *node; + + node = kzalloc(sizeof(*node), gfp_kernel); + if (!node) + return err_ptr(-enomem); + + node->dev = get_device(port); + node->pld = get_pld(port); + + return node; +} + +static void remove_port_node(struct port_node *node) +{ + put_device(node->dev); + free_pld(node->pld); + kfree(node); +} + +static int connector_match(struct device *dev, const void *data) +{ + const struct port_node *node = data; + + if (!is_typec_port(dev)) + return 0; + + return acpi_pld_match(to_typec_port(dev)->pld, node->pld); +} + +static struct device *find_connector(struct port_node *node) +{ + if (!node->pld) + return null; + + return class_find_device(&typec_class, null, node, connector_match); +} + +/** + * typec_link_port - link a port to its connector + * @port: the port device + * + * find the connector of @port and create symlink named "connector" for it. + * returns 0 on success, or errno in case of a failure. + * + * note. the function increments the reference count of @port on success. + */ +int typec_link_port(struct device *port) +{ + struct device *connector; + struct port_node *node; + int ret = 0; + + node = create_port_node(port); + if (is_err(node)) + return ptr_err(node); + + connector = find_connector(node); + if (!connector) + goto remove_node; + + ret = link_port(to_typec_port(connector), node); + if (ret) + goto put_connector; + + return 0; + +put_connector: + put_device(connector); +remove_node: + remove_port_node(node); + + return ret; +} +export_symbol_gpl(typec_link_port); + +static int port_match_and_unlink(struct device *connector, void *port) +{ + struct port_node *node; + struct port_node *tmp; + int ret = 0; + + if (!is_typec_port(connector)) + return 0; + + mutex_lock(&to_typec_port(connector)->port_list_lock); + list_for_each_entry_safe(node, tmp, &to_typec_port(connector)->port_list, list) { + ret = node->dev == port; + if (ret) { + unlink_port(to_typec_port(connector), node); + remove_port_node(node); + put_device(connector); + break; + } + } + mutex_unlock(&to_typec_port(connector)->port_list_lock); + + return ret; +} + +/** + * typec_unlink_port - unlink port from its connector + * @port: the port device + * + * removes the symlink "connector" and decrements the reference count of @port. + */ +void typec_unlink_port(struct device *port) +{ + class_for_each_device(&typec_class, null, port, port_match_and_unlink); +} +export_symbol_gpl(typec_unlink_port); diff --git a/include/linux/usb/typec.h b/include/linux/usb/typec.h --- a/include/linux/usb/typec.h +++ b/include/linux/usb/typec.h + +#if is_reachable(config_typec) +int typec_link_port(struct device *port); +void typec_unlink_port(struct device *port); +#else +static inline int typec_link_port(struct device *port) +{ + return 0; +} + +static inline void typec_unlink_port(struct device *port) { } +#endif +
Universal Serial Bus
ae196ddb0d3186bc08e529b8ea4bf62161ddfce2
heikki krogerus
drivers
usb
typec, usb
usb: link the ports to the connectors they are attached to
creating link to the usb type-c connector for every new port that is added when possible.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
linking ports to their type-c connectors
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['c', 'sysfs-bus-usb']
2
12
0
--- diff --git a/documentation/abi/testing/sysfs-bus-usb b/documentation/abi/testing/sysfs-bus-usb --- a/documentation/abi/testing/sysfs-bus-usb +++ b/documentation/abi/testing/sysfs-bus-usb +what: /sys/bus/usb/devices/.../(hub interface)/portx/connector +date: april 2021 +contact: heikki krogerus <heikki.krogerus@linux.intel.com> +description: + link to the usb type-c connector when available. this link is + only created when usb type-c connector class is enabled, and + only if the system firmware is capable of describing the + connection between a port and its connector. + diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c +#include <linux/usb/typec.h> + typec_link_port(&port_dev->dev); + typec_unlink_port(&port_dev->dev);
Universal Serial Bus
63cd78617350dae99cc5fbd8f643b83ee819fe33
heikki krogerus
drivers
usb
core, testing
usb: iterator for ports
introducing usb_for_each_port(). it works the same way as usb_for_each_dev(), but instead of going through every usb device in the system, it walks through the usb ports in the system.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
linking ports to their type-c connectors
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['h', 'c']
2
55
0
--- diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c +struct each_hub_arg { + void *data; + int (*fn)(struct device *, void *); +}; + +static int __each_hub(struct usb_device *hdev, void *data) +{ + struct each_hub_arg *arg = (struct each_hub_arg *)data; + struct usb_hub *hub; + int ret = 0; + int i; + + hub = usb_hub_to_struct_hub(hdev); + if (!hub) + return 0; + + mutex_lock(&usb_port_peer_mutex); + + for (i = 0; i < hdev->maxchild; i++) { + ret = arg->fn(&hub->ports[i]->dev, arg->data); + if (ret) + break; + } + + mutex_unlock(&usb_port_peer_mutex); + + return ret; +} + +/** + * usb_for_each_port - interate over all usb ports in the system + * @data: data pointer that will be handed to the callback function + * @fn: callback function to be called for each usb port + * + * iterate over all usb ports and call @fn for each, passing it @data. if it + * returns anything other than 0, we break the iteration prematurely and return + * that value. + */ +int usb_for_each_port(void *data, int (*fn)(struct device *, void *)) +{ + struct each_hub_arg arg = {data, fn}; + + return usb_for_each_dev(&arg, __each_hub); +} +export_symbol_gpl(usb_for_each_port); + diff --git a/include/linux/usb.h b/include/linux/usb.h --- a/include/linux/usb.h +++ b/include/linux/usb.h +#if is_reachable(config_usb) +int usb_for_each_port(void *data, int (*fn)(struct device *, void *)); +#else +static inline int usb_for_each_port(void *data, int (*fn)(struct device *, void *)) +{ + return 0; +} +#endif +
Universal Serial Bus
b433c4c789d612cf58739a772bbddbd949bafd20
heikki krogerus alan stern stern rowland harvard edu
drivers
usb
core
usb: typec: link all ports during connector registration
the connectors may be registered after the ports, so the "connector" links need to be created for the ports also when ever a new connector gets registered.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
linking ports to their type-c connectors
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['h', 'c']
3
68
7
--- diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c --- a/drivers/usb/typec/class.c +++ b/drivers/usb/typec/class.c - free_pld(port->pld); - port->pld = get_pld(&port->dev); + ret = typec_link_ports(port); + if (ret) + dev_warn(&port->dev, "failed to create symlinks (%d) ", ret); - if (!is_err_or_null(port)) + if (!is_err_or_null(port)) { + typec_unlink_ports(port); + } diff --git a/drivers/usb/typec/class.h b/drivers/usb/typec/class.h --- a/drivers/usb/typec/class.h +++ b/drivers/usb/typec/class.h -void *get_pld(struct device *dev); -void free_pld(void *pld); +int typec_link_ports(struct typec_port *connector); +void typec_unlink_ports(struct typec_port *connector); diff --git a/drivers/usb/typec/port-mapper.c b/drivers/usb/typec/port-mapper.c --- a/drivers/usb/typec/port-mapper.c +++ b/drivers/usb/typec/port-mapper.c -void *get_pld(struct device *dev) +static void *get_pld(struct device *dev) -void free_pld(void *pld) +static void free_pld(void *pld) + +static int each_port(struct device *port, void *connector) +{ + struct port_node *node; + int ret; + + node = create_port_node(port); + if (is_err(node)) + return ptr_err(node); + + if (!connector_match(connector, node)) { + remove_port_node(node); + return 0; + } + + ret = link_port(to_typec_port(connector), node); + if (ret) { + remove_port_node(node->pld); + return ret; + } + + get_device(connector); + + return 0; +} + +int typec_link_ports(struct typec_port *con) +{ + int ret = 0; + + con->pld = get_pld(&con->dev); + if (!con->pld) + return 0; + + ret = usb_for_each_port(&con->dev, each_port); + if (ret) + typec_unlink_ports(con); + + return ret; +} + +void typec_unlink_ports(struct typec_port *con) +{ + struct port_node *node; + struct port_node *tmp; + + mutex_lock(&con->port_list_lock); + + list_for_each_entry_safe(node, tmp, &con->port_list, list) { + __unlink_port(con, node); + remove_port_node(node); + put_device(&con->dev); + } + + mutex_unlock(&con->port_list_lock); + + free_pld(con->pld); +}
Universal Serial Bus
ee64fc599b721cafb56a28ce2922343e02aa2d41
heikki krogerus
drivers
usb
typec
usb: cdns3: imx: add power lost support for system resume
imx need special handle when controller lost power
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add power lost support for system resume
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['cdns3', 'imx']
['c']
1
34
0
--- diff --git a/drivers/usb/cdns3/cdns3-imx.c b/drivers/usb/cdns3/cdns3-imx.c --- a/drivers/usb/cdns3/cdns3-imx.c +++ b/drivers/usb/cdns3/cdns3-imx.c + + +/* indicate if the controller was power lost before */ +static inline bool cdns_imx_is_power_lost(struct cdns_imx *data) +{ + u32 value; + + value = cdns_imx_readl(data, usb3_core_ctrl1); + if ((value & sw_reset_mask) == all_sw_reset) + return true; + else + return false; +} + +static int cdns_imx_system_resume(struct device *dev) +{ + struct cdns_imx *data = dev_get_drvdata(dev); + int ret; + + ret = cdns_imx_resume(dev); + if (ret) + return ret; + + if (cdns_imx_is_power_lost(data)) { + dev_dbg(dev, "resume from power lost "); + ret = cdns_imx_noncore_init(data); + if (ret) + cdns_imx_suspend(dev); + } + + return ret; +} + + set_system_sleep_pm_ops(cdns_imx_suspend, cdns_imx_system_resume)
Universal Serial Bus
2fd69eca06333a4c1170e81bedf2736548ccb63d
frank li
drivers
usb
cdns3
usb: core: track superspeed plus genxxy
introduce ssp_rate field to usb_device structure to capture the connected superspeed plus signaling rate generation and lane count with the corresponding usb_ssp_rate enum.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add some missing support for usb 3.2
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['h', 'c']
3
85
1
--- diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c + rhdev->ssp_rate = usb_ssp_gen_unknown; - fallthrough; + rhdev->ssp_rate = usb_ssp_gen_2x2; + rhdev->speed = usb_speed_super_plus; + break; + rhdev->ssp_rate = usb_ssp_gen_2x1; diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c +#include <linux/bitfield.h> +/** + * get_port_ssp_rate - match the extended port status to ssp rate + * @hdev: the hub device + * @ext_portstatus: extended port status + * + * match the extended port status speed id to the superspeed plus sublink speed + * capability attributes. base on the number of connected lanes and speed, + * return the corresponding enum usb_ssp_rate. + */ +static enum usb_ssp_rate get_port_ssp_rate(struct usb_device *hdev, + u32 ext_portstatus) +{ + struct usb_ssp_cap_descriptor *ssp_cap = hdev->bos->ssp_cap; + u32 attr; + u8 speed_id; + u8 ssac; + u8 lanes; + int i; + + if (!ssp_cap) + goto out; + + speed_id = ext_portstatus & usb_ext_port_stat_rx_speed_id; + lanes = usb_ext_port_rx_lanes(ext_portstatus) + 1; + + ssac = le32_to_cpu(ssp_cap->bmattributes) & + usb_ssp_sublink_speed_attribs; + + for (i = 0; i <= ssac; i++) { + u8 ssid; + + attr = le32_to_cpu(ssp_cap->bmsublinkspeedattr[i]); + ssid = field_get(usb_ssp_sublink_speed_ssid, attr); + if (speed_id == ssid) { + u16 mantissa; + u8 lse; + u8 type; + + /* + * note: currently asymmetric lane types are only + * applicable for ssic operate in superspeed protocol + */ + type = field_get(usb_ssp_sublink_speed_st, attr); + if (type == usb_ssp_sublink_speed_st_asym_rx || + type == usb_ssp_sublink_speed_st_asym_tx) + goto out; + + if (field_get(usb_ssp_sublink_speed_lp, attr) != + usb_ssp_sublink_speed_lp_ssp) + goto out; + + lse = field_get(usb_ssp_sublink_speed_lse, attr); + mantissa = field_get(usb_ssp_sublink_speed_lsm, attr); + + /* convert to gbps */ + for (; lse < usb_ssp_sublink_speed_lse_gbps; lse++) + mantissa /= 1000; + + if (mantissa >= 10 && lanes == 1) + return usb_ssp_gen_2x1; + + if (mantissa >= 10 && lanes == 2) + return usb_ssp_gen_2x2; + + if (mantissa >= 5 && lanes == 2) + return usb_ssp_gen_1x2; + + goto out; + } + } + +out: + return usb_ssp_gen_unknown; +} + + udev->ssp_rate = get_port_ssp_rate(hub->hdev, ext_portstatus); + udev->ssp_rate = usb_ssp_gen_unknown; diff --git a/include/linux/usb.h b/include/linux/usb.h --- a/include/linux/usb.h +++ b/include/linux/usb.h + * @ssp_rate: superspeed plus phy signaling rate and lane count + enum usb_ssp_rate ssp_rate;
Universal Serial Bus
0299809be415567366b66f248eed93848b8dc9f3
thinh nguyen
drivers
usb
core
usb: core: hub: remove port_speed_is_ssp()
the get_port_ssp_rate() can replace port_speed_is_ssp(). if the port speed is detected to be in gen2x1, gen1x2, or gen2x2, then the port is operating at superspeed plus.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add some missing support for usb 3.2
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['c']
1
1
30
--- diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c -/* - * return 1 if port speed is superspeedplus, 0 otherwise - * check it from the link protocol field of the current speed id attribute. - * current speed id is got from ext port status request. sublink speed attribute - * table is returned with the hub bos ssp device capability descriptor - */ -static int port_speed_is_ssp(struct usb_device *hdev, int speed_id) -{ - int ssa_count; - u32 ss_attr; - int i; - struct usb_ssp_cap_descriptor *ssp_cap = hdev->bos->ssp_cap; - - if (!ssp_cap) - return 0; - - ssa_count = le32_to_cpu(ssp_cap->bmattributes) & - usb_ssp_sublink_speed_attribs; - - for (i = 0; i <= ssa_count; i++) { - ss_attr = le32_to_cpu(ssp_cap->bmsublinkspeedattr[i]); - if (speed_id == (ss_attr & usb_ssp_sublink_speed_ssid)) - return !!(ss_attr & usb_ssp_sublink_speed_lp); - } - return 0; -} - - else if (hub_is_superspeedplus(hub->hdev) && - port_speed_is_ssp(hub->hdev, ext_portstatus & - usb_ext_port_stat_rx_speed_id)) + else if (udev->ssp_rate != usb_ssp_gen_unknown)
Universal Serial Bus
a59918cb6193b58e6293f58a094466504393f9c4
thinh nguyen
drivers
usb
core
usb: core: hub: print speed name based on ssp rate
check for usb_device->ssp_rate to print the superspeed plus signaling rate generation and lane count.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add some missing support for usb 3.2
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['c']
1
7
3
--- diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c - "plus gen 2" : " gen 1", - (udev->rx_lanes == 2 && udev->tx_lanes == 2) ? - "x2" : "", + " plus" : "", + (udev->ssp_rate == usb_ssp_gen_2x2) ? + " gen 2x2" : + (udev->ssp_rate == usb_ssp_gen_2x1) ? + " gen 2x1" : + (udev->ssp_rate == usb_ssp_gen_1x2) ? + " gen 1x2" : "",
Universal Serial Bus
2d0e82c905b8d802031665eb9dd3b9acddac7580
thinh nguyen
drivers
usb
core
usb: core: sysfs: check for ssp rate in speed attr
check for usb_device->ssp_rate to output the signaling rate for genxxy.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add some missing support for usb 3.2
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['c']
1
4
1
--- diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c - speed = "10000"; + if (udev->ssp_rate == usb_ssp_gen_2x2) + speed = "20000"; + else + speed = "10000";
Universal Serial Bus
d07247ff2515d7d2db60e6492cd4662d87bf7bf2
thinh nguyen
drivers
usb
core
usb: gadget: legacy: fix error return code of msg_bind()
when usb_otg_descriptor_alloc() returns null to usb_desc, no error return code of msg_bind() is assigned. to fix this bug, status is assigned with -enomem in this case.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add some missing support for usb 3.2
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['c']
1
3
1
--- diff --git a/drivers/usb/gadget/legacy/mass_storage.c b/drivers/usb/gadget/legacy/mass_storage.c --- a/drivers/usb/gadget/legacy/mass_storage.c +++ b/drivers/usb/gadget/legacy/mass_storage.c - if (!usb_desc) + if (!usb_desc) { + status = -enomem; + }
Universal Serial Bus
f2b6ebf61e8fcd0b1f03a084d39742b1f6113ac4
jia ju bai
drivers
usb
gadget, legacy
usb: gadget: f_fs: fix memdup_user.cocci warnings
drivers/usb/gadget/function/f_fs.c:3829:8-15: warning opportunity for memdup_user
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add some missing support for usb 3.2
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['c']
1
3
8
--- diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c - data = kmalloc(len, gfp_kernel); - if (!data) - return err_ptr(-enomem); - - if (copy_from_user(data, buf, len)) { - kfree(data); - return err_ptr(-efault); - } + data = memdup_user(buf, len); + if (is_err(data)) + return err_ptr(ptr_err(data));
Universal Serial Bus
423432072d163acf0089bf2821d98404539d7d4c
kernel test robot
drivers
usb
function, gadget
usb: xhci: init root hub ssp rate
initialize usb 3.x root hub superspeed plus rate.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add some missing support for usb 3.2
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['c']
1
2
0
--- diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c + hcd->self.root_hub->ssp_rate = usb_ssp_gen_2x2; + hcd->self.root_hub->ssp_rate = usb_ssp_gen_2x1;
Universal Serial Bus
cd8d66cfae4989ed4b99c98b0c24d0eecba7005f
thinh nguyen mathias nyman mathias nyman linux intel com
drivers
usb
host
usb: xhci: fix port minor revision
some hosts incorrectly use sub-minor version for minor version (i.e. 0x02 instead of 0x20 for bcdusb 0x320 and 0x01 for bcdusb 0x310). currently the xhci driver works around this by just checking for minor revision > 0x01 for usb 3.1 everywhere. with the addition of usb 3.2, checking this gets a bit cumbersome. since there is no usb release with bcdusb 0x301 to 0x309, we can assume that sub-minor version 01 to 09 is incorrect. let's try to fix this and use the minor revision that matches with the usb/xhci spec to help with the version checking within the driver.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add some missing support for usb 3.2
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['c']
1
9
0
--- diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c + /* + * some hosts incorrectly use sub-minor version for minor + * version (i.e. 0x02 instead of 0x20 for bcdusb 0x320 and 0x01 + * for bcdusb 0x310). since there is no usb release with sub + * minor version 0x301 to 0x309, we can assume that they are + * incorrect and fix it here. + */ + if (minor_revision > 0x00 && minor_revision < 0x10) + minor_revision <<= 4;
Universal Serial Bus
64364bc912c01b33bba6c22e3ccb849bfca96398
thinh nguyen mathias nyman mathias nyman linux intel com
drivers
usb
host
usb: xhci: rewrite xhci_create_usb3_bos_desc()
the current xhci_create_usb3_bos_desc() uses a static bos u8 array and various magic numbers and offsets making it difficult to extend support for usb 3.2. let's rewrite this entire function to support dual-lane in usb 3.2.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add some missing support for usb 3.2
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['c']
1
235
2
--- diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c +#include <linux/bitfield.h> -static int xhci_create_usb3_bos_desc(struct xhci_hcd *xhci, char *buf, +/* default sublink speed attribute of each lane */ +static u32 ssp_cap_default_ssa[] = { + 0x00050034, /* usb 3.0 ss gen1x1 id:4 symmetric rx 5gbps */ + 0x000500b4, /* usb 3.0 ss gen1x1 id:4 symmetric tx 5gbps */ + 0x000a4035, /* usb 3.1 ssp gen2x1 id:5 symmetric rx 10gbps */ + 0x000a40b5, /* usb 3.1 ssp gen2x1 id:5 symmetric tx 10gbps */ + 0x00054036, /* usb 3.2 ssp gen1x2 id:6 symmetric rx 5gbps */ + 0x000540b6, /* usb 3.2 ssp gen1x2 id:6 symmetric tx 5gbps */ + 0x000a4037, /* usb 3.2 ssp gen2x2 id:7 symmetric rx 10gbps */ + 0x000a40b7, /* usb 3.2 ssp gen2x2 id:7 symmetric tx 10gbps */ +}; + +static int xhci_create_usb3x_bos_desc(struct xhci_hcd *xhci, char *buf, + u16 wlength) +{ + struct usb_bos_descriptor *bos; + struct usb_ss_cap_descriptor *ss_cap; + struct usb_ssp_cap_descriptor *ssp_cap; + struct xhci_port_cap *port_cap = null; + u16 bcdusb; + u32 reg; + u32 min_rate = 0; + u8 min_ssid; + u8 ssac; + u8 ssic; + int offset; + int i; + + /* bos descriptor */ + bos = (struct usb_bos_descriptor *)buf; + bos->blength = usb_dt_bos_size; + bos->bdescriptortype = usb_dt_bos; + bos->wtotallength = cpu_to_le16(usb_dt_bos_size + + usb_dt_usb_ss_cap_size); + bos->bnumdevicecaps = 1; + + /* create the descriptor for port with the highest revision */ + for (i = 0; i < xhci->num_port_caps; i++) { + u8 major = xhci->port_caps[i].maj_rev; + u8 minor = xhci->port_caps[i].min_rev; + u16 rev = (major << 8) | minor; + + if (i == 0 || bcdusb < rev) { + bcdusb = rev; + port_cap = &xhci->port_caps[i]; + } + } + + if (bcdusb >= 0x0310) { + if (port_cap->psi_count) { + u8 num_sym_ssa = 0; + + for (i = 0; i < port_cap->psi_count; i++) { + if ((port_cap->psi[i] & plt_mask) == plt_sym) + num_sym_ssa++; + } + + ssac = port_cap->psi_count + num_sym_ssa - 1; + ssic = port_cap->psi_uid_count - 1; + } else { + if (bcdusb >= 0x0320) + ssac = 7; + else + ssac = 3; + + ssic = (ssac + 1) / 2 - 1; + } + + bos->bnumdevicecaps++; + bos->wtotallength = cpu_to_le16(usb_dt_bos_size + + usb_dt_usb_ss_cap_size + + usb_dt_usb_ssp_cap_size(ssac)); + } + + if (wlength < usb_dt_bos_size + usb_dt_usb_ss_cap_size) + return wlength; + + /* superspeed usb device capability */ + ss_cap = (struct usb_ss_cap_descriptor *)&buf[usb_dt_bos_size]; + ss_cap->blength = usb_dt_usb_ss_cap_size; + ss_cap->bdescriptortype = usb_dt_device_capability; + ss_cap->bdevcapabilitytype = usb_ss_cap_type; + ss_cap->bmattributes = 0; /* set later */ + ss_cap->wspeedsupported = cpu_to_le16(usb_5gbps_operation); + ss_cap->bfunctionalitysupport = usb_low_speed_operation; + ss_cap->bu1devexitlat = 0; /* set later */ + ss_cap->bu2devexitlat = 0; /* set later */ + + reg = readl(&xhci->cap_regs->hcc_params); + if (hcc_ltc(reg)) + ss_cap->bmattributes |= usb_ltm_support; + + if ((xhci->quirks & xhci_lpm_support)) { + reg = readl(&xhci->cap_regs->hcs_params3); + ss_cap->bu1devexitlat = hcs_u1_latency(reg); + ss_cap->bu2devexitlat = cpu_to_le16(hcs_u2_latency(reg)); + } + + if (wlength < le16_to_cpu(bos->wtotallength)) + return wlength; + + if (bcdusb < 0x0310) + return le16_to_cpu(bos->wtotallength); + + ssp_cap = (struct usb_ssp_cap_descriptor *)&buf[usb_dt_bos_size + + usb_dt_usb_ss_cap_size]; + ssp_cap->blength = usb_dt_usb_ssp_cap_size(ssac); + ssp_cap->bdescriptortype = usb_dt_device_capability; + ssp_cap->bdevcapabilitytype = usb_ssp_cap_type; + ssp_cap->breserved = 0; + ssp_cap->wreserved = 0; + ssp_cap->bmattributes = + cpu_to_le32(field_prep(usb_ssp_sublink_speed_attribs, ssac) | + field_prep(usb_ssp_sublink_speed_ids, ssic)); + + if (!port_cap->psi_count) { + for (i = 0; i < ssac + 1; i++) + ssp_cap->bmsublinkspeedattr[i] = + cpu_to_le32(ssp_cap_default_ssa[i]); + + min_ssid = 4; + goto out; + } + + offset = 0; + for (i = 0; i < port_cap->psi_count; i++) { + u32 psi; + u32 attr; + u8 ssid; + u8 lp; + u8 lse; + u8 psie; + u16 lane_mantissa; + u16 psim; + u16 plt; + + psi = port_cap->psi[i]; + ssid = xhci_ext_port_psiv(psi); + lp = xhci_ext_port_lp(psi); + psie = xhci_ext_port_psie(psi); + psim = xhci_ext_port_psim(psi); + plt = psi & plt_mask; + + lse = psie; + lane_mantissa = psim; + + /* shift to gbps and set ssp link protocol if 10gpbs */ + for (; psie < usb_ssp_sublink_speed_lse_gbps; psie++) + psim /= 1000; + + if (!min_rate || psim < min_rate) { + min_ssid = ssid; + min_rate = psim; + } + + /* some host controllers don't set the link protocol for ssp */ + if (psim >= 10) + lp = usb_ssp_sublink_speed_lp_ssp; + + /* + * psim and psie represent the total speed of psi. the bos + * descriptor ssp sublink speed attribute lane mantissa + * describes the lane speed. e.g. psim and psie for gen2x2 + * is 20gbps, but the bos descriptor lane speed mantissa is + * 10gbps. check and modify the mantissa value to match the + * lane speed. + */ + if (bcdusb == 0x0320 && plt == plt_sym) { + /* + * the psi dword for gen1x2 and gen2x1 share the same + * values. but the lane speed for gen1x2 is 5gbps while + * gen2x1 is 10gbps. if the previous psi dword ssid is + * 5 and the psie and psim match with ssid 6, let's + * assume that the controller follows the default speed + * id with ssid 6 for gen1x2. + */ + if (ssid == 6 && psie == 3 && psim == 10 && i) { + u32 prev = port_cap->psi[i - 1]; + + if ((prev & plt_mask) == plt_sym && + xhci_ext_port_psiv(prev) == 5 && + xhci_ext_port_psie(prev) == 3 && + xhci_ext_port_psim(prev) == 10) { + lse = usb_ssp_sublink_speed_lse_gbps; + lane_mantissa = 5; + } + } + + if (psie == 3 && psim > 10) { + lse = usb_ssp_sublink_speed_lse_gbps; + lane_mantissa = 10; + } + } + + attr = (field_prep(usb_ssp_sublink_speed_ssid, ssid) | + field_prep(usb_ssp_sublink_speed_lp, lp) | + field_prep(usb_ssp_sublink_speed_lse, lse) | + field_prep(usb_ssp_sublink_speed_lsm, lane_mantissa)); + + switch (plt) { + case plt_sym: + attr |= field_prep(usb_ssp_sublink_speed_st, + usb_ssp_sublink_speed_st_sym_rx); + ssp_cap->bmsublinkspeedattr[offset++] = cpu_to_le32(attr); + + attr &= ~usb_ssp_sublink_speed_st; + attr |= field_prep(usb_ssp_sublink_speed_st, + usb_ssp_sublink_speed_st_sym_tx); + ssp_cap->bmsublinkspeedattr[offset++] = cpu_to_le32(attr); + break; + case plt_asym_rx: + attr |= field_prep(usb_ssp_sublink_speed_st, + usb_ssp_sublink_speed_st_asym_rx); + ssp_cap->bmsublinkspeedattr[offset++] = cpu_to_le32(attr); + break; + case plt_asym_tx: + attr |= field_prep(usb_ssp_sublink_speed_st, + usb_ssp_sublink_speed_st_asym_tx); + ssp_cap->bmsublinkspeedattr[offset++] = cpu_to_le32(attr); + break; + } + } +out: + ssp_cap->wfunctionalitysupport = + cpu_to_le16(field_prep(usb_ssp_min_sublink_speed_attribute_id, + min_ssid) | + field_prep(usb_ssp_min_rx_lane_count, 1) | + field_prep(usb_ssp_min_tx_lane_count, 1)); + + return le16_to_cpu(bos->wtotallength); +} + +static __maybe_unused int xhci_create_usb3_bos_desc(struct xhci_hcd *xhci, char *buf, - retval = xhci_create_usb3_bos_desc(xhci, buf, wlength); + retval = xhci_create_usb3x_bos_desc(xhci, buf, wlength);
Universal Serial Bus
eb02aaf21f29ea8706ab3ebdb41cb33a090b3bfc
thinh nguyen
drivers
usb
host
usb: xhci: remove unused function
now that we replaced the xhci_create_usb3_bos_desc() function. we can remove it along with the static usb_bos_descriptor structure.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add some missing support for usb 3.2
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['c']
1
0
147
--- diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c -/* usb 3 bos descriptor and a capability descriptors, combined. - * fields will be adjusted and added later in xhci_create_usb3_bos_desc() - */ -static u8 usb_bos_descriptor [] = { - usb_dt_bos_size, /* __u8 blength, 5 bytes */ - usb_dt_bos, /* __u8 bdescriptortype */ - 0x0f, 0x00, /* __le16 wtotallength, 15 bytes */ - 0x1, /* __u8 bnumdevicecaps */ - /* first device capability, superspeed */ - usb_dt_usb_ss_cap_size, /* __u8 blength, 10 bytes */ - usb_dt_device_capability, /* device capability */ - usb_ss_cap_type, /* bdevcapabilitytype, superspeed_usb */ - 0x00, /* bmattributes, ltm off by default */ - usb_5gbps_operation, 0x00, /* wspeedssupported, 5gbps only */ - 0x03, /* bfunctionalitysupport, - usb 3.0 speed only */ - 0x00, /* bu1devexitlat, set later. */ - 0x00, 0x00, /* __le16 bu2devexitlat, set later. */ - /* second device capability, superspeedplus */ - 0x1c, /* blength 28, will be adjusted later */ - usb_dt_device_capability, /* device capability */ - usb_ssp_cap_type, /* bdevcapabilitytype superspeed_plus */ - 0x00, /* breserved 0 */ - 0x23, 0x00, 0x00, 0x00, /* bmattributes, ssac=3 ssic=1 */ - 0x01, 0x00, /* wfunctionalitysupport */ - 0x00, 0x00, /* wreserved 0 */ - /* default sublink speed attributes, overwrite if custom psi exists */ - 0x34, 0x00, 0x05, 0x00, /* 5gbps, symmetric, rx, id = 4 */ - 0xb4, 0x00, 0x05, 0x00, /* 5gbps, symmetric, tx, id = 4 */ - 0x35, 0x40, 0x0a, 0x00, /* 10gbps, ssp, symmetric, rx, id = 5 */ - 0xb5, 0x40, 0x0a, 0x00, /* 10gbps, ssp, symmetric, tx, id = 5 */ -}; - -static __maybe_unused int xhci_create_usb3_bos_desc(struct xhci_hcd *xhci, char *buf, - u16 wlength) -{ - struct xhci_port_cap *port_cap = null; - int i, ssa_count; - u32 temp; - u16 desc_size, ssp_cap_size, ssa_size = 0; - bool usb3_1 = false; - - desc_size = usb_dt_bos_size + usb_dt_usb_ss_cap_size; - ssp_cap_size = sizeof(usb_bos_descriptor) - desc_size; - - /* does xhci support usb 3.1 enhanced superspeed */ - for (i = 0; i < xhci->num_port_caps; i++) { - if (xhci->port_caps[i].maj_rev == 0x03 && - xhci->port_caps[i].min_rev >= 0x01) { - usb3_1 = true; - port_cap = &xhci->port_caps[i]; - break; - } - } - - if (usb3_1) { - /* does xhci provide a psi table for ssa speed attributes? */ - if (port_cap->psi_count) { - /* two ssa entries for each unique psi id, rx and tx */ - ssa_count = port_cap->psi_uid_count * 2; - ssa_size = ssa_count * sizeof(u32); - ssp_cap_size -= 16; /* skip copying the default ssa */ - } - desc_size += ssp_cap_size; - } - memcpy(buf, &usb_bos_descriptor, min(desc_size, wlength)); - - if (usb3_1) { - /* modify bos descriptor bnumdevicecaps and wtotallength */ - buf[4] += 1; - put_unaligned_le16(desc_size + ssa_size, &buf[2]); - } - - if (wlength < usb_dt_bos_size + usb_dt_usb_ss_cap_size) - return wlength; - - /* indicate whether the host has ltm support. */ - temp = readl(&xhci->cap_regs->hcc_params); - if (hcc_ltc(temp)) - buf[8] |= usb_ltm_support; - - /* set the u1 and u2 exit latencies. */ - if ((xhci->quirks & xhci_lpm_support)) { - temp = readl(&xhci->cap_regs->hcs_params3); - buf[12] = hcs_u1_latency(temp); - put_unaligned_le16(hcs_u2_latency(temp), &buf[13]); - } - - /* if psi table exists, add the custom speed attributes from it */ - if (usb3_1 && port_cap->psi_count) { - u32 ssp_cap_base, bm_attrib, psi, psi_mant, psi_exp; - int offset; - - ssp_cap_base = usb_dt_bos_size + usb_dt_usb_ss_cap_size; - - if (wlength < desc_size) - return wlength; - buf[ssp_cap_base] = ssp_cap_size + ssa_size; - - /* attribute count ssac bits 4:0 and id count ssic bits 8:5 */ - bm_attrib = (ssa_count - 1) & 0x1f; - bm_attrib |= (port_cap->psi_uid_count - 1) << 5; - put_unaligned_le32(bm_attrib, &buf[ssp_cap_base + 4]); - - if (wlength < desc_size + ssa_size) - return wlength; - /* - * create the sublink speed attributes (ssa) array. - * the xhci psi field and usb 3.1 ssa fields are very similar, - * but link type bits 7:6 differ for values 01b and 10b. - * xhci has also only one psi entry for a symmetric link when - * usb 3.1 requires two ssa entries (rx and tx) for every link - */ - offset = desc_size; - for (i = 0; i < port_cap->psi_count; i++) { - psi = port_cap->psi[i]; - psi &= ~usb_ssp_sublink_speed_rsvd; - psi_exp = xhci_ext_port_psie(psi); - psi_mant = xhci_ext_port_psim(psi); - - /* shift to gbps and set ssp link bit(14) if 10gpbs */ - for (; psi_exp < 3; psi_exp++) - psi_mant /= 1000; - if (psi_mant >= 10) - psi |= bit(14); - - if ((psi & plt_mask) == plt_sym) { - /* symmetric, create ssa rx and tx from one psi entry */ - put_unaligned_le32(psi, &buf[offset]); - psi |= 1 << 7; /* turn entry to tx */ - offset += 4; - if (offset >= desc_size + ssa_size) - return desc_size + ssa_size; - } else if ((psi & plt_mask) == plt_asym_rx) { - /* asymetric rx, flip bits 7:6 for ssa */ - psi ^= plt_mask; - } - put_unaligned_le32(psi, &buf[offset]); - offset += 4; - if (offset >= desc_size + ssa_size) - return desc_size + ssa_size; - } - } - /* ssa_size is 0 for other than usb 3.1 hosts */ - return desc_size + ssa_size; -} -
Universal Serial Bus
325c3b9a0b5c25471e85c048609f7177e91c9934
thinh nguyen mathias nyman mathias nyman linux intel com
drivers
usb
host
usb: dwc3: add driver for xilinx platforms
add a new driver for supporting xilinx platforms. this driver is used for some sequence of operations required for xilinx usb controllers. this driver is also used to choose between pipe clock coming from serdes and the suspend clock. before the controller is out of reset, the clock selection should be changed to pipe clock in order to make the usb controller work. there is a register added in xilinx usb controller register space for the same.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add driver for xilinx platforms
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['dwc3']
['kconfig', 'c', 'makefile']
4
349
1
--- diff --git a/drivers/usb/dwc3/kconfig b/drivers/usb/dwc3/kconfig --- a/drivers/usb/dwc3/kconfig +++ b/drivers/usb/dwc3/kconfig +config usb_dwc3_xilinx + tristate "xilinx platforms" + depends on (arch_zynqmp || arch_versal) && of + default usb_dwc3 + help + support xilinx socs with designware core usb3 ip. + this driver handles both zynqmp and versal soc operations. + say 'y' or 'm' if you have one such device. + diff --git a/drivers/usb/dwc3/makefile b/drivers/usb/dwc3/makefile --- a/drivers/usb/dwc3/makefile +++ b/drivers/usb/dwc3/makefile +obj-$(config_usb_dwc3_xilinx) += dwc3-xilinx.o diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c --- a/drivers/usb/dwc3/dwc3-of-simple.c +++ b/drivers/usb/dwc3/dwc3-of-simple.c - { .compatible = "xlnx,zynqmp-dwc3" }, diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c --- /dev/null +++ b/drivers/usb/dwc3/dwc3-xilinx.c +// spdx-license-identifier: gpl-2.0 +/** + * dwc3-xilinx.c - xilinx dwc3 controller specific glue driver + * + * authors: manish narani <manish.narani@xilinx.com> + * anurag kumar vulisha <anurag.kumar.vulisha@xilinx.com> + */ + +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/slab.h> +#include <linux/clk.h> +#include <linux/of.h> +#include <linux/platform_device.h> +#include <linux/dma-mapping.h> +#include <linux/of_platform.h> +#include <linux/pm_runtime.h> +#include <linux/reset.h> +#include <linux/of_address.h> +#include <linux/delay.h> +#include <linux/firmware/xlnx-zynqmp.h> +#include <linux/io.h> + +#include <linux/phy/phy.h> + +/* usb phy reset mask register */ +#define xlnx_usb_phy_rst_en 0x001c +#define xlnx_phy_rst_mask 0x1 + +/* xilinx usb 3.0 ip register */ +#define xlnx_usb_traffic_route_config 0x005c +#define xlnx_usb_traffic_route_fpd 0x1 + +/* versal usb reset id */ +#define versal_usb_reset_id 0xc104036 + +#define xlnx_usb_fpd_pipe_clk 0x7c +#define pipe_clk_deselect 1 +#define pipe_clk_select 0 +#define xlnx_usb_fpd_power_prsnt 0x80 +#define fpd_power_prsnt_option bit(0) + +struct dwc3_xlnx { + int num_clocks; + struct clk_bulk_data *clks; + struct device *dev; + void __iomem *regs; + int (*pltfm_init)(struct dwc3_xlnx *data); +}; + +static void dwc3_xlnx_mask_phy_rst(struct dwc3_xlnx *priv_data, bool mask) +{ + u32 reg; + + /* + * enable or disable ulpi phy reset from usb controller. + * this does not actually reset the phy, but just controls + * whether usb controller can or cannot reset ulpi phy. + */ + reg = readl(priv_data->regs + xlnx_usb_phy_rst_en); + + if (mask) + reg &= ~xlnx_phy_rst_mask; + else + reg |= xlnx_phy_rst_mask; + + writel(reg, priv_data->regs + xlnx_usb_phy_rst_en); +} + +static int dwc3_xlnx_init_versal(struct dwc3_xlnx *priv_data) +{ + struct device *dev = priv_data->dev; + int ret; + + dwc3_xlnx_mask_phy_rst(priv_data, false); + + /* assert and de-assert reset */ + ret = zynqmp_pm_reset_assert(versal_usb_reset_id, + pm_reset_action_assert); + if (ret < 0) { + dev_err_probe(dev, ret, "failed to assert reset "); + return ret; + } + + ret = zynqmp_pm_reset_assert(versal_usb_reset_id, + pm_reset_action_release); + if (ret < 0) { + dev_err_probe(dev, ret, "failed to de-assert reset "); + return ret; + } + + dwc3_xlnx_mask_phy_rst(priv_data, true); + + return 0; +} + +static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data) +{ + struct device *dev = priv_data->dev; + struct reset_control *crst, *hibrst, *apbrst; + struct phy *usb3_phy; + int ret; + u32 reg; + + usb3_phy = devm_phy_get(dev, "usb3-phy"); + if (ptr_err(usb3_phy) == -eprobe_defer) { + ret = -eprobe_defer; + goto err; + } else if (is_err(usb3_phy)) { + usb3_phy = null; + } + + crst = devm_reset_control_get_exclusive(dev, "usb_crst"); + if (is_err(crst)) { + ret = ptr_err(crst); + dev_err_probe(dev, ret, + "failed to get core reset signal "); + goto err; + } + + hibrst = devm_reset_control_get_exclusive(dev, "usb_hibrst"); + if (is_err(hibrst)) { + ret = ptr_err(hibrst); + dev_err_probe(dev, ret, + "failed to get hibernation reset signal "); + goto err; + } + + apbrst = devm_reset_control_get_exclusive(dev, "usb_apbrst"); + if (is_err(apbrst)) { + ret = ptr_err(apbrst); + dev_err_probe(dev, ret, + "failed to get apb reset signal "); + goto err; + } + + ret = reset_control_assert(crst); + if (ret < 0) { + dev_err(dev, "failed to assert core reset "); + goto err; + } + + ret = reset_control_assert(hibrst); + if (ret < 0) { + dev_err(dev, "failed to assert hibernation reset "); + goto err; + } + + ret = reset_control_assert(apbrst); + if (ret < 0) { + dev_err(dev, "failed to assert apb reset "); + goto err; + } + + ret = phy_init(usb3_phy); + if (ret < 0) { + phy_exit(usb3_phy); + goto err; + } + + ret = reset_control_deassert(apbrst); + if (ret < 0) { + dev_err(dev, "failed to release apb reset "); + goto err; + } + + /* set pipe power present signal in fpd power present register*/ + writel(fpd_power_prsnt_option, priv_data->regs + xlnx_usb_fpd_power_prsnt); + + /* set the pipe clock select bit in fpd pipe clock register */ + writel(pipe_clk_select, priv_data->regs + xlnx_usb_fpd_pipe_clk); + + ret = reset_control_deassert(crst); + if (ret < 0) { + dev_err(dev, "failed to release core reset "); + goto err; + } + + ret = reset_control_deassert(hibrst); + if (ret < 0) { + dev_err(dev, "failed to release hibernation reset "); + goto err; + } + + ret = phy_power_on(usb3_phy); + if (ret < 0) { + phy_exit(usb3_phy); + goto err; + } + + /* + * this routes the usb dma traffic to go through fpd path instead + * of reaching ddr directly. this traffic routing is needed to + * make smmu and cci work with usb dma. + */ + if (of_dma_is_coherent(dev->of_node) || device_iommu_mapped(dev)) { + reg = readl(priv_data->regs + xlnx_usb_traffic_route_config); + reg |= xlnx_usb_traffic_route_fpd; + writel(reg, priv_data->regs + xlnx_usb_traffic_route_config); + } + +err: + return ret; +} + +static const struct of_device_id dwc3_xlnx_of_match[] = { + { + .compatible = "xlnx,zynqmp-dwc3", + .data = &dwc3_xlnx_init_zynqmp, + }, + { + .compatible = "xlnx,versal-dwc3", + .data = &dwc3_xlnx_init_versal, + }, + { /* sentinel */ } +}; +module_device_table(of, dwc3_xlnx_of_match); + +static int dwc3_xlnx_probe(struct platform_device *pdev) +{ + struct dwc3_xlnx *priv_data; + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; + const struct of_device_id *match; + void __iomem *regs; + int ret; + + priv_data = devm_kzalloc(dev, sizeof(*priv_data), gfp_kernel); + if (!priv_data) + return -enomem; + + regs = devm_platform_ioremap_resource(pdev, 0); + if (is_err(regs)) { + ret = ptr_err(regs); + dev_err_probe(dev, ret, "failed to map registers "); + return ret; + } + + match = of_match_node(dwc3_xlnx_of_match, pdev->dev.of_node); + + priv_data->pltfm_init = match->data; + priv_data->regs = regs; + priv_data->dev = dev; + + platform_set_drvdata(pdev, priv_data); + + ret = devm_clk_bulk_get_all(priv_data->dev, &priv_data->clks); + if (ret < 0) + return ret; + + priv_data->num_clocks = ret; + + ret = clk_bulk_prepare_enable(priv_data->num_clocks, priv_data->clks); + if (ret) + return ret; + + ret = priv_data->pltfm_init(priv_data); + if (ret) + goto err_clk_put; + + ret = of_platform_populate(np, null, null, dev); + if (ret) + goto err_clk_put; + + pm_runtime_set_active(dev); + pm_runtime_enable(dev); + pm_suspend_ignore_children(dev, false); + pm_runtime_get_sync(dev); + + return 0; + +err_clk_put: + clk_bulk_disable_unprepare(priv_data->num_clocks, priv_data->clks); + clk_bulk_put_all(priv_data->num_clocks, priv_data->clks); + + return ret; +} + +static int dwc3_xlnx_remove(struct platform_device *pdev) +{ + struct dwc3_xlnx *priv_data = platform_get_drvdata(pdev); + struct device *dev = &pdev->dev; + + of_platform_depopulate(dev); + + clk_bulk_disable_unprepare(priv_data->num_clocks, priv_data->clks); + clk_bulk_put_all(priv_data->num_clocks, priv_data->clks); + priv_data->num_clocks = 0; + + pm_runtime_disable(dev); + pm_runtime_put_noidle(dev); + pm_runtime_set_suspended(dev); + + return 0; +} + +static int __maybe_unused dwc3_xlnx_suspend_common(struct device *dev) +{ + struct dwc3_xlnx *priv_data = dev_get_drvdata(dev); + + clk_bulk_disable(priv_data->num_clocks, priv_data->clks); + + return 0; +} + +static int __maybe_unused dwc3_xlnx_resume_common(struct device *dev) +{ + struct dwc3_xlnx *priv_data = dev_get_drvdata(dev); + + return clk_bulk_enable(priv_data->num_clocks, priv_data->clks); +} + +static int __maybe_unused dwc3_xlnx_runtime_idle(struct device *dev) +{ + pm_runtime_mark_last_busy(dev); + pm_runtime_autosuspend(dev); + + return 0; +} + +static universal_dev_pm_ops(dwc3_xlnx_dev_pm_ops, dwc3_xlnx_suspend_common, + dwc3_xlnx_resume_common, dwc3_xlnx_runtime_idle); + +static struct platform_driver dwc3_xlnx_driver = { + .probe = dwc3_xlnx_probe, + .remove = dwc3_xlnx_remove, + .driver = { + .name = "dwc3-xilinx", + .of_match_table = dwc3_xlnx_of_match, + .pm = &dwc3_xlnx_dev_pm_ops, + }, +}; + +module_platform_driver(dwc3_xlnx_driver); + +module_license("gpl v2"); +module_description("xilinx dwc3 controller specific glue driver"); +module_author("manish narani <manish.narani@xilinx.com>"); +module_author("anurag kumar vulisha <anurag.kumar.vulisha@xilinx.com>");
Universal Serial Bus
84770f028fabab4cb66188d583ed12652f30576b
manish narani
drivers
usb
dwc3
usb: dwc3: pci: add support for the intel alder lake-m
this patch adds the necessary pci id for intel alder lake-m devices.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add support for the intel alder lake-m
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['dwc3', 'pci']
['c']
1
4
0
--- diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c +#define pci_device_id_intel_adlm 0x54ee + { pci_vdevice(intel, pci_device_id_intel_adlm), + (kernel_ulong_t) &dwc3_pci_intel_swnode, }, +
Universal Serial Bus
782de5e7190de0a773417708e17d9461d9109bf9
heikki krogerus
drivers
usb
dwc3
usb: f_uac2: adds support for ss and ssp
patch adds support of ss and ssp speed.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
adds support for ss and ssp
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['f_uac2']
['c']
1
161
67
--- diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/f_uac2.c +static struct usb_endpoint_descriptor ss_epout_desc = { + .blength = usb_dt_endpoint_size, + .bdescriptortype = usb_dt_endpoint, + + .bendpointaddress = usb_dir_out, + .bmattributes = usb_endpoint_xfer_isoc | usb_endpoint_sync_async, + /* .wmaxpacketsize = dynamic */ + .binterval = 4, +}; + +static struct usb_ss_ep_comp_descriptor ss_epout_desc_comp = { + .blength = sizeof(ss_epout_desc_comp), + .bdescriptortype = usb_dt_ss_endpoint_comp, + .bmaxburst = 0, + .bmattributes = 0, + /* wbytesperinterval = dynamic */ +}; + +static struct usb_endpoint_descriptor ss_epin_desc = { + .blength = usb_dt_endpoint_size, + .bdescriptortype = usb_dt_endpoint, + + .bendpointaddress = usb_dir_in, + .bmattributes = usb_endpoint_xfer_isoc | usb_endpoint_sync_async, + /* .wmaxpacketsize = dynamic */ + .binterval = 4, +}; + +static struct usb_ss_ep_comp_descriptor ss_epin_desc_comp = { + .blength = sizeof(ss_epin_desc_comp), + .bdescriptortype = usb_dt_ss_endpoint_comp, + .bmaxburst = 0, + .bmattributes = 0, + /* wbytesperinterval = dynamic */ +}; + +static struct usb_descriptor_header *ss_audio_desc[] = { + (struct usb_descriptor_header *)&iad_desc, + (struct usb_descriptor_header *)&std_ac_if_desc, + + (struct usb_descriptor_header *)&ac_hdr_desc, + (struct usb_descriptor_header *)&in_clk_src_desc, + (struct usb_descriptor_header *)&out_clk_src_desc, + (struct usb_descriptor_header *)&usb_out_it_desc, + (struct usb_descriptor_header *)&io_in_it_desc, + (struct usb_descriptor_header *)&usb_in_ot_desc, + (struct usb_descriptor_header *)&io_out_ot_desc, + + (struct usb_descriptor_header *)&std_as_out_if0_desc, + (struct usb_descriptor_header *)&std_as_out_if1_desc, + + (struct usb_descriptor_header *)&as_out_hdr_desc, + (struct usb_descriptor_header *)&as_out_fmt1_desc, + (struct usb_descriptor_header *)&ss_epout_desc, + (struct usb_descriptor_header *)&ss_epout_desc_comp, + (struct usb_descriptor_header *)&as_iso_out_desc, + + (struct usb_descriptor_header *)&std_as_in_if0_desc, + (struct usb_descriptor_header *)&std_as_in_if1_desc, + + (struct usb_descriptor_header *)&as_in_hdr_desc, + (struct usb_descriptor_header *)&as_in_fmt1_desc, + (struct usb_descriptor_header *)&ss_epin_desc, + (struct usb_descriptor_header *)&ss_epin_desc_comp, + (struct usb_descriptor_header *)&as_iso_in_desc, + null, +}; + + case usb_speed_super: +static void setup_headers(struct f_uac2_opts *opts, + struct usb_descriptor_header **headers, + enum usb_device_speed speed) +{ + struct usb_ss_ep_comp_descriptor *epout_desc_comp = null; + struct usb_ss_ep_comp_descriptor *epin_desc_comp = null; + struct usb_endpoint_descriptor *epout_desc; + struct usb_endpoint_descriptor *epin_desc; + int i; + + switch (speed) { + case usb_speed_full: + epout_desc = &fs_epout_desc; + epin_desc = &fs_epin_desc; + break; + case usb_speed_high: + epout_desc = &hs_epout_desc; + epin_desc = &hs_epin_desc; + break; + default: + epout_desc = &ss_epout_desc; + epin_desc = &ss_epin_desc; + epout_desc_comp = &ss_epout_desc_comp; + epin_desc_comp = &ss_epin_desc_comp; + } + + i = 0; + headers[i++] = usbdhdr(&iad_desc); + headers[i++] = usbdhdr(&std_ac_if_desc); + headers[i++] = usbdhdr(&ac_hdr_desc); + if (epin_en(opts)) + headers[i++] = usbdhdr(&in_clk_src_desc); + if (epout_en(opts)) { + headers[i++] = usbdhdr(&out_clk_src_desc); + headers[i++] = usbdhdr(&usb_out_it_desc); + } + if (epin_en(opts)) { + headers[i++] = usbdhdr(&io_in_it_desc); + headers[i++] = usbdhdr(&usb_in_ot_desc); + } + if (epout_en(opts)) { + headers[i++] = usbdhdr(&io_out_ot_desc); + headers[i++] = usbdhdr(&std_as_out_if0_desc); + headers[i++] = usbdhdr(&std_as_out_if1_desc); + headers[i++] = usbdhdr(&as_out_hdr_desc); + headers[i++] = usbdhdr(&as_out_fmt1_desc); + headers[i++] = usbdhdr(epout_desc); + if (epout_desc_comp) + headers[i++] = usbdhdr(epout_desc_comp); + + headers[i++] = usbdhdr(&as_iso_out_desc); + } + if (epin_en(opts)) { + headers[i++] = usbdhdr(&std_as_in_if0_desc); + headers[i++] = usbdhdr(&std_as_in_if1_desc); + headers[i++] = usbdhdr(&as_in_hdr_desc); + headers[i++] = usbdhdr(&as_in_fmt1_desc); + headers[i++] = usbdhdr(epin_desc); + if (epin_desc_comp) + headers[i++] = usbdhdr(epin_desc_comp); + + headers[i++] = usbdhdr(&as_iso_in_desc); + } + headers[i] = null; +} + - i = 0; - fs_audio_desc[i++] = usbdhdr(&iad_desc); - fs_audio_desc[i++] = usbdhdr(&std_ac_if_desc); - fs_audio_desc[i++] = usbdhdr(&ac_hdr_desc); - if (epin_en(opts)) - fs_audio_desc[i++] = usbdhdr(&in_clk_src_desc); - if (epout_en(opts)) { - fs_audio_desc[i++] = usbdhdr(&out_clk_src_desc); - fs_audio_desc[i++] = usbdhdr(&usb_out_it_desc); - } - if (epin_en(opts)) { - fs_audio_desc[i++] = usbdhdr(&io_in_it_desc); - fs_audio_desc[i++] = usbdhdr(&usb_in_ot_desc); - } - if (epout_en(opts)) { - fs_audio_desc[i++] = usbdhdr(&io_out_ot_desc); - fs_audio_desc[i++] = usbdhdr(&std_as_out_if0_desc); - fs_audio_desc[i++] = usbdhdr(&std_as_out_if1_desc); - fs_audio_desc[i++] = usbdhdr(&as_out_hdr_desc); - fs_audio_desc[i++] = usbdhdr(&as_out_fmt1_desc); - fs_audio_desc[i++] = usbdhdr(&fs_epout_desc); - fs_audio_desc[i++] = usbdhdr(&as_iso_out_desc); - } - if (epin_en(opts)) { - fs_audio_desc[i++] = usbdhdr(&std_as_in_if0_desc); - fs_audio_desc[i++] = usbdhdr(&std_as_in_if1_desc); - fs_audio_desc[i++] = usbdhdr(&as_in_hdr_desc); - fs_audio_desc[i++] = usbdhdr(&as_in_fmt1_desc); - fs_audio_desc[i++] = usbdhdr(&fs_epin_desc); - fs_audio_desc[i++] = usbdhdr(&as_iso_in_desc); - } - fs_audio_desc[i] = null; - - i = 0; - hs_audio_desc[i++] = usbdhdr(&iad_desc); - hs_audio_desc[i++] = usbdhdr(&std_ac_if_desc); - hs_audio_desc[i++] = usbdhdr(&ac_hdr_desc); - if (epin_en(opts)) - hs_audio_desc[i++] = usbdhdr(&in_clk_src_desc); - if (epout_en(opts)) { - hs_audio_desc[i++] = usbdhdr(&out_clk_src_desc); - hs_audio_desc[i++] = usbdhdr(&usb_out_it_desc); - } - if (epin_en(opts)) { - hs_audio_desc[i++] = usbdhdr(&io_in_it_desc); - hs_audio_desc[i++] = usbdhdr(&usb_in_ot_desc); - } - if (epout_en(opts)) { - hs_audio_desc[i++] = usbdhdr(&io_out_ot_desc); - hs_audio_desc[i++] = usbdhdr(&std_as_out_if0_desc); - hs_audio_desc[i++] = usbdhdr(&std_as_out_if1_desc); - hs_audio_desc[i++] = usbdhdr(&as_out_hdr_desc); - hs_audio_desc[i++] = usbdhdr(&as_out_fmt1_desc); - hs_audio_desc[i++] = usbdhdr(&hs_epout_desc); - hs_audio_desc[i++] = usbdhdr(&as_iso_out_desc); - } - if (epin_en(opts)) { - hs_audio_desc[i++] = usbdhdr(&std_as_in_if0_desc); - hs_audio_desc[i++] = usbdhdr(&std_as_in_if1_desc); - hs_audio_desc[i++] = usbdhdr(&as_in_hdr_desc); - hs_audio_desc[i++] = usbdhdr(&as_in_fmt1_desc); - hs_audio_desc[i++] = usbdhdr(&hs_epin_desc); - hs_audio_desc[i++] = usbdhdr(&as_iso_in_desc); - } - hs_audio_desc[i] = null; + setup_headers(opts, fs_audio_desc, usb_speed_full); + setup_headers(opts, hs_audio_desc, usb_speed_high); + setup_headers(opts, ss_audio_desc, usb_speed_super); + ret = set_ep_max_packet_size(uac2_opts, &ss_epin_desc, usb_speed_super, + true); + if (ret < 0) { + dev_err(dev, "%s:%d error! ", __func__, __line__); + return ret; + } + + ret = set_ep_max_packet_size(uac2_opts, &ss_epout_desc, usb_speed_super, + false); + if (ret < 0) { + dev_err(dev, "%s:%d error! ", __func__, __line__); + return ret; + } + + agdev->in_ep_maxpsize = max_t(u16, agdev->in_ep_maxpsize, + le16_to_cpu(ss_epin_desc.wmaxpacketsize)); + agdev->out_ep_maxpsize = max_t(u16, agdev->out_ep_maxpsize, + le16_to_cpu(ss_epout_desc.wmaxpacketsize)); + + ss_epout_desc.bendpointaddress = fs_epout_desc.bendpointaddress; + ss_epin_desc.bendpointaddress = fs_epin_desc.bendpointaddress; - ret = usb_assign_descriptors(fn, fs_audio_desc, hs_audio_desc, null, - null); + ret = usb_assign_descriptors(fn, fs_audio_desc, hs_audio_desc, ss_audio_desc, + ss_audio_desc);
Universal Serial Bus
f8cb3d556be31d2f41f54a7d7623930b05c9b340
pawel laszczak
drivers
usb
function, gadget
usb: mtu3: support ip-sleep wakeup for mt8183
add support ip-sleep wakeup for mt8183, it's similar to mt8173, and it's also a specific one, but not following ipm rule. due to the index 2 already used by many dts, it's better to keep it unchanged for backward compatibility, treat specific ones without following ipm rule as revision 1.x, meanwhile reserve 3~10 for later revision that follows the ipm rule.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add support usb for mt8183
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['c']
1
12
0
--- diff --git a/drivers/usb/mtu3/mtu3_host.c b/drivers/usb/mtu3/mtu3_host.c --- a/drivers/usb/mtu3/mtu3_host.c +++ b/drivers/usb/mtu3/mtu3_host.c +/* mt8183 */ +#define peri_wk_ctrl0 0x0 +#define wc0_is_c(x) ((u32)(((x) & 0xf) << 28)) /* cycle debounce */ +#define wc0_is_p bit(12) /* polarity */ +#define wc0_is_en bit(6) + + ssusb_uwk_v1_1 = 101, /* specific revision 1.01 */ + case ssusb_uwk_v1_1: + reg = ssusb->uwk_reg_base + peri_wk_ctrl0; + msk = wc0_is_en | wc0_is_c(0xf) | wc0_is_p; + val = enable ? (wc0_is_en | wc0_is_c(0x8)) : 0; + break;
Universal Serial Bus
b1a344589eeaa52be43fba1bde20d483e01018ff
chunfeng yun
drivers
usb
mtu3
usb: xhci-mtk: support ip-sleep wakeup for mt8183
add support ip-sleep wakeup for mt8183, it's similar to mt8173, and it's also a specific one, but not following ipm rule. due to the index 2 already used by many dts, it's better to keep it unchanged for backward compatibility, treat specific ones without following ipm rule as revision 1.x, meanwhile reserve 3~10 for later revision that follows the ipm rule.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add support usb for mt8183
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['c']
1
13
0
--- diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c --- a/drivers/usb/host/xhci-mtk.c +++ b/drivers/usb/host/xhci-mtk.c + +/* mt8183 */ +#define peri_wk_ctrl0 0x0 +#define wc0_is_c(x) ((u32)(((x) & 0xf) << 28)) /* cycle debounce */ +#define wc0_is_p bit(12) /* polarity */ +#define wc0_is_en bit(6) + + ssusb_uwk_v1_1 = 101, /* specific revision 1.01 */ + case ssusb_uwk_v1_1: + reg = mtk->uwk_reg_base + peri_wk_ctrl0; + msk = wc0_is_en | wc0_is_c(0xf) | wc0_is_p; + val = enable ? (wc0_is_en | wc0_is_c(0x8)) : 0; + break;
Universal Serial Bus
c03b4ccb9481c3664e83249bc673559f057667ab
chunfeng yun
drivers
usb
host
usb: mtu3: add support ip-sleep wakeup for mt8192
add add support ip-sleep wakeup for mt8192, it's a specific revision, not following ipm rule.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add support ip-sleep wakeup for mt8192
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['mtu3']
['c']
1
10
0
--- diff --git a/drivers/usb/mtu3/mtu3_host.c b/drivers/usb/mtu3/mtu3_host.c --- a/drivers/usb/mtu3/mtu3_host.c +++ b/drivers/usb/mtu3/mtu3_host.c +/* mt8192 */ +#define wc0_ssusb0_cden bit(6) +#define wc0_is_spm_en bit(1) + + ssusb_uwk_v1_2, /* specific revision 1.02 */ + case ssusb_uwk_v1_2: + reg = ssusb->uwk_reg_base + peri_wk_ctrl0; + msk = wc0_ssusb0_cden | wc0_is_spm_en; + val = enable ? msk : 0; + break;
Universal Serial Bus
a099d36884365748d68d77d0873e3e91f507ed12
chunfeng yun
drivers
usb
mtu3
usb: serial: drop unused suspending flag
the suspending flag was added back in 2009 but no users ever followed. remove it.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add support for multi-interface functions
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['serial']
['h', 'c']
2
1
8
--- diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c - serial->suspending = 1; - - if (r < 0) { - serial->suspending = 0; + if (r < 0) - } - serial->suspending = 0; - serial->suspending = 0; diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h - unsigned char suspending:1;
Universal Serial Bus
53366a9f917a8601dcad0fd9768d5956cd2f99a6
johan hovold greg kroah hartman gregkh linuxfoundation org
drivers
usb
serial, usb
usb: serial: refactor endpoint classification
refactor endpoint classification and replace the build-time endpoint-array sanity checks with runtime checks in preparation for handling endpoints from a sibling interface.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add support for multi-interface functions
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['serial']
['c']
1
31
20
--- diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c +static void store_endpoint(struct usb_serial *serial, + struct usb_serial_endpoints *epds, + struct usb_endpoint_descriptor *epd) +{ + struct device *dev = &serial->interface->dev; + u8 addr = epd->bendpointaddress; + + if (usb_endpoint_is_bulk_in(epd)) { + if (epds->num_bulk_in == array_size(epds->bulk_in)) + return; + dev_dbg(dev, "found bulk in endpoint %02x ", addr); + epds->bulk_in[epds->num_bulk_in++] = epd; + } else if (usb_endpoint_is_bulk_out(epd)) { + if (epds->num_bulk_out == array_size(epds->bulk_out)) + return; + dev_dbg(dev, "found bulk out endpoint %02x ", addr); + epds->bulk_out[epds->num_bulk_out++] = epd; + } else if (usb_endpoint_is_int_in(epd)) { + if (epds->num_interrupt_in == array_size(epds->interrupt_in)) + return; + dev_dbg(dev, "found interrupt in endpoint %02x ", addr); + epds->interrupt_in[epds->num_interrupt_in++] = epd; + } else if (usb_endpoint_is_int_out(epd)) { + if (epds->num_interrupt_out == array_size(epds->interrupt_out)) + return; + dev_dbg(dev, "found interrupt out endpoint %02x ", addr); + epds->interrupt_out[epds->num_interrupt_out++] = epd; + } +} + - struct device *dev = &serial->interface->dev; - build_bug_on(array_size(epds->bulk_in) < usb_maxendpoints / 2); - build_bug_on(array_size(epds->bulk_out) < usb_maxendpoints / 2); - build_bug_on(array_size(epds->interrupt_in) < usb_maxendpoints / 2); - build_bug_on(array_size(epds->interrupt_out) < usb_maxendpoints / 2); - - - if (usb_endpoint_is_bulk_in(epd)) { - dev_dbg(dev, "found bulk in on endpoint %u ", i); - epds->bulk_in[epds->num_bulk_in++] = epd; - } else if (usb_endpoint_is_bulk_out(epd)) { - dev_dbg(dev, "found bulk out on endpoint %u ", i); - epds->bulk_out[epds->num_bulk_out++] = epd; - } else if (usb_endpoint_is_int_in(epd)) { - dev_dbg(dev, "found interrupt in on endpoint %u ", i); - epds->interrupt_in[epds->num_interrupt_in++] = epd; - } else if (usb_endpoint_is_int_out(epd)) { - dev_dbg(dev, "found interrupt out on endpoint %u ", i); - epds->interrupt_out[epds->num_interrupt_out++] = epd; - } + store_endpoint(serial, epds, epd);
Universal Serial Bus
b3431093ad05c5242d87fcf94bddc7a84a2134f5
johan hovold greg kroah hartman gregkh linuxfoundation org
drivers
usb
serial
usb: serial: add support for multi-interface functions
a single usb function can be implemented using a group of interfaces and this is for example commonly used for communication class devices.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add support for multi-interface functions
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['serial']
['h', 'c']
2
80
11
--- diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c +int usb_serial_claim_interface(struct usb_serial *serial, struct usb_interface *intf) +{ + struct usb_driver *driver = serial->type->usb_driver; + int ret; + + if (serial->sibling) + return -ebusy; + + ret = usb_driver_claim_interface(driver, intf, serial); + if (ret) { + dev_err(&serial->interface->dev, + "failed to claim sibling interface: %d ", ret); + return ret; + } + + serial->sibling = intf; + + return 0; +} +export_symbol_gpl(usb_serial_claim_interface); + +static void release_sibling(struct usb_serial *serial, struct usb_interface *intf) +{ + struct usb_driver *driver = serial->type->usb_driver; + struct usb_interface *sibling; + + if (!serial->sibling) + return; + + if (intf == serial->sibling) + sibling = serial->interface; + else + sibling = serial->sibling; + + usb_set_intfdata(sibling, null); + usb_driver_release_interface(driver, sibling); +} + - struct usb_serial_endpoints *epds) + struct usb_serial_endpoints *epds, + struct usb_interface *intf) - iface_desc = serial->interface->cur_altsetting; + iface_desc = intf->cur_altsetting; - goto err_put_serial; + goto err_release_sibling; - goto err_put_serial; + goto err_release_sibling; - find_endpoints(serial, epds); + find_endpoints(serial, epds, interface); + if (serial->sibling) + find_endpoints(serial, epds, serial->sibling); -err_put_serial: +err_release_sibling: + release_sibling(serial, interface); + /* sibling interface is cleaning up */ + if (!serial) + return; + + release_sibling(serial, interface); + - int i, r = 0; + int i, r; + + /* suspend when called for first sibling interface */ + if (serial->suspend_count++) + return 0; - if (r < 0) - goto err_out; + if (r < 0) { + serial->suspend_count--; + return r; + } -err_out: - return r; + + return 0; + /* resume when called for last sibling interface */ + if (--serial->suspend_count) + return 0; + + /* resume when called for last sibling interface */ + if (--serial->suspend_count) + return 0; + diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h + * @sibling: pointer to the struct usb_interface of any sibling interface + * @suspend_count: number of suspended (sibling) interfaces + struct usb_interface *sibling; + unsigned int suspend_count; + +int usb_serial_claim_interface(struct usb_serial *serial, struct usb_interface *intf); +
Universal Serial Bus
5de03c99691d5b0b6253fda1d1d3bbc8239aadb8
johan hovold
drivers
usb
serial, usb
usb: serial: xr: claim both interfaces
use the new multi-interface support in usb serial core to properly claim also the control interface during probe. this prevents having another driver claim the control interface and makes core allocate resources also for the interrupt endpoint (currently unused).
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add support for multi-interface functions
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['serial']
['c']
1
23
3
--- diff --git a/drivers/usb/serial/xr_serial.c b/drivers/usb/serial/xr_serial.c --- a/drivers/usb/serial/xr_serial.c +++ b/drivers/usb/serial/xr_serial.c +#include <linux/usb/cdc.h> - /* don't bind to control interface */ - if (serial->interface->cur_altsetting->desc.binterfacenumber == 0) + struct usb_interface *control = serial->interface; + struct usb_host_interface *alt = control->cur_altsetting; + struct usb_cdc_parsed_header hdrs; + struct usb_cdc_union_desc *desc; + struct usb_interface *data; + int ret; + + ret = cdc_parse_cdc_header(&hdrs, control, alt->extra, alt->extralen); + if (ret < 0) + desc = hdrs.usb_cdc_union_desc; + if (!desc) + return -enodev; + + data = usb_ifnum_to_if(serial->dev, desc->bslaveinterface0); + if (!data) + return -enodev; + + ret = usb_serial_claim_interface(serial, data); + if (ret) + return ret; + - { usb_device(0x04e2, 0x1410) }, /* xr21v141x */ + { usb_device_interface_class(0x04e2, 0x1410, usb_class_comm) }, /* xr21v141x */
Universal Serial Bus
5fec21e74bfc1db764fdab013162d839cc889290
johan hovold
drivers
usb
serial
usb: serial: ftdi_sio: add ids for ids gmbh products
add the ids gmbh vendor id and the product ids for si31a (2xrs232) and cm31a (lorawan modem).
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add ids for ids gmbh products
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['serial', 'ftdi_sio']
['h', 'c']
2
10
0
--- diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c + /* ids gmbh devices */ + { usb_device(ids_vid, ids_si31a_pid) }, + { usb_device(ids_vid, ids_cm31a_pid) }, diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h +/* + * ids gmbh + */ +#define ids_vid 0x2caf +#define ids_si31a_pid 0x13a2 +#define ids_cm31a_pid 0x13a3 +
Universal Serial Bus
c5a80540e425a5f9a82b0f3163e3b6a4331f33bc
dominik andreas schorpp
drivers
usb
serial
usb: serial: ftdi_sio: add novatech orionmx product id
add pid for the novatech orionmx so it can be automatically detected.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add novatech orionmx product id
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['serial', 'ftdi_sio']
['h', 'c']
2
2
0
--- diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c + { usb_device(ftdi_vid, ftdi_nt_orionmx_pid) }, diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h +#define ftdi_nt_orionmx_pid 0x7c93 /* orionmx */
Universal Serial Bus
bc96c72df33ee81b24d87eab953c73f7bcc04f29
george mccollister
drivers
usb
serial
usb: serial: omninet: add device id for zyxel omni 56k plus
add device id for zyxel omni 56k plus modem, this modem include:
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add device id for zyxel omni 56k plus
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['serial', 'omninet']
['c']
1
2
0
--- diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c --- a/drivers/usb/serial/omninet.c +++ b/drivers/usb/serial/omninet.c +#define zyxel_omni_56k_plus_id 0x1500 + { usb_device(zyxel_vendor_id, zyxel_omni_56k_plus_id) },
Universal Serial Bus
fc0b3dc9a11771c3919eaaaf9d649138b095aa0f
alexandre griveaux
drivers
usb
serial
usb: serial: option: add telit le910-s1 compositions 0x7010, 0x7011
add support for the following telit le910-s1 compositions:
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add telit le910-s1 compositions 0x7010, 0x7011
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['serial', 'option']
['c']
1
4
0
--- diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c + { usb_device_interface_class(telit_vendor_id, 0x7010, 0xff), /* telit le910-s1 (rndis) */ + .driver_info = nctrl(2) }, + { usb_device_interface_class(telit_vendor_id, 0x7011, 0xff), /* telit le910-s1 (ecm) */ + .driver_info = nctrl(2) },
Universal Serial Bus
e467714f822b5d167a7fb03d34af91b5b6af1827
daniele palmas
drivers
usb
serial
usb: serial: pl2303: add device id for adlink nd-6530 gc
this adds the device id for the adlink nd-6530 which is a pl2303gc based device.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add device id for adlink nd-6530 gc
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['serial', 'pl2303']
['h', 'c']
2
2
0
--- diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c + { usb_device(adlink_vendor_id, adlink_nd6530gc_product_id) }, diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h +#define adlink_nd6530gc_product_id 0x653a
Universal Serial Bus
f8e8c1b2f782e7391e8a1c25648ce756e2a7d481
zolton jheng
drivers
usb
serial
usb: serial: ti_usb_3410_5052: add startech.com device id
this adds support for the startech.com generic serial to usb converter. it seems to be a bone stock ti_3410. i have been using this patch for years.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add startech.com device id
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['serial', 'ti_usb_3410_5052']
['c']
1
3
0
--- diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c +#define startech_vendor_id 0x14b0 + { usb_device(startech_vendor_id, ti_3410_product_id) }, + { usb_device(startech_vendor_id, ti_3410_product_id) },
Universal Serial Bus
89b1a3d811e6f8065d6ae8a25e7682329b4a31e2
sean maclennan
drivers
usb
serial
usb: serial: ti_usb_3410_5052: drop closing_wait module parameter
the ti_usb_3410_5052 has supported changing the closing_wait parameter through tiocsserial (setserial) for about a decade and commit f1175daa5312 ("usb: ti_usb_3410_5052: kill custom closing_wait").
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
drop closing_wait module parameter
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['serial', 'ti_usb_3410_5052']
['c']
1
1
7
--- diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c -static int closing_wait = ti_default_closing_wait; - -module_param(closing_wait, int, s_irugo | s_iwusr); -module_parm_desc(closing_wait, - "maximum wait for data to drain in close, in .01 secs, default is 4000"); - - port->port.closing_wait = msecs_to_jiffies(10 * closing_wait); + port->port.closing_wait = msecs_to_jiffies(10 * ti_default_closing_wait);
Universal Serial Bus
9b31f8cd9174c835e76b63bd71f82dca4b3d7e4f
johan hovold
drivers
usb
serial
usb: serial: xr: add support for xr21b1411
the single-port xr21b1411 is similar to the xr21b142x type but uses 12-bit registers and 16-bit register addresses, the register requests are different and are directed at the device rather than interface, and 5 and 6-bit words are not supported.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add support for xr21b1411
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['serial', 'xr']
['c']
1
48
16
--- diff --git a/drivers/usb/serial/xr_serial.c b/drivers/usb/serial/xr_serial.c --- a/drivers/usb/serial/xr_serial.c +++ b/drivers/usb/serial/xr_serial.c - u8 uart_enable; - u8 flow_control; - u8 xon_char; - u8 xoff_char; - u8 tx_break; - u8 gpio_mode; - u8 gpio_direction; - u8 gpio_set; - u8 gpio_clear; - u8 gpio_status; - u8 custom_driver; - + u16 uart_enable; + u16 flow_control; + u16 xon_char; + u16 xoff_char; + u16 tx_break; + u16 gpio_mode; + u16 gpio_direction; + u16 gpio_set; + u16 gpio_clear; + u16 gpio_status; + u16 custom_driver; + + bool have_5_6_bit_mode; + xr21b1411, + .have_5_6_bit_mode = true, + [xr21b1411] = { + .reg_width = 12, + .reg_recipient = usb_recip_device, + .set_reg = 0x00, + .get_reg = 0x01, + + .uart_enable = 0xc00, + .flow_control = 0xc06, + .xon_char = 0xc07, + .xoff_char = 0xc08, + .tx_break = 0xc0a, + .gpio_mode = 0xc0c, + .gpio_direction = 0xc0d, + .gpio_set = 0xc0e, + .gpio_clear = 0xc0f, + .gpio_status = 0xc10, + .custom_driver = 0x20d, + }, -static int xr_set_reg(struct usb_serial_port *port, u8 channel, u8 reg, u16 val) +static int xr_set_reg(struct usb_serial_port *port, u8 channel, u16 reg, u16 val) -static int xr_get_reg(struct usb_serial_port *port, u8 channel, u8 reg, u16 *val) +static int xr_get_reg(struct usb_serial_port *port, u8 channel, u16 reg, u16 *val) -static int xr_set_reg_uart(struct usb_serial_port *port, u8 reg, u16 val) +static int xr_set_reg_uart(struct usb_serial_port *port, u16 reg, u16 val) -static int xr_get_reg_uart(struct usb_serial_port *port, u8 reg, u16 *val) +static int xr_get_reg_uart(struct usb_serial_port *port, u16 reg, u16 *val) + struct xr_data *data = usb_get_serial_port_data(port); + if (!data->type->have_5_6_bit_mode && + (c_csize(tty) == cs5 || c_csize(tty) == cs6)) { + tty->termios.c_cflag &= ~csize; + if (old_termios) + tty->termios.c_cflag |= old_termios->c_cflag & csize; + else + tty->termios.c_cflag |= cs8; + } + + { xr_device(0x04e2, 0x1411, xr21b1411) },
Universal Serial Bus
4099d4ba476325100fcafb139fc6c49d0441bc7c
johan hovold
drivers
usb
serial
usb: serial: xr: add support for xr21b1421, xr21b1422 and xr21b1424
the xr21b1421, xr21b1422 and xr21b1424 are the one-, two- and four-port models of a second xr21b142x type of the maxlinear/exar usb uarts.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add support for xr21b1421, xr21b1422 and xr21b1424
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['serial', 'xr']
['c']
1
262
76
- register layout - register width (16-bit instead of 8-bit) - vendor register requests - uart enable/disable sequence - custom-driver mode flag - three additional gpios (9 instead of 6) --- diff --git a/drivers/usb/serial/xr_serial.c b/drivers/usb/serial/xr_serial.c --- a/drivers/usb/serial/xr_serial.c +++ b/drivers/usb/serial/xr_serial.c -/* usb requests */ -#define xr21v141x_set_req 0 -#define xr21v141x_get_req 1 - - -#define xr21v141x_uart_break_on 0xff -#define xr21v141x_uart_break_off 0 +#define xr_gpio_clk bit(6) +#define xr_gpio_xen bit(7) +#define xr_gpio_txt bit(8) +#define xr_gpio_rxt bit(9) -#define xr_gpio_mode_mask genmask(2, 0) -#define xr_gpio_mode_rts_cts 0x1 -#define xr_gpio_mode_dtr_dsr 0x2 -#define xr_gpio_mode_rs485 0x3 -#define xr_gpio_mode_rs485_addr 0x4 +#define xr_gpio_mode_sel_mask genmask(2, 0) +#define xr_gpio_mode_sel_rts_cts 0x1 +#define xr_gpio_mode_sel_dtr_dsr 0x2 +#define xr_gpio_mode_sel_rs485 0x3 +#define xr_gpio_mode_sel_rs485_addr 0x4 +#define xr_gpio_mode_tx_toggle 0x100 +#define xr_gpio_mode_rx_toggle 0x200 + +#define xr_custom_driver_active 0x1 + +static int xr21v141x_uart_enable(struct usb_serial_port *port); +static int xr21v141x_uart_disable(struct usb_serial_port *port); +static void xr21v141x_set_line_settings(struct tty_struct *tty, + struct usb_serial_port *port, struct ktermios *old_termios); + int reg_width; + u8 reg_recipient; + u8 set_reg; + u8 get_reg; + + u8 custom_driver; + + bool have_xmit_toggle; + + int (*enable)(struct usb_serial_port *port); + int (*disable)(struct usb_serial_port *port); + void (*set_line_settings)(struct tty_struct *tty, + struct usb_serial_port *port, + struct ktermios *old_termios); + xr21b142x, + .reg_width = 8, + .reg_recipient = usb_recip_device, + .set_reg = 0x00, + .get_reg = 0x01, + + + .enable = xr21v141x_uart_enable, + .disable = xr21v141x_uart_disable, + .set_line_settings = xr21v141x_set_line_settings, + }, + [xr21b142x] = { + .reg_width = 16, + .reg_recipient = usb_recip_interface, + .set_reg = 0x00, + .get_reg = 0x00, + + .uart_enable = 0x00, + .flow_control = 0x06, + .xon_char = 0x07, + .xoff_char = 0x08, + .tx_break = 0x0a, + .gpio_mode = 0x0c, + .gpio_direction = 0x0d, + .gpio_set = 0x0e, + .gpio_clear = 0x0f, + .gpio_status = 0x10, + .custom_driver = 0x60, + + .have_xmit_toggle = true, - u8 channel; /* zero-based index */ + u8 channel; /* zero-based index or interface number */ -static int xr_set_reg(struct usb_serial_port *port, u8 block, u8 reg, u8 val) +static int xr_set_reg(struct usb_serial_port *port, u8 channel, u8 reg, u16 val) + struct xr_data *data = usb_get_serial_port_data(port); + const struct xr_type *type = data->type; - ret = usb_control_msg(serial->dev, - usb_sndctrlpipe(serial->dev, 0), - xr21v141x_set_req, - usb_dir_out | usb_type_vendor | usb_recip_device, - val, reg | (block << 8), null, 0, - usb_ctrl_set_timeout); + ret = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), + type->set_reg, + usb_dir_out | usb_type_vendor | type->reg_recipient, + val, (channel << 8) | reg, null, 0, + usb_ctrl_set_timeout); -static int xr_get_reg(struct usb_serial_port *port, u8 block, u8 reg, u8 *val) +static int xr_get_reg(struct usb_serial_port *port, u8 channel, u8 reg, u16 *val) + struct xr_data *data = usb_get_serial_port_data(port); + const struct xr_type *type = data->type; - int ret; + int ret, len; - dmabuf = kmalloc(1, gfp_kernel); + if (type->reg_width == 8) + len = 1; + else + len = 2; + + dmabuf = kmalloc(len, gfp_kernel); - ret = usb_control_msg(serial->dev, - usb_rcvctrlpipe(serial->dev, 0), - xr21v141x_get_req, - usb_dir_in | usb_type_vendor | usb_recip_device, - 0, reg | (block << 8), dmabuf, 1, - usb_ctrl_get_timeout); - if (ret == 1) { - *val = *dmabuf; + ret = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), + type->get_reg, + usb_dir_in | usb_type_vendor | type->reg_recipient, + 0, (channel << 8) | reg, dmabuf, len, + usb_ctrl_get_timeout); + if (ret == len) { + if (len == 2) + *val = le16_to_cpup((__le16 *)dmabuf); + else + *val = *dmabuf; -static int xr_set_reg_uart(struct usb_serial_port *port, u8 reg, u8 val) +static int xr_set_reg_uart(struct usb_serial_port *port, u8 reg, u16 val) - u8 block; - - block = xr21v141x_uart_reg_block + data->channel; - return xr_set_reg(port, block, reg, val); + return xr_set_reg(port, data->channel, reg, val); -static int xr_get_reg_uart(struct usb_serial_port *port, u8 reg, u8 *val) +static int xr_get_reg_uart(struct usb_serial_port *port, u8 reg, u16 *val) - u8 block; - block = xr21v141x_uart_reg_block + data->channel; - - return xr_get_reg(port, block, reg, val); + return xr_get_reg(port, data->channel, reg, val); +static int __xr_uart_enable(struct usb_serial_port *port) +{ + struct xr_data *data = usb_get_serial_port_data(port); + + return xr_set_reg_uart(port, data->type->uart_enable, + xr_uart_enable_tx | xr_uart_enable_rx); +} + +static int __xr_uart_disable(struct usb_serial_port *port) +{ + struct xr_data *data = usb_get_serial_port_data(port); + + return xr_set_reg_uart(port, data->type->uart_enable, 0); +} + -static int xr_uart_enable(struct usb_serial_port *port) +static int xr21v141x_uart_enable(struct usb_serial_port *port) - struct xr_data *data = usb_get_serial_port_data(port); - ret = xr_set_reg_uart(port, data->type->uart_enable, - xr_uart_enable_tx | xr_uart_enable_rx); + ret = __xr_uart_enable(port); - xr_set_reg_uart(port, data->type->uart_enable, 0); + __xr_uart_disable(port); -static int xr_uart_disable(struct usb_serial_port *port) +static int xr21v141x_uart_disable(struct usb_serial_port *port) - struct xr_data *data = usb_get_serial_port_data(port); - ret = xr_set_reg_uart(port, data->type->uart_enable, 0); + ret = __xr_uart_disable(port); +static int xr_uart_enable(struct usb_serial_port *port) +{ + struct xr_data *data = usb_get_serial_port_data(port); + + if (data->type->enable) + return data->type->enable(port); + + return __xr_uart_enable(port); +} + +static int xr_uart_disable(struct usb_serial_port *port) +{ + struct xr_data *data = usb_get_serial_port_data(port); + + if (data->type->disable) + return data->type->disable(port); + + return __xr_uart_disable(port); +} + - u8 status; + u16 status; - u8 gpio_set = 0; - u8 gpio_clr = 0; + u16 gpio_set = 0; + u16 gpio_clr = 0; - u8 state; + u16 state; - state = xr21v141x_uart_break_off; + state = 0; - state = xr21v141x_uart_break_on; + state = genmask(type->reg_width - 1, 0); + + dev_dbg(&port->dev, "turning break %s ", state == 0 ? "off" : "on"); - dev_dbg(&port->dev, "turning break %s ", - state == xr21v141x_uart_break_off ? "off" : "on"); -static int xr_set_baudrate(struct tty_struct *tty, - struct usb_serial_port *port) +static int xr21v141x_set_baudrate(struct tty_struct *tty, struct usb_serial_port *port) - u8 flow, gpio_mode; + u16 flow, gpio_mode; + /* + * according to the datasheets, the uart needs to be disabled while + * writing to the flow_control register (xr21v141x), or any register + * but gpio_set, gpio_clear, tx_break and error_status (xr21b142x). + */ + xr_uart_disable(port); + - gpio_mode &= ~xr_gpio_mode_mask; + gpio_mode &= ~xr_gpio_mode_sel_mask; - gpio_mode |= xr_gpio_mode_rts_cts; + gpio_mode |= xr_gpio_mode_sel_rts_cts; - /* - * as per the datasheet, uart needs to be disabled while writing to - * flow_control register. - */ - xr_uart_disable(port); - xr_uart_enable(port); - + xr_uart_enable(port); + -static void xr_set_termios(struct tty_struct *tty, - struct usb_serial_port *port, - struct ktermios *old_termios) +static void xr21v141x_set_line_settings(struct tty_struct *tty, + struct usb_serial_port *port, struct ktermios *old_termios) - xr_set_baudrate(tty, port); + xr21v141x_set_baudrate(tty, port); +} + +static void xr_cdc_set_line_coding(struct tty_struct *tty, + struct usb_serial_port *port, struct ktermios *old_termios) +{ + struct usb_host_interface *alt = port->serial->interface->cur_altsetting; + struct usb_device *udev = port->serial->dev; + struct usb_cdc_line_coding *lc; + int ret; + + lc = kzalloc(sizeof(*lc), gfp_kernel); + if (!lc) + return; + + if (tty->termios.c_ospeed) + lc->dwdterate = cpu_to_le32(tty->termios.c_ospeed); + else if (old_termios) + lc->dwdterate = cpu_to_le32(old_termios->c_ospeed); + else + lc->dwdterate = cpu_to_le32(9600); + + if (c_cstopb(tty)) + lc->bcharformat = usb_cdc_2_stop_bits; + else + lc->bcharformat = usb_cdc_1_stop_bits; + + if (c_parenb(tty)) { + if (c_cmspar(tty)) { + if (c_parodd(tty)) + lc->bparitytype = usb_cdc_mark_parity; + else + lc->bparitytype = usb_cdc_space_parity; + } else { + if (c_parodd(tty)) + lc->bparitytype = usb_cdc_odd_parity; + else + lc->bparitytype = usb_cdc_even_parity; + } + } else { + lc->bparitytype = usb_cdc_no_parity; + } + + switch (c_csize(tty)) { + case cs5: + lc->bdatabits = 5; + break; + case cs6: + lc->bdatabits = 6; + break; + case cs7: + lc->bdatabits = 7; + break; + case cs8: + default: + lc->bdatabits = 8; + break; + } + + ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), + usb_cdc_req_set_line_coding, + usb_type_class | usb_recip_interface, + 0, alt->desc.binterfacenumber, + lc, sizeof(*lc), usb_ctrl_set_timeout); + if (ret < 0) + dev_err(&port->dev, "failed to set line coding: %d ", ret); + + kfree(lc); +} + +static void xr_set_termios(struct tty_struct *tty, + struct usb_serial_port *port, struct ktermios *old_termios) +{ + struct xr_data *data = usb_get_serial_port_data(port); + + /* + * xr21v141x does not have a custom_driver flag and always enters cdc + * mode upon receiving cdc requests. + */ + if (data->type->set_line_settings) + data->type->set_line_settings(tty, port, old_termios); + else + xr_cdc_set_line_coding(tty, port, old_termios); - u8 mask, mode; + u16 mask, mode; - /* configure all pins as gpio. */ + /* + * configure all pins as gpio except for receive and transmit toggle. + */ + if (type->have_xmit_toggle) + mode |= xr_gpio_mode_rx_toggle | xr_gpio_mode_tx_toggle; + - data->channel = desc->binterfacenumber / 2; + if (type_id == xr21v141x) + data->channel = desc->binterfacenumber / 2; + else + data->channel = desc->binterfacenumber; + if (type->custom_driver) { + ret = xr_set_reg_uart(port, type->custom_driver, + xr_custom_driver_active); + if (ret) + goto err_free; + } + + { xr_device(0x04e2, 0x1420, xr21b142x) }, + { xr_device(0x04e2, 0x1422, xr21b142x) }, + { xr_device(0x04e2, 0x1424, xr21b142x) },
Universal Serial Bus
607f67183742eeb45e316e89dc7fec64d6288308
johan hovold
drivers
usb
serial
usb: serial: xr: add support for xr21v1412 and xr21v1414
add support for the two- and four-port variants of xr21v1410.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add support for xr21v1412 and xr21v1414
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['serial', 'xr']
['c']
1
51
4
--- diff --git a/drivers/usb/serial/xr_serial.c b/drivers/usb/serial/xr_serial.c --- a/drivers/usb/serial/xr_serial.c +++ b/drivers/usb/serial/xr_serial.c +struct xr_data { + u8 channel; /* zero-based index */ +}; + - return xr_set_reg(port, xr21v141x_uart_reg_block, reg, val); + struct xr_data *data = usb_get_serial_port_data(port); + u8 block; + + block = xr21v141x_uart_reg_block + data->channel; + + return xr_set_reg(port, block, reg, val); - return xr_get_reg(port, xr21v141x_uart_reg_block, reg, val); + struct xr_data *data = usb_get_serial_port_data(port); + u8 block; + + block = xr21v141x_uart_reg_block + data->channel; + + return xr_get_reg(port, block, reg, val); -static int xr_set_reg_um(struct usb_serial_port *port, u8 reg, u8 val) +static int xr_set_reg_um(struct usb_serial_port *port, u8 reg_base, u8 val) + struct xr_data *data = usb_get_serial_port_data(port); + u8 reg; + + reg = reg_base + data->channel; + +static int xr_port_probe(struct usb_serial_port *port) +{ + struct usb_interface_descriptor *desc; + struct xr_data *data; + + data = kzalloc(sizeof(*data), gfp_kernel); + if (!data) + return -enomem; + + desc = &port->serial->interface->cur_altsetting->desc; + data->channel = desc->binterfacenumber / 2; + + usb_set_serial_port_data(port, data); + + return 0; +} + +static void xr_port_remove(struct usb_serial_port *port) +{ + struct xr_data *data = usb_get_serial_port_data(port); + + kfree(data); +} + - { usb_device_interface_class(0x04e2, 0x1410, usb_class_comm) }, /* xr21v141x */ + { usb_device_interface_class(0x04e2, 0x1410, usb_class_comm) }, /* xr21v1410 */ + { usb_device_interface_class(0x04e2, 0x1412, usb_class_comm) }, /* xr21v1412 */ + { usb_device_interface_class(0x04e2, 0x1414, usb_class_comm) }, /* xr21v1414 */ + .port_probe = xr_port_probe, + .port_remove = xr_port_remove,
Universal Serial Bus
23b7998e81aa37d97897aa236bdcfba3f6edeb66
johan hovold
drivers
usb
serial
usb: serial: xr: add support for xr22801, xr22802, xr22804
the xr22801, xr22802 and xr22804 are compound devices with an embedded hub and up to seven downstream usb devices including one, two or four uarts respectively.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add support for xr22801, xr22802, xr22804
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['serial', 'xr']
['c']
1
23
0
--- diff --git a/drivers/usb/serial/xr_serial.c b/drivers/usb/serial/xr_serial.c --- a/drivers/usb/serial/xr_serial.c +++ b/drivers/usb/serial/xr_serial.c + xr2280x, + [xr2280x] = { + .reg_width = 16, + .reg_recipient = usb_recip_device, + .set_reg = 0x05, + .get_reg = 0x05, + + .uart_enable = 0x40, + .flow_control = 0x46, + .xon_char = 0x47, + .xoff_char = 0x48, + .tx_break = 0x4a, + .gpio_mode = 0x4c, + .gpio_direction = 0x4d, + .gpio_set = 0x4e, + .gpio_clear = 0x4f, + .gpio_status = 0x50, + .custom_driver = 0x81, + }, + { xr_device(0x04e2, 0x1400, xr2280x) }, + { xr_device(0x04e2, 0x1401, xr2280x) }, + { xr_device(0x04e2, 0x1402, xr2280x) }, + { xr_device(0x04e2, 0x1403, xr2280x) },
Universal Serial Bus
6da99f9de5feb25b01cbe37fdb15f26a2d7d64a9
johan hovold
drivers
usb
serial
usbip: tools: add options and examples in man page related to device mode
the commit e0546fd8b748 ("usbip: tools: start using vudc backend in usbip tools") implemented device mode for user space tools, however the corresponding options are not documented in man page.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add options and examples in man page related to device mode
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['usbip', 'tools']
['8']
2
67
1
--- diff --git a/tools/usb/usbip/doc/usbip.8 b/tools/usb/usbip/doc/usbip.8 --- a/tools/usb/usbip/doc/usbip.8 +++ b/tools/usb/usbip/doc/usbip.8 +.hp + battach r \-\-remote=< ihost r> \-\-device=< idev_id r> +.ip +attach a remote usb gadget. +only used when the remote usbipd is in device mode. +.pp + -detach an imported usb device. +detach an imported usb device/gadget. +.hp + blist r \-\-device +.ip +list usb gadgets of local usbip-vudc. +only used when the local usbipd is in device mode. +note that this can not list usbip-vudc usb gadgets of the remote device mode usbipd. +.pp + +.hp + bport r +.ip +list imported devices/gadgets. +.pp + - connect the remote usb device. + client:# usbip port + - list imported devices/gadgets. + - detach the usb device. +the following example shows the usage of device mode + + server:# usbip list --device + - list gadgets exported by local usbipd server. + + client:# modprobe vhci-hcd + + client:# usbip attach --remote=server --device=usbip-vudc.0 + - connect the remote usb gadget. + + client:# usbip port + - list imported devices/gadgets. + + client:# usbip detach --port=0 + - detach the usb gadget. + diff --git a/tools/usb/usbip/doc/usbipd.8 b/tools/usb/usbip/doc/usbipd.8 --- a/tools/usb/usbip/doc/usbipd.8 +++ b/tools/usb/usbip/doc/usbipd.8 +.hp + b\-e r, b\-\-device r +.ip +run in device mode. rather than drive an attached device, create a virtual udc to bind gadgets to. +.pp + - a usb device 1-2 is now exportable to other hosts! - use 'usbip unbind --busid=1-2' when you want to shutdown exporting and use the device locally. +the following example shows the usage of device mode + + server:# modprobe usbip-vudc + - use /sys/class/udc/ interface. + - usbip-host is independent of this module. + + server:# usbipd -e -d + - start usbip daemon in device mode. + + server:# modprobe g_mass_storage file=/tmp/tmp.img + - bind a gadget to usbip-vudc. + - in this example, a mass storage gadget is bound. + + server:# usbip list --device + - list gadgets exported by local usbipd server. + + server:# modprobe -r g_mass_storage + - unbind a gadget from usbip-vudc. + - in this example, the previous mass storage gadget is unbound. +
Universal Serial Bus
b737eecd4a8a62c7e479b2c7d2d1a1319343c72b
hongren zheng zenithal
tools
usb
doc, usbip
usb: xhci-mtk: add support ip-sleep wakeup for mt8192
add support ip-sleep wakeup for mt8192, it's a specific revision, and not following ipm rule.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add support ip-sleep wakeup for mt8192
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['xhci-mtk']
['c']
1
10
0
--- diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c --- a/drivers/usb/host/xhci-mtk.c +++ b/drivers/usb/host/xhci-mtk.c +/* mt8192 */ +#define wc0_ssusb0_cden bit(6) +#define wc0_is_spm_en bit(1) + + ssusb_uwk_v1_2, /* specific revision 1.2 */ + case ssusb_uwk_v1_2: + reg = mtk->uwk_reg_base + peri_wk_ctrl0; + msk = wc0_ssusb0_cden | wc0_is_spm_en; + val = enable ? msk : 0; + break;
Universal Serial Bus
331c505894e4da9b29ec7d7fa7c945e69823faee
chunfeng yun
drivers
usb
host
spi: add hisilicon spi controller driver for kunpeng socs
this driver supports spi controller for hisilicon kunpeng socs. this driver supports spi operations using fifo mode of transfer.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add hisilicon spi controller driver for kunpeng
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['kconfig', 'maintainers', 'c', 'makefile']
4
523
0
--- diff --git a/maintainers b/maintainers --- a/maintainers +++ b/maintainers +hisilicon spi controller driver for kunpeng socs +m: jay fang <f.fangjian@huawei.com> +l: linux-spi@vger.kernel.org +s: maintained +w: http://www.hisilicon.com +f: drivers/spi/spi-hisi-kunpeng.c + diff --git a/drivers/spi/kconfig b/drivers/spi/kconfig --- a/drivers/spi/kconfig +++ b/drivers/spi/kconfig +config spi_hisi_kunpeng + tristate "hisilicon spi controller for kunpeng socs" + depends on (arm64 && acpi) || compile_test + help + this enables support for hisilicon spi controller found on + kunpeng socs. + + this driver can also be built as a module. if so, the module + will be called hisi-kunpeng-spi. + diff --git a/drivers/spi/makefile b/drivers/spi/makefile --- a/drivers/spi/makefile +++ b/drivers/spi/makefile +obj-$(config_spi_hisi_kunpeng) += spi-hisi-kunpeng.o diff --git a/drivers/spi/spi-hisi-kunpeng.c b/drivers/spi/spi-hisi-kunpeng.c --- /dev/null +++ b/drivers/spi/spi-hisi-kunpeng.c +// spdx-license-identifier: gpl-2.0-only +// +// hisilicon spi controller driver for kunpeng socs +// +// copyright (c) 2021 hisilicon technologies co., ltd. +// author: jay fang <f.fangjian@huawei.com> +// +// this code is based on spi-dw-core.c. + +#include <linux/acpi.h> +#include <linux/bitfield.h> +#include <linux/delay.h> +#include <linux/err.h> +#include <linux/interrupt.h> +#include <linux/module.h> +#include <linux/property.h> +#include <linux/platform_device.h> +#include <linux/slab.h> +#include <linux/spi/spi.h> + +/* register offsets */ +#define hisi_spi_cscr 0x00 /* cs control register */ +#define hisi_spi_cr 0x04 /* spi common control register */ +#define hisi_spi_enr 0x08 /* spi enable register */ +#define hisi_spi_fifoc 0x0c /* fifo level control register */ +#define hisi_spi_imr 0x10 /* interrupt mask register */ +#define hisi_spi_din 0x14 /* data in register */ +#define hisi_spi_dout 0x18 /* data out register */ +#define hisi_spi_sr 0x1c /* status register */ +#define hisi_spi_risr 0x20 /* raw interrupt status register */ +#define hisi_spi_isr 0x24 /* interrupt status register */ +#define hisi_spi_icr 0x28 /* interrupt clear register */ +#define hisi_spi_version 0xe0 /* version register */ + +/* bit fields in hisi_spi_cr */ +#define cr_loop_mask genmask(1, 1) +#define cr_cpol_mask genmask(2, 2) +#define cr_cpha_mask genmask(3, 3) +#define cr_div_pre_mask genmask(11, 4) +#define cr_div_post_mask genmask(19, 12) +#define cr_bpw_mask genmask(24, 20) +#define cr_spd_mode_mask genmask(25, 25) + +/* bit fields in hisi_spi_fifoc */ +#define fifoc_tx_mask genmask(5, 3) +#define fifoc_rx_mask genmask(11, 9) + +/* bit fields in hisi_spi_imr, 4 bits */ +#define imr_rxof bit(0) /* receive overflow */ +#define imr_rxto bit(1) /* receive timeout */ +#define imr_rx bit(2) /* receive */ +#define imr_tx bit(3) /* transmit */ +#define imr_mask (imr_rxof | imr_rxto | imr_rx | imr_tx) + +/* bit fields in hisi_spi_sr, 5 bits */ +#define sr_txe bit(0) /* transmit fifo empty */ +#define sr_txnf bit(1) /* transmit fifo not full */ +#define sr_rxne bit(2) /* receive fifo not empty */ +#define sr_rxf bit(3) /* receive fifo full */ +#define sr_busy bit(4) /* busy flag */ + +/* bit fields in hisi_spi_isr, 4 bits */ +#define isr_rxof bit(0) /* receive overflow */ +#define isr_rxto bit(1) /* receive timeout */ +#define isr_rx bit(2) /* receive */ +#define isr_tx bit(3) /* transmit */ +#define isr_mask (isr_rxof | isr_rxto | isr_rx | isr_tx) + +/* bit fields in hisi_spi_icr, 2 bits */ +#define icr_rxof bit(0) /* receive overflow */ +#define icr_rxto bit(1) /* receive timeout */ +#define icr_mask (icr_rxof | icr_rxto) + +#define div_post_max 0xff +#define div_post_min 0x00 +#define div_pre_max 0xfe +#define div_pre_min 0x02 +#define clk_div_max ((1 + div_post_max) * div_pre_max) +#define clk_div_min ((1 + div_post_min) * div_pre_min) + +#define default_num_cs 1 + +#define hisi_spi_wait_timeout_ms 10ul + +enum hisi_spi_rx_level_trig { + hisi_spi_rx_1, + hisi_spi_rx_4, + hisi_spi_rx_8, + hisi_spi_rx_16, + hisi_spi_rx_32, + hisi_spi_rx_64, + hisi_spi_rx_128 +}; + +enum hisi_spi_tx_level_trig { + hisi_spi_tx_1_or_less, + hisi_spi_tx_4_or_less, + hisi_spi_tx_8_or_less, + hisi_spi_tx_16_or_less, + hisi_spi_tx_32_or_less, + hisi_spi_tx_64_or_less, + hisi_spi_tx_128_or_less +}; + +enum hisi_spi_frame_n_bytes { + hisi_spi_n_bytes_null, + hisi_spi_n_bytes_u8, + hisi_spi_n_bytes_u16, + hisi_spi_n_bytes_u32 = 4 +}; + +/* slave spi_dev related */ +struct hisi_chip_data { + u32 cr; + u32 speed_hz; /* baud rate */ + u16 clk_div; /* baud rate divider */ + + /* clk_div = (1 + div_post) * div_pre */ + u8 div_post; /* value from 0 to 255 */ + u8 div_pre; /* value from 2 to 254 (even only!) */ +}; + +struct hisi_spi { + struct device *dev; + + void __iomem *regs; + int irq; + u32 fifo_len; /* depth of the fifo buffer */ + + /* current message transfer state info */ + const void *tx; + unsigned int tx_len; + void *rx; + unsigned int rx_len; + u8 n_bytes; /* current is a 1/2/4 bytes op */ +}; + +static u32 hisi_spi_busy(struct hisi_spi *hs) +{ + return readl(hs->regs + hisi_spi_sr) & sr_busy; +} + +static u32 hisi_spi_rx_not_empty(struct hisi_spi *hs) +{ + return readl(hs->regs + hisi_spi_sr) & sr_rxne; +} + +static u32 hisi_spi_tx_not_full(struct hisi_spi *hs) +{ + return readl(hs->regs + hisi_spi_sr) & sr_txnf; +} + +static void hisi_spi_flush_fifo(struct hisi_spi *hs) +{ + unsigned long limit = loops_per_jiffy << 1; + + do { + while (hisi_spi_rx_not_empty(hs)) + readl(hs->regs + hisi_spi_dout); + } while (hisi_spi_busy(hs) && limit--); +} + +/* disable the controller and all interrupts */ +static void hisi_spi_disable(struct hisi_spi *hs) +{ + writel(0, hs->regs + hisi_spi_enr); + writel(imr_mask, hs->regs + hisi_spi_imr); + writel(icr_mask, hs->regs + hisi_spi_icr); +} + +static u8 hisi_spi_n_bytes(struct spi_transfer *transfer) +{ + if (transfer->bits_per_word <= 8) + return hisi_spi_n_bytes_u8; + else if (transfer->bits_per_word <= 16) + return hisi_spi_n_bytes_u16; + else + return hisi_spi_n_bytes_u32; +} + +static void hisi_spi_reader(struct hisi_spi *hs) +{ + u32 max = min_t(u32, hs->rx_len, hs->fifo_len); + u32 rxw; + + while (hisi_spi_rx_not_empty(hs) && max--) { + rxw = readl(hs->regs + hisi_spi_dout); + /* check the transfer's original "rx" is not null */ + if (hs->rx) { + switch (hs->n_bytes) { + case hisi_spi_n_bytes_u8: + *(u8 *)(hs->rx) = rxw; + break; + case hisi_spi_n_bytes_u16: + *(u16 *)(hs->rx) = rxw; + break; + case hisi_spi_n_bytes_u32: + *(u32 *)(hs->rx) = rxw; + break; + } + hs->rx += hs->n_bytes; + } + --hs->rx_len; + } +} + +static void hisi_spi_writer(struct hisi_spi *hs) +{ + u32 max = min_t(u32, hs->tx_len, hs->fifo_len); + u32 txw = 0; + + while (hisi_spi_tx_not_full(hs) && max--) { + /* check the transfer's original "tx" is not null */ + if (hs->tx) { + switch (hs->n_bytes) { + case hisi_spi_n_bytes_u8: + txw = *(u8 *)(hs->tx); + break; + case hisi_spi_n_bytes_u16: + txw = *(u16 *)(hs->tx); + break; + case hisi_spi_n_bytes_u32: + txw = *(u32 *)(hs->tx); + break; + } + hs->tx += hs->n_bytes; + } + writel(txw, hs->regs + hisi_spi_din); + --hs->tx_len; + } +} + +static void __hisi_calc_div_reg(struct hisi_chip_data *chip) +{ + chip->div_pre = div_pre_max; + while (chip->div_pre >= div_pre_min) { + if (chip->clk_div % chip->div_pre == 0) + break; + + chip->div_pre -= 2; + } + + if (chip->div_pre > chip->clk_div) + chip->div_pre = chip->clk_div; + + chip->div_post = (chip->clk_div / chip->div_pre) - 1; +} + +static u32 hisi_calc_effective_speed(struct spi_controller *master, + struct hisi_chip_data *chip, u32 speed_hz) +{ + u32 effective_speed; + + /* note clock divider doesn't support odd numbers */ + chip->clk_div = div_round_up(master->max_speed_hz, speed_hz) + 1; + chip->clk_div &= 0xfffe; + if (chip->clk_div > clk_div_max) + chip->clk_div = clk_div_max; + + effective_speed = master->max_speed_hz / chip->clk_div; + if (chip->speed_hz != effective_speed) { + __hisi_calc_div_reg(chip); + chip->speed_hz = effective_speed; + } + + return effective_speed; +} + +static u32 hisi_spi_prepare_cr(struct spi_device *spi) +{ + u32 cr = field_prep(cr_spd_mode_mask, 1); + + cr |= field_prep(cr_cpha_mask, (spi->mode & spi_cpha) ? 1 : 0); + cr |= field_prep(cr_cpol_mask, (spi->mode & spi_cpol) ? 1 : 0); + cr |= field_prep(cr_loop_mask, (spi->mode & spi_loop) ? 1 : 0); + + return cr; +} + +static void hisi_spi_hw_init(struct hisi_spi *hs) +{ + hisi_spi_disable(hs); + + /* fifo default config */ + writel(field_prep(fifoc_tx_mask, hisi_spi_tx_64_or_less) | + field_prep(fifoc_rx_mask, hisi_spi_rx_16), + hs->regs + hisi_spi_fifoc); + + hs->fifo_len = 256; +} + +static irqreturn_t hisi_spi_irq(int irq, void *dev_id) +{ + struct spi_controller *master = dev_id; + struct hisi_spi *hs = spi_controller_get_devdata(master); + u32 irq_status = readl(hs->regs + hisi_spi_isr) & isr_mask; + + if (!irq_status) + return irq_none; + + if (!master->cur_msg) + return irq_handled; + + /* error handling */ + if (irq_status & isr_rxof) { + dev_err(hs->dev, "interrupt_transfer: fifo overflow "); + master->cur_msg->status = -eio; + goto finalize_transfer; + } + + /* + * read data from the rx fifo every time. if there is + * nothing left to receive, finalize the transfer. + */ + hisi_spi_reader(hs); + if (!hs->rx_len) + goto finalize_transfer; + + /* send data out when tx fifo irq triggered */ + if (irq_status & isr_tx) + hisi_spi_writer(hs); + + return irq_handled; + +finalize_transfer: + hisi_spi_disable(hs); + spi_finalize_current_transfer(master); + return irq_handled; +} + +static int hisi_spi_transfer_one(struct spi_controller *master, + struct spi_device *spi, struct spi_transfer *transfer) +{ + struct hisi_spi *hs = spi_controller_get_devdata(master); + struct hisi_chip_data *chip = spi_get_ctldata(spi); + u32 cr = chip->cr; + + /* update per transfer options for speed and bpw */ + transfer->effective_speed_hz = + hisi_calc_effective_speed(master, chip, transfer->speed_hz); + cr |= field_prep(cr_div_pre_mask, chip->div_pre); + cr |= field_prep(cr_div_post_mask, chip->div_post); + cr |= field_prep(cr_bpw_mask, transfer->bits_per_word - 1); + writel(cr, hs->regs + hisi_spi_cr); + + hisi_spi_flush_fifo(hs); + + hs->n_bytes = hisi_spi_n_bytes(transfer); + hs->tx = transfer->tx_buf; + hs->tx_len = transfer->len / hs->n_bytes; + hs->rx = transfer->rx_buf; + hs->rx_len = hs->tx_len; + + /* + * ensure that the transfer data above has been updated + * before the interrupt to start. + */ + smp_mb(); + + /* enable all interrupts and the controller */ + writel(~imr_mask, hs->regs + hisi_spi_imr); + writel(1, hs->regs + hisi_spi_enr); + + return 1; +} + +static void hisi_spi_handle_err(struct spi_controller *master, + struct spi_message *msg) +{ + struct hisi_spi *hs = spi_controller_get_devdata(master); + + hisi_spi_disable(hs); + + /* + * wait for interrupt handler that is + * already in timeout to complete. + */ + msleep(hisi_spi_wait_timeout_ms); +} + +static int hisi_spi_setup(struct spi_device *spi) +{ + struct hisi_chip_data *chip; + + /* only alloc on first setup */ + chip = spi_get_ctldata(spi); + if (!chip) { + chip = kzalloc(sizeof(*chip), gfp_kernel); + if (!chip) + return -enomem; + spi_set_ctldata(spi, chip); + } + + chip->cr = hisi_spi_prepare_cr(spi); + + return 0; +} + +static void hisi_spi_cleanup(struct spi_device *spi) +{ + struct hisi_chip_data *chip = spi_get_ctldata(spi); + + kfree(chip); + spi_set_ctldata(spi, null); +} + +static int hisi_spi_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct spi_controller *master; + struct hisi_spi *hs; + int ret, irq; + + irq = platform_get_irq(pdev, 0); + if (irq < 0) + return irq; + + master = devm_spi_alloc_master(dev, sizeof(*hs)); + if (!master) + return -enomem; + + platform_set_drvdata(pdev, master); + + hs = spi_controller_get_devdata(master); + hs->dev = dev; + hs->irq = irq; + + hs->regs = devm_platform_ioremap_resource(pdev, 0); + if (is_err(hs->regs)) + return ptr_err(hs->regs); + + /* specify maximum spi clocking speed (master only) by firmware */ + ret = device_property_read_u32(dev, "spi-max-frequency", + &master->max_speed_hz); + if (ret) { + dev_err(dev, "failed to get max spi clocking speed, ret=%d ", + ret); + return -einval; + } + + ret = device_property_read_u16(dev, "num-cs", + &master->num_chipselect); + if (ret) + master->num_chipselect = default_num_cs; + + master->use_gpio_descriptors = true; + master->mode_bits = spi_cpol | spi_cpha | spi_cs_high | spi_loop; + master->bits_per_word_mask = spi_bpw_range_mask(4, 32); + master->bus_num = pdev->id; + master->setup = hisi_spi_setup; + master->cleanup = hisi_spi_cleanup; + master->transfer_one = hisi_spi_transfer_one; + master->handle_err = hisi_spi_handle_err; + master->dev.fwnode = dev->fwnode; + + hisi_spi_hw_init(hs); + + ret = devm_request_irq(dev, hs->irq, hisi_spi_irq, 0, dev_name(dev), + master); + if (ret < 0) { + dev_err(dev, "failed to get irq=%d, ret=%d ", hs->irq, ret); + return ret; + } + + ret = spi_register_controller(master); + if (ret) { + dev_err(dev, "failed to register spi master, ret=%d ", ret); + return ret; + } + + dev_info(dev, "hw version:0x%x max-freq:%u khz ", + readl(hs->regs + hisi_spi_version), + master->max_speed_hz / 1000); + + return 0; +} + +static int hisi_spi_remove(struct platform_device *pdev) +{ + struct spi_controller *master = platform_get_drvdata(pdev); + + spi_unregister_controller(master); + + return 0; +} + +static const struct acpi_device_id hisi_spi_acpi_match[] = { + {"hisi03e1", 0}, + {} +}; +module_device_table(acpi, hisi_spi_acpi_match); + +static struct platform_driver hisi_spi_driver = { + .probe = hisi_spi_probe, + .remove = hisi_spi_remove, + .driver = { + .name = "hisi-kunpeng-spi", + .acpi_match_table = hisi_spi_acpi_match, + }, +}; +module_platform_driver(hisi_spi_driver); + +module_author("jay fang <f.fangjian@huawei.com>"); +module_description("hisilicon spi controller driver for kunpeng socs"); +module_license("gpl v2");
Serial Peripheral Interface (SPI)
c770d8631e1810d8f1ce21b18ad5dd67eeb39e5c
jay fang
drivers
spi
spidev: add micron spi nor authenta device compatible
add compatible string for micron spi nor authenta device.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add micron spi nor authenta device compatible
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
[]
['c']
1
1
0
--- diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c + { .compatible = "micron,spi-authenta" },
Serial Peripheral Interface (SPI)
3a1634daf8cbf7d1e76b120fea9665325557be8c
shivamurthy shastri
drivers
spi
spi: mediatek: add mt8195 spi slave support
this patch adds mt8195 spi slave compatible support.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add mt8195 spi slave support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['mediatek']
['c']
1
8
0
--- diff --git a/drivers/spi/spi-slave-mt27xx.c b/drivers/spi/spi-slave-mt27xx.c --- a/drivers/spi/spi-slave-mt27xx.c +++ b/drivers/spi/spi-slave-mt27xx.c + +static const struct mtk_spi_compatible mt8195_compat = { + .max_fifo_size = 128, + .must_rx = true, +}; + + { .compatible = "mediatek,mt8195-spi-slave", + .data = (void *)&mt8195_compat,},
Serial Peripheral Interface (SPI)
1527b09bc80018f02fe0b6d14e97c95f93596221
leilk liu
drivers
spi
spi: mediatek: add mtk_spi_compatible support
this patch adds max_fifo_size and must_rx compat support.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add mtk_spi_compatible support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['mediatek']
['c']
1
24
4
--- diff --git a/drivers/spi/spi-slave-mt27xx.c b/drivers/spi/spi-slave-mt27xx.c --- a/drivers/spi/spi-slave-mt27xx.c +++ b/drivers/spi/spi-slave-mt27xx.c +#include <linux/of.h> + -#define mtk_spi_slave_max_fifo_size 512u - + const struct mtk_spi_compatible *dev_comp; +struct mtk_spi_compatible { + const u32 max_fifo_size; + bool must_rx; +}; +static const struct mtk_spi_compatible mt2712_compat = { + .max_fifo_size = 512, +}; - { .compatible = "mediatek,mt2712-spi-slave", }, + { .compatible = "mediatek,mt2712-spi-slave", + .data = (void *)&mt2712_compat,}, - if (xfer->len > mtk_spi_slave_max_fifo_size) + if (xfer->len > mdata->dev_comp->max_fifo_size) + const struct of_device_id *of_id; + of_id = of_match_node(mtk_spi_slave_of_match, pdev->dev.of_node); + if (!of_id) { + dev_err(&pdev->dev, "failed to probe of_node "); + ret = -einval; + goto err_put_ctlr; + } + mdata->dev_comp = of_id->data; + + if (mdata->dev_comp->must_rx) + ctlr->flags = spi_master_must_rx;
Serial Peripheral Interface (SPI)
d666a833b0b9f5b8e08ecdc002a4cf5d34932b7a
leilk liu
drivers
spi
spi: pxa2xx: add support for intel alder lake pch-m
add support for lpss spi on intel alder lake pch-m.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add support for intel alder lake pch-m
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['pxa2xx']
['c']
1
4
0
--- diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c + /* adl-m */ + { pci_vdevice(intel, 0x54aa), lpss_cnl_ssp }, + { pci_vdevice(intel, 0x54ab), lpss_cnl_ssp }, + { pci_vdevice(intel, 0x54fb), lpss_cnl_ssp },
Serial Peripheral Interface (SPI)
8c4ffe4d023d7a3153c1d3d1084d98d17bf684b9
jarkko nikula
drivers
spi
spi: spi-nxp-fspi: add imx8dxl driver support
add driver support for imx8dxl which support read through ip bus only and disable ahb bus due to an ic errata. use the pre-defined quirk fspi_quirk_use_ip_only directly in device-type data to disable ahb read.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add imx8dxl driver support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['spi-nxp-fspi']
['c']
1
9
0
--- diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c --- a/drivers/spi/spi-nxp-fspi.c +++ b/drivers/spi/spi-nxp-fspi.c +static const struct nxp_fspi_devtype_data imx8dxl_data = { + .rxfifo = sz_512, /* (64 * 64 bits) */ + .txfifo = sz_1k, /* (128 * 64 bits) */ + .ahb_buf_size = sz_2k, /* (256 * 64 bits) */ + .quirks = fspi_quirk_use_ip_only, + .little_endian = true, /* little-endian */ +}; + + { .compatible = "nxp,imx8dxl-fspi", .data = (void *)&imx8dxl_data, },
Serial Peripheral Interface (SPI)
c791e3c31cb209e6f25a5f3767707d16c1a6069a
han xu
drivers
spi
spi: spi-nxp-fspi: add imx8dxl support
add support for nxp,imx8dxl-fspi, do the bindings document.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add imx8dxl support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['spi-nxp-fspi']
['txt']
1
1
0
--- diff --git a/documentation/devicetree/bindings/spi/spi-nxp-fspi.txt b/documentation/devicetree/bindings/spi/spi-nxp-fspi.txt --- a/documentation/devicetree/bindings/spi/spi-nxp-fspi.txt +++ b/documentation/devicetree/bindings/spi/spi-nxp-fspi.txt - compatible : should be "nxp,lx2160a-fspi" + "nxp,imx8dxl-fspi" - reg : first contains the register location and length,
Serial Peripheral Interface (SPI)
32f298481add01d8c39e11a414bdc4d5037541ed
kuldeep singh
documentation
devicetree
bindings, spi
spi: spi-nxp-fspi: add support for ip read only
add support for disabling ahb bus and read entire flash contents via ip bus only. please note, this enables ip bus read using a quirk which can be enabled directly in device-type data or in existence of an errata where ahb bus may need to be disabled.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add support for ip read only
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['spi-nxp-fspi']
['c']
1
22
6
--- diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c --- a/drivers/spi/spi-nxp-fspi.c +++ b/drivers/spi/spi-nxp-fspi.c +/* access flash memory using ip bus only */ +#define fspi_quirk_use_ip_only bit(0) + +static inline int needs_ip_only(struct nxp_fspi *f) +{ + return f->devtype_data->quirks & fspi_quirk_use_ip_only; +} + - dev_dbg(f->dev, "cmd[%x] lutval[0:%x 1:%x 2:%x 3:%x] ", - op->cmd.opcode, lutval[0], lutval[1], lutval[2], lutval[3]); + dev_dbg(f->dev, "cmd[%x] lutval[0:%x 1:%x 2:%x 3:%x], size: 0x%08x ", + op->cmd.opcode, lutval[0], lutval[1], lutval[2], lutval[3], op->data.nbytes); - * if we have large chunks of data, we read them through the ahb bus - * by accessing the mapped memory. in all other cases we use - * ip commands to access the flash. + * if we have large chunks of data, we read them through the ahb bus by + * accessing the mapped memory. in all other cases we use ip commands + * to access the flash. read via ahb bus may be corrupted due to + * existence of an errata and therefore discard ahb read in such cases. - op->data.dir == spi_mem_data_in) { + op->data.dir == spi_mem_data_in && + !needs_ip_only(f)) { + /* limit data bytes to rx fifo in case of ip read only */ + if (op->data.dir == spi_mem_data_in && + needs_ip_only(f) && + op->data.nbytes > f->devtype_data->rxfifo) + op->data.nbytes = f->devtype_data->rxfifo; +
Serial Peripheral Interface (SPI)
31e92cbfb9cd9f7dcb2c04858f6cdcb3cbca914f
kuldeep singh
drivers
spi
spi: stm32-qspi: add dirmap support
add stm32_qspi_dirmap_read() and stm32_qspi_dirmap_create() to get dirmap support.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add dirmap support
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['stm32-qspi']
['c']
1
67
16
--- diff --git a/drivers/spi/spi-stm32-qspi.c b/drivers/spi/spi-stm32-qspi.c --- a/drivers/spi/spi-stm32-qspi.c +++ b/drivers/spi/spi-stm32-qspi.c - u32 ccr, cr, addr_max; + u32 ccr, cr; - addr_max = op->addr.val + op->data.nbytes + 1; - - if (op->data.dir == spi_mem_data_in) { - if (addr_max < qspi->mm_size && - op->addr.buswidth) - qspi->fmode = ccr_fmode_mm; - else - qspi->fmode = ccr_fmode_indr; - } else { - qspi->fmode = ccr_fmode_indw; - } - - else - qspi->fmode = ccr_fmode_indw; + if (op->data.dir == spi_mem_data_in && op->data.nbytes) + qspi->fmode = ccr_fmode_indr; + else + qspi->fmode = ccr_fmode_indw; + +static int stm32_qspi_dirmap_create(struct spi_mem_dirmap_desc *desc) +{ + struct stm32_qspi *qspi = spi_controller_get_devdata(desc->mem->spi->master); + + if (desc->info.op_tmpl.data.dir == spi_mem_data_out) + return -eopnotsupp; + + /* should never happen, as mm_base == null is an error probe exit condition */ + if (!qspi->mm_base && desc->info.op_tmpl.data.dir == spi_mem_data_in) + return -eopnotsupp; + + if (!qspi->mm_size) + return -eopnotsupp; + + return 0; +} + +static ssize_t stm32_qspi_dirmap_read(struct spi_mem_dirmap_desc *desc, + u64 offs, size_t len, void *buf) +{ + struct stm32_qspi *qspi = spi_controller_get_devdata(desc->mem->spi->master); + struct spi_mem_op op; + u32 addr_max; + int ret; + + ret = pm_runtime_get_sync(qspi->dev); + if (ret < 0) { + pm_runtime_put_noidle(qspi->dev); + return ret; + } + + mutex_lock(&qspi->lock); + /* make a local copy of desc op_tmpl and complete dirmap rdesc + * spi_mem_op template with offs, len and *buf in order to get + * all needed transfer information into struct spi_mem_op + */ + memcpy(&op, &desc->info.op_tmpl, sizeof(struct spi_mem_op)); + dev_dbg(qspi->dev, "%s len = 0x%x offs = 0x%llx buf = 0x%p ", __func__, len, offs, buf); + + op.data.nbytes = len; + op.addr.val = desc->info.offset + offs; + op.data.buf.in = buf; + + addr_max = op.addr.val + op.data.nbytes + 1; + if (addr_max < qspi->mm_size && op.addr.buswidth) + qspi->fmode = ccr_fmode_mm; + else + qspi->fmode = ccr_fmode_indr; + + ret = stm32_qspi_send(desc->mem, &op); + mutex_unlock(&qspi->lock); + + pm_runtime_mark_last_busy(qspi->dev); + pm_runtime_put_autosuspend(qspi->dev); + + return ret ?: len; +} + - .exec_op = stm32_qspi_exec_op, + .exec_op = stm32_qspi_exec_op, + .dirmap_create = stm32_qspi_dirmap_create, + .dirmap_read = stm32_qspi_dirmap_read,
Serial Peripheral Interface (SPI)
18674dee3cd651279eb3d9ba789fe483ddfe1137
patrice chotard
drivers
spi
watchdog: npcm: add support for wpcm450
add a compatible string for wpcm450, which has essentially the same watchdog mechanism as npcm750.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
add support for wpcm450
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['npcm']
['c']
1
1
0
--- diff --git a/drivers/watchdog/npcm_wdt.c b/drivers/watchdog/npcm_wdt.c --- a/drivers/watchdog/npcm_wdt.c +++ b/drivers/watchdog/npcm_wdt.c + {.compatible = "nuvoton,wpcm450-wdt"},
Watchdog
328d1c1a92d9eea42943af9edd5393dcd06bd591
jonathan neusch fer guenter roeck linux roeck us net joel stanley joel jms id au
drivers
watchdog
wdt: support wdt on rohm bd9576muf and bd9573muf
add watchdog support for rohm bd9576muf and bd9573muf pmics which are mainly used to power the r-car series processors. the watchdog is pinged using a gpio and enabled using another gpio. additionally watchdog time-out can be configured to hw prior starting the watchdog. watchdog timeout can be configured to detect only delayed ping or in a window mode where also too fast pings are detected.
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
support wdt on rohm bd9576muf and bd9573muf
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
['wdt']
['kconfig', 'c', 'makefile']
3
305
0
--- diff --git a/drivers/watchdog/kconfig b/drivers/watchdog/kconfig --- a/drivers/watchdog/kconfig +++ b/drivers/watchdog/kconfig +config bd957xmuf_watchdog + tristate "rohm bd9576muf and bd9573muf pmic watchdog" + depends on mfd_rohm_bd957xmuf + select watchdog_core + help + support for the watchdog in the rohm bd9576 and bd9573 pmics. + these pmic ics contain watchdog block which can be configured + to toggle reset line if soc fails to ping watchdog via gpio. + + say y here to include support for the rohm bd9576 or bd9573 + watchdog. alternatively say m to compile the driver as a module, + which will be called bd9576_wdt. + diff --git a/drivers/watchdog/makefile b/drivers/watchdog/makefile --- a/drivers/watchdog/makefile +++ b/drivers/watchdog/makefile +obj-$(config_bd957xmuf_watchdog) += bd9576_wdt.o diff --git a/drivers/watchdog/bd9576_wdt.c b/drivers/watchdog/bd9576_wdt.c --- /dev/null +++ b/drivers/watchdog/bd9576_wdt.c +// spdx-license-identifier: gpl-2.0-or-later +/* + * copyright (c) 2020 rohm semiconductors + * + * rohm bd9576muf and bd9573muf watchdog driver + */ + +#include <linux/err.h> +#include <linux/gpio/consumer.h> +#include <linux/mfd/rohm-bd957x.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/platform_device.h> +#include <linux/regmap.h> +#include <linux/watchdog.h> + +static bool nowayout; +module_param(nowayout, bool, 0); +module_parm_desc(nowayout, + "watchdog cannot be stopped once started (default="false")"); + +#define hw_margin_min 2 +#define hw_margin_max 4416 +#define bd957x_wdt_default_margin 4416 +#define watchdog_timeout 30 + +struct bd9576_wdt_priv { + struct gpio_desc *gpiod_ping; + struct gpio_desc *gpiod_en; + struct device *dev; + struct regmap *regmap; + bool always_running; + struct watchdog_device wdd; +}; + +static void bd9576_wdt_disable(struct bd9576_wdt_priv *priv) +{ + gpiod_set_value_cansleep(priv->gpiod_en, 0); +} + +static int bd9576_wdt_ping(struct watchdog_device *wdd) +{ + struct bd9576_wdt_priv *priv = watchdog_get_drvdata(wdd); + + /* pulse */ + gpiod_set_value_cansleep(priv->gpiod_ping, 1); + gpiod_set_value_cansleep(priv->gpiod_ping, 0); + + return 0; +} + +static int bd9576_wdt_start(struct watchdog_device *wdd) +{ + struct bd9576_wdt_priv *priv = watchdog_get_drvdata(wdd); + + gpiod_set_value_cansleep(priv->gpiod_en, 1); + + return bd9576_wdt_ping(wdd); +} + +static int bd9576_wdt_stop(struct watchdog_device *wdd) +{ + struct bd9576_wdt_priv *priv = watchdog_get_drvdata(wdd); + + if (!priv->always_running) + bd9576_wdt_disable(priv); + else + set_bit(wdog_hw_running, &wdd->status); + + return 0; +} + +static const struct watchdog_info bd957x_wdt_ident = { + .options = wdiof_magicclose | wdiof_keepaliveping | + wdiof_settimeout, + .identity = "bd957x watchdog", +}; + +static const struct watchdog_ops bd957x_wdt_ops = { + .owner = this_module, + .start = bd9576_wdt_start, + .stop = bd9576_wdt_stop, + .ping = bd9576_wdt_ping, +}; + +/* unit is hundreds of us */ +#define fastng_min 23 + +static int find_closest_fast(int target, int *sel, int *val) +{ + int i; + int window = fastng_min; + + for (i = 0; i < 8 && window < target; i++) + window <<= 1; + + *val = window; + *sel = i; + + if (i == 8) + return -einval; + + return 0; + +} + +static int find_closest_slow_by_fast(int fast_val, int target, int *slowsel) +{ + int sel; + static const int multipliers[] = {2, 3, 7, 15}; + + for (sel = 0; sel < array_size(multipliers) && + multipliers[sel] * fast_val < target; sel++) + ; + + if (sel == array_size(multipliers)) + return -einval; + + *slowsel = sel; + + return 0; +} + +static int find_closest_slow(int target, int *slow_sel, int *fast_sel) +{ + static const int multipliers[] = {2, 3, 7, 15}; + int i, j; + int val = 0; + int window = fastng_min; + + for (i = 0; i < 8; i++) { + for (j = 0; j < array_size(multipliers); j++) { + int slow; + + slow = window * multipliers[j]; + if (slow >= target && (!val || slow < val)) { + val = slow; + *fast_sel = i; + *slow_sel = j; + } + } + window <<= 1; + } + if (!val) + return -einval; + + return 0; +} + +#define bd957x_wdg_type_window bit(5) +#define bd957x_wdg_type_slow 0 +#define bd957x_wdg_type_mask bit(5) +#define bd957x_wdg_ng_ratio_mask 0x18 +#define bd957x_wdg_fastng_mask 0x7 + +static int bd957x_set_wdt_mode(struct bd9576_wdt_priv *priv, int hw_margin, + int hw_margin_min) +{ + int ret, fastng, slowng, type, reg, mask; + struct device *dev = priv->dev; + + /* convert to 100us */ + hw_margin *= 10; + hw_margin_min *= 10; + if (hw_margin_min) { + int min; + + type = bd957x_wdg_type_window; + dev_dbg(dev, "setting type window 0x%x ", type); + ret = find_closest_fast(hw_margin_min, &fastng, &min); + if (ret) { + dev_err(dev, "bad wdt window for fast timeout "); + return ret; + } + + ret = find_closest_slow_by_fast(min, hw_margin, &slowng); + if (ret) { + dev_err(dev, "bad wdt window "); + return ret; + } + + } else { + type = bd957x_wdg_type_slow; + dev_dbg(dev, "setting type slow 0x%x ", type); + ret = find_closest_slow(hw_margin, &slowng, &fastng); + if (ret) { + dev_err(dev, "bad wdt window "); + return ret; + } + } + + slowng <<= ffs(bd957x_wdg_ng_ratio_mask) - 1; + reg = type | slowng | fastng; + mask = bd957x_wdg_type_mask | bd957x_wdg_ng_ratio_mask | + bd957x_wdg_fastng_mask; + ret = regmap_update_bits(priv->regmap, bd957x_reg_wdt_conf, + mask, reg); + + return ret; +} + +static int bd9576_wdt_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct device_node *np = dev->parent->of_node; + struct bd9576_wdt_priv *priv; + u32 hw_margin[2]; + u32 hw_margin_max = bd957x_wdt_default_margin, hw_margin_min = 0; + int ret; + + priv = devm_kzalloc(dev, sizeof(*priv), gfp_kernel); + if (!priv) + return -enomem; + + platform_set_drvdata(pdev, priv); + + priv->dev = dev; + priv->regmap = dev_get_regmap(dev->parent, null); + if (!priv->regmap) { + dev_err(dev, "no regmap found "); + return -enodev; + } + + priv->gpiod_en = devm_gpiod_get_from_of_node(dev, dev->parent->of_node, + "rohm,watchdog-enable-gpios", + 0, gpiod_out_low, + "watchdog-enable"); + if (is_err(priv->gpiod_en)) + return dev_err_probe(dev, ptr_err(priv->gpiod_en), + "getting watchdog-enable gpio failed "); + + priv->gpiod_ping = devm_gpiod_get_from_of_node(dev, dev->parent->of_node, + "rohm,watchdog-ping-gpios", + 0, gpiod_out_low, + "watchdog-ping"); + if (is_err(priv->gpiod_ping)) + return dev_err_probe(dev, ptr_err(priv->gpiod_ping), + "getting watchdog-ping gpio failed "); + + ret = of_property_read_variable_u32_array(np, "rohm,hw-timeout-ms", + &hw_margin[0], 1, 2); + if (ret < 0 && ret != -einval) + return ret; + + if (ret == 1) + hw_margin_max = hw_margin[0]; + + if (ret == 2) { + hw_margin_max = hw_margin[1]; + hw_margin_min = hw_margin[0]; + } + + ret = bd957x_set_wdt_mode(priv, hw_margin_max, hw_margin_min); + if (ret) + return ret; + + priv->always_running = of_property_read_bool(np, "always-running"); + + watchdog_set_drvdata(&priv->wdd, priv); + + priv->wdd.info = &bd957x_wdt_ident; + priv->wdd.ops = &bd957x_wdt_ops; + priv->wdd.min_hw_heartbeat_ms = hw_margin_min; + priv->wdd.max_hw_heartbeat_ms = hw_margin_max; + priv->wdd.parent = dev; + priv->wdd.timeout = watchdog_timeout; + + watchdog_init_timeout(&priv->wdd, 0, dev); + watchdog_set_nowayout(&priv->wdd, nowayout); + + watchdog_stop_on_reboot(&priv->wdd); + + if (priv->always_running) + bd9576_wdt_start(&priv->wdd); + + return devm_watchdog_register_device(dev, &priv->wdd); +} + +static struct platform_driver bd9576_wdt_driver = { + .driver = { + .name = "bd9576-wdt", + }, + .probe = bd9576_wdt_probe, +}; + +module_platform_driver(bd9576_wdt_driver); + +module_author("matti vaittinen <matti.vaittinen@fi.rohmeurope.com>"); +module_description("rohm bd9576/bd9573 watchdog driver"); +module_license("gpl"); +module_alias("platform:bd9576-wdt");
Watchdog
b237bcac557ac30a4064863f582e06073248392a
matti vaittinen guenter roeck linux roeck us net
drivers
watchdog