mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 18:09:56 +00:00
Compare commits
8 Commits
raspberryp
...
raspberryp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0eeafb5d9 | ||
|
|
8a0c16cb89 | ||
|
|
0fe13a5838 | ||
|
|
d10760af02 | ||
|
|
deca5e6cfa | ||
|
|
c4aa56bb29 | ||
|
|
1c64f4bc22 | ||
|
|
9d49ae69a1 |
@@ -193,8 +193,7 @@
|
||||
<0x0 0x40000000 0x0 0xff800000 0x0 0x00800000>,
|
||||
<0x6 0x00000000 0x6 0x00000000 0x0 0x40000000>,
|
||||
<0x0 0x00000000 0x0 0x00000000 0x0 0xfc000000>;
|
||||
dma-ranges = <0x0 0x00000000 0x0 0x00000000 0x0 0xfc000000>,
|
||||
<0x1 0x00000000 0x1 0x00000000 0x1 0x00000000>;
|
||||
dma-ranges = <0x0 0x00000000 0x0 0x00000000 0x4 0x00000000>;
|
||||
|
||||
dma40: dma@7e007b00 {
|
||||
compatible = "brcm,bcm2711-dma";
|
||||
|
||||
@@ -1319,6 +1319,7 @@ CONFIG_APDS9960=m
|
||||
CONFIG_TSL4531=m
|
||||
CONFIG_VEML6070=m
|
||||
CONFIG_BMP280=m
|
||||
CONFIG_MAXIM_THERMOCOUPLE=m
|
||||
CONFIG_PWM_BCM2835=m
|
||||
CONFIG_PWM_PCA9685=m
|
||||
CONFIG_RPI_AXIPERF=m
|
||||
|
||||
@@ -1357,6 +1357,7 @@ CONFIG_APDS9960=m
|
||||
CONFIG_TSL4531=m
|
||||
CONFIG_VEML6070=m
|
||||
CONFIG_BMP280=m
|
||||
CONFIG_MAXIM_THERMOCOUPLE=m
|
||||
CONFIG_PWM_BCM2835=m
|
||||
CONFIG_PWM_PCA9685=m
|
||||
CONFIG_GENERIC_PHY=y
|
||||
|
||||
@@ -1325,6 +1325,7 @@ CONFIG_APDS9960=m
|
||||
CONFIG_TSL4531=m
|
||||
CONFIG_VEML6070=m
|
||||
CONFIG_BMP280=m
|
||||
CONFIG_MAXIM_THERMOCOUPLE=m
|
||||
CONFIG_PWM_BCM2835=m
|
||||
CONFIG_PWM_PCA9685=m
|
||||
CONFIG_RPI_AXIPERF=m
|
||||
|
||||
@@ -1349,6 +1349,7 @@ CONFIG_APDS9960=m
|
||||
CONFIG_TSL4531=m
|
||||
CONFIG_VEML6070=m
|
||||
CONFIG_BMP280=m
|
||||
CONFIG_MAXIM_THERMOCOUPLE=m
|
||||
CONFIG_PWM_BCM2835=m
|
||||
CONFIG_PWM_PCA9685=m
|
||||
CONFIG_GENERIC_PHY=y
|
||||
|
||||
@@ -1194,6 +1194,7 @@ CONFIG_BME680=m
|
||||
CONFIG_DHT11=m
|
||||
CONFIG_HTU21=m
|
||||
CONFIG_APDS9960=m
|
||||
CONFIG_MAXIM_THERMOCOUPLE=m
|
||||
CONFIG_PWM_BCM2835=m
|
||||
CONFIG_PWM_PCA9685=m
|
||||
CONFIG_EXT4_FS=y
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#define BCM2711_DMA_MEMCPY_CHAN 14
|
||||
|
||||
struct bcm2835_dma_cfg_data {
|
||||
u64 dma_mask;
|
||||
u32 chan_40bit_mask;
|
||||
};
|
||||
|
||||
@@ -302,10 +303,12 @@ DEFINE_SPINLOCK(memcpy_lock);
|
||||
|
||||
static const struct bcm2835_dma_cfg_data bcm2835_dma_cfg = {
|
||||
.chan_40bit_mask = 0,
|
||||
.dma_mask = DMA_BIT_MASK(32),
|
||||
};
|
||||
|
||||
static const struct bcm2835_dma_cfg_data bcm2711_dma_cfg = {
|
||||
.chan_40bit_mask = BIT(11) | BIT(12) | BIT(13) | BIT(14),
|
||||
.dma_mask = DMA_BIT_MASK(36),
|
||||
};
|
||||
|
||||
static inline size_t bcm2835_dma_max_frame_length(struct bcm2835_chan *c)
|
||||
@@ -1185,6 +1188,8 @@ static struct dma_chan *bcm2835_dma_xlate(struct of_phandle_args *spec,
|
||||
|
||||
static int bcm2835_dma_probe(struct platform_device *pdev)
|
||||
{
|
||||
const struct bcm2835_dma_cfg_data *cfg_data;
|
||||
const struct of_device_id *of_id;
|
||||
struct bcm2835_dmadev *od;
|
||||
struct resource *res;
|
||||
void __iomem *base;
|
||||
@@ -1194,13 +1199,20 @@ static int bcm2835_dma_probe(struct platform_device *pdev)
|
||||
int irq_flags;
|
||||
uint32_t chans_available;
|
||||
char chan_name[BCM2835_DMA_CHAN_NAME_SIZE];
|
||||
const struct of_device_id *of_id;
|
||||
int chan_count, chan_start, chan_end;
|
||||
|
||||
of_id = of_match_node(bcm2835_dma_of_match, pdev->dev.of_node);
|
||||
if (!of_id) {
|
||||
dev_err(&pdev->dev, "Failed to match compatible string\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
cfg_data = of_id->data;
|
||||
|
||||
if (!pdev->dev.dma_mask)
|
||||
pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
|
||||
|
||||
rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
|
||||
rc = dma_set_mask_and_coherent(&pdev->dev, cfg_data->dma_mask);
|
||||
if (rc) {
|
||||
dev_err(&pdev->dev, "Unable to set DMA mask\n");
|
||||
return rc;
|
||||
@@ -1266,7 +1278,7 @@ static int bcm2835_dma_probe(struct platform_device *pdev)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
od->cfg_data = of_id->data;
|
||||
od->cfg_data = cfg_data;
|
||||
|
||||
/* Request DMA channel mask from device tree */
|
||||
if (of_property_read_u32(pdev->dev.of_node,
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#include <sound/pcm_drm_eld.h>
|
||||
#include <sound/pcm_params.h>
|
||||
#include <sound/soc.h>
|
||||
#include <sound/tlv.h>
|
||||
#include "media/cec.h"
|
||||
#include "vc4_drv.h"
|
||||
#include "vc4_hdmi.h"
|
||||
@@ -82,6 +83,311 @@
|
||||
#define CEC_CLOCK_FREQ 40000
|
||||
#define VC4_HSM_CLOCK 163682864
|
||||
|
||||
#define HDMI_CODEC_CHMAP_IDX_UNKNOWN -1
|
||||
|
||||
/*
|
||||
* CEA speaker placement for HDMI 1.4:
|
||||
*
|
||||
* FL FLC FC FRC FR FRW
|
||||
*
|
||||
* LFE
|
||||
*
|
||||
* RL RLC RC RRC RR
|
||||
*
|
||||
* Speaker placement has to be extended to support HDMI 2.0
|
||||
*/
|
||||
enum hdmi_codec_cea_spk_placement {
|
||||
FL = BIT(0), /* Front Left */
|
||||
FC = BIT(1), /* Front Center */
|
||||
FR = BIT(2), /* Front Right */
|
||||
FLC = BIT(3), /* Front Left Center */
|
||||
FRC = BIT(4), /* Front Right Center */
|
||||
RL = BIT(5), /* Rear Left */
|
||||
RC = BIT(6), /* Rear Center */
|
||||
RR = BIT(7), /* Rear Right */
|
||||
RLC = BIT(8), /* Rear Left Center */
|
||||
RRC = BIT(9), /* Rear Right Center */
|
||||
LFE = BIT(10), /* Low Frequency Effect */
|
||||
};
|
||||
|
||||
/*
|
||||
* cea Speaker allocation structure
|
||||
*/
|
||||
struct hdmi_codec_cea_spk_alloc {
|
||||
const int ca_id;
|
||||
unsigned int n_ch;
|
||||
unsigned long mask;
|
||||
};
|
||||
|
||||
/* Channel maps stereo HDMI */
|
||||
static const struct snd_pcm_chmap_elem hdmi_codec_stereo_chmaps[] = {
|
||||
{ .channels = 2,
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
|
||||
{ }
|
||||
};
|
||||
|
||||
/* Channel maps for multi-channel playbacks, up to 8 n_ch */
|
||||
static const struct snd_pcm_chmap_elem hdmi_codec_8ch_chmaps[] = {
|
||||
{ .channels = 2, /* CA_ID 0x00 */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
|
||||
{ .channels = 4, /* CA_ID 0x01 */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
|
||||
SNDRV_CHMAP_NA } },
|
||||
{ .channels = 4, /* CA_ID 0x02 */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_FC } },
|
||||
{ .channels = 4, /* CA_ID 0x03 */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
|
||||
SNDRV_CHMAP_FC } },
|
||||
{ .channels = 6, /* CA_ID 0x04 */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_NA, SNDRV_CHMAP_RC, SNDRV_CHMAP_NA } },
|
||||
{ .channels = 6, /* CA_ID 0x05 */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
|
||||
SNDRV_CHMAP_NA, SNDRV_CHMAP_RC, SNDRV_CHMAP_NA } },
|
||||
{ .channels = 6, /* CA_ID 0x06 */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_FC, SNDRV_CHMAP_RC, SNDRV_CHMAP_NA } },
|
||||
{ .channels = 6, /* CA_ID 0x07 */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
|
||||
SNDRV_CHMAP_FC, SNDRV_CHMAP_RC, SNDRV_CHMAP_NA } },
|
||||
{ .channels = 6, /* CA_ID 0x08 */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_NA, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } },
|
||||
{ .channels = 6, /* CA_ID 0x09 */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
|
||||
SNDRV_CHMAP_NA, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } },
|
||||
{ .channels = 6, /* CA_ID 0x0A */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_FC, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } },
|
||||
{ .channels = 6, /* CA_ID 0x0B */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
|
||||
SNDRV_CHMAP_FC, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } },
|
||||
{ .channels = 8, /* CA_ID 0x0C */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_NA, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR,
|
||||
SNDRV_CHMAP_RC, SNDRV_CHMAP_NA } },
|
||||
{ .channels = 8, /* CA_ID 0x0D */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
|
||||
SNDRV_CHMAP_NA, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR,
|
||||
SNDRV_CHMAP_RC, SNDRV_CHMAP_NA } },
|
||||
{ .channels = 8, /* CA_ID 0x0E */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_FC, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR,
|
||||
SNDRV_CHMAP_RC, SNDRV_CHMAP_NA } },
|
||||
{ .channels = 8, /* CA_ID 0x0F */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
|
||||
SNDRV_CHMAP_FC, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR,
|
||||
SNDRV_CHMAP_RC, SNDRV_CHMAP_NA } },
|
||||
{ .channels = 8, /* CA_ID 0x10 */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_NA, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR,
|
||||
SNDRV_CHMAP_RLC, SNDRV_CHMAP_RRC } },
|
||||
{ .channels = 8, /* CA_ID 0x11 */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
|
||||
SNDRV_CHMAP_NA, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR,
|
||||
SNDRV_CHMAP_RLC, SNDRV_CHMAP_RRC } },
|
||||
{ .channels = 8, /* CA_ID 0x12 */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_FC, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR,
|
||||
SNDRV_CHMAP_RLC, SNDRV_CHMAP_RRC } },
|
||||
{ .channels = 8, /* CA_ID 0x13 */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
|
||||
SNDRV_CHMAP_FC, SNDRV_CHMAP_RL, SNDRV_CHMAP_RR,
|
||||
SNDRV_CHMAP_RLC, SNDRV_CHMAP_RRC } },
|
||||
{ .channels = 8, /* CA_ID 0x14 */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } },
|
||||
{ .channels = 8, /* CA_ID 0x15 */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
|
||||
SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } },
|
||||
{ .channels = 8, /* CA_ID 0x16 */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_FC, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } },
|
||||
{ .channels = 8, /* CA_ID 0x17 */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
|
||||
SNDRV_CHMAP_FC, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } },
|
||||
{ .channels = 8, /* CA_ID 0x18 */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } },
|
||||
{ .channels = 8, /* CA_ID 0x19 */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
|
||||
SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } },
|
||||
{ .channels = 8, /* CA_ID 0x1A */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_FC, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } },
|
||||
{ .channels = 8, /* CA_ID 0x1B */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
|
||||
SNDRV_CHMAP_FC, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } },
|
||||
{ .channels = 8, /* CA_ID 0x1C */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } },
|
||||
{ .channels = 8, /* CA_ID 0x1D */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
|
||||
SNDRV_CHMAP_NA, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } },
|
||||
{ .channels = 8, /* CA_ID 0x1E */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_FC, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } },
|
||||
{ .channels = 8, /* CA_ID 0x1F */
|
||||
.map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_LFE,
|
||||
SNDRV_CHMAP_FC, SNDRV_CHMAP_NA, SNDRV_CHMAP_NA,
|
||||
SNDRV_CHMAP_FLC, SNDRV_CHMAP_FRC } },
|
||||
{ }
|
||||
};
|
||||
|
||||
/*
|
||||
* hdmi_codec_channel_alloc: speaker configuration available for CEA
|
||||
*
|
||||
* This is an ordered list that must match with hdmi_codec_8ch_chmaps struct
|
||||
* The preceding ones have better chances to be selected by
|
||||
* hdmi_codec_get_ch_alloc_table_idx().
|
||||
*/
|
||||
static const struct hdmi_codec_cea_spk_alloc hdmi_codec_channel_alloc[] = {
|
||||
{ .ca_id = 0x00, .n_ch = 2,
|
||||
.mask = FL | FR},
|
||||
/* 2.1 */
|
||||
{ .ca_id = 0x01, .n_ch = 4,
|
||||
.mask = FL | FR | LFE},
|
||||
/* Dolby Surround */
|
||||
{ .ca_id = 0x02, .n_ch = 4,
|
||||
.mask = FL | FR | FC },
|
||||
/* surround51 */
|
||||
{ .ca_id = 0x0b, .n_ch = 6,
|
||||
.mask = FL | FR | LFE | FC | RL | RR},
|
||||
/* surround40 */
|
||||
{ .ca_id = 0x08, .n_ch = 6,
|
||||
.mask = FL | FR | RL | RR },
|
||||
/* surround41 */
|
||||
{ .ca_id = 0x09, .n_ch = 6,
|
||||
.mask = FL | FR | LFE | RL | RR },
|
||||
/* surround50 */
|
||||
{ .ca_id = 0x0a, .n_ch = 6,
|
||||
.mask = FL | FR | FC | RL | RR },
|
||||
/* 6.1 */
|
||||
{ .ca_id = 0x0f, .n_ch = 8,
|
||||
.mask = FL | FR | LFE | FC | RL | RR | RC },
|
||||
/* surround71 */
|
||||
{ .ca_id = 0x13, .n_ch = 8,
|
||||
.mask = FL | FR | LFE | FC | RL | RR | RLC | RRC },
|
||||
/* others */
|
||||
{ .ca_id = 0x03, .n_ch = 8,
|
||||
.mask = FL | FR | LFE | FC },
|
||||
{ .ca_id = 0x04, .n_ch = 8,
|
||||
.mask = FL | FR | RC},
|
||||
{ .ca_id = 0x05, .n_ch = 8,
|
||||
.mask = FL | FR | LFE | RC },
|
||||
{ .ca_id = 0x06, .n_ch = 8,
|
||||
.mask = FL | FR | FC | RC },
|
||||
{ .ca_id = 0x07, .n_ch = 8,
|
||||
.mask = FL | FR | LFE | FC | RC },
|
||||
{ .ca_id = 0x0c, .n_ch = 8,
|
||||
.mask = FL | FR | RC | RL | RR },
|
||||
{ .ca_id = 0x0d, .n_ch = 8,
|
||||
.mask = FL | FR | LFE | RL | RR | RC },
|
||||
{ .ca_id = 0x0e, .n_ch = 8,
|
||||
.mask = FL | FR | FC | RL | RR | RC },
|
||||
{ .ca_id = 0x10, .n_ch = 8,
|
||||
.mask = FL | FR | RL | RR | RLC | RRC },
|
||||
{ .ca_id = 0x11, .n_ch = 8,
|
||||
.mask = FL | FR | LFE | RL | RR | RLC | RRC },
|
||||
{ .ca_id = 0x12, .n_ch = 8,
|
||||
.mask = FL | FR | FC | RL | RR | RLC | RRC },
|
||||
{ .ca_id = 0x14, .n_ch = 8,
|
||||
.mask = FL | FR | FLC | FRC },
|
||||
{ .ca_id = 0x15, .n_ch = 8,
|
||||
.mask = FL | FR | LFE | FLC | FRC },
|
||||
{ .ca_id = 0x16, .n_ch = 8,
|
||||
.mask = FL | FR | FC | FLC | FRC },
|
||||
{ .ca_id = 0x17, .n_ch = 8,
|
||||
.mask = FL | FR | LFE | FC | FLC | FRC },
|
||||
{ .ca_id = 0x18, .n_ch = 8,
|
||||
.mask = FL | FR | RC | FLC | FRC },
|
||||
{ .ca_id = 0x19, .n_ch = 8,
|
||||
.mask = FL | FR | LFE | RC | FLC | FRC },
|
||||
{ .ca_id = 0x1a, .n_ch = 8,
|
||||
.mask = FL | FR | RC | FC | FLC | FRC },
|
||||
{ .ca_id = 0x1b, .n_ch = 8,
|
||||
.mask = FL | FR | LFE | RC | FC | FLC | FRC },
|
||||
{ .ca_id = 0x1c, .n_ch = 8,
|
||||
.mask = FL | FR | RL | RR | FLC | FRC },
|
||||
{ .ca_id = 0x1d, .n_ch = 8,
|
||||
.mask = FL | FR | LFE | RL | RR | FLC | FRC },
|
||||
{ .ca_id = 0x1e, .n_ch = 8,
|
||||
.mask = FL | FR | FC | RL | RR | FLC | FRC },
|
||||
{ .ca_id = 0x1f, .n_ch = 8,
|
||||
.mask = FL | FR | LFE | FC | RL | RR | FLC | FRC },
|
||||
};
|
||||
|
||||
static unsigned long hdmi_codec_spk_mask_from_alloc(int spk_alloc)
|
||||
{
|
||||
int i;
|
||||
static const unsigned long hdmi_codec_eld_spk_alloc_bits[] = {
|
||||
[0] = FL | FR, [1] = LFE, [2] = FC, [3] = RL | RR,
|
||||
[4] = RC, [5] = FLC | FRC, [6] = RLC | RRC,
|
||||
};
|
||||
unsigned long spk_mask = 0;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(hdmi_codec_eld_spk_alloc_bits); i++) {
|
||||
if (spk_alloc & (1 << i))
|
||||
spk_mask |= hdmi_codec_eld_spk_alloc_bits[i];
|
||||
}
|
||||
|
||||
return spk_mask;
|
||||
}
|
||||
|
||||
static int hdmi_codec_get_ch_alloc_table_idx(struct vc4_hdmi *vc4_hdmi,
|
||||
unsigned char channels)
|
||||
{
|
||||
struct drm_connector *connector = &vc4_hdmi->connector;
|
||||
int i;
|
||||
u8 spk_alloc;
|
||||
unsigned long spk_mask;
|
||||
const struct hdmi_codec_cea_spk_alloc *cap = hdmi_codec_channel_alloc;
|
||||
|
||||
spk_alloc = drm_eld_get_spk_alloc(connector->eld);
|
||||
spk_mask = hdmi_codec_spk_mask_from_alloc(spk_alloc);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(hdmi_codec_channel_alloc); i++, cap++) {
|
||||
/* If spk_alloc == 0, HDMI is unplugged return stereo config*/
|
||||
if (!spk_alloc && cap->ca_id == 0)
|
||||
return i;
|
||||
if (cap->n_ch != channels)
|
||||
continue;
|
||||
if (!(cap->mask == (spk_mask & cap->mask)))
|
||||
continue;
|
||||
return i;
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static void hdmi_codec_eld_chmap(struct vc4_hdmi *vc4_hdmi)
|
||||
{
|
||||
struct drm_connector *connector = &vc4_hdmi->connector;
|
||||
u8 spk_alloc;
|
||||
unsigned long spk_mask;
|
||||
|
||||
spk_alloc = drm_eld_get_spk_alloc(connector->eld);
|
||||
spk_mask = hdmi_codec_spk_mask_from_alloc(spk_alloc);
|
||||
|
||||
/* Detect if only stereo supported, else return 8 channels mappings */
|
||||
if ((spk_mask & ~(FL | FR)))
|
||||
vc4_hdmi->audio.chmap = hdmi_codec_8ch_chmaps;
|
||||
else
|
||||
vc4_hdmi->audio.chmap = hdmi_codec_stereo_chmaps;
|
||||
}
|
||||
|
||||
static int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused)
|
||||
{
|
||||
struct drm_info_node *node = (struct drm_info_node *)m->private;
|
||||
@@ -350,6 +656,9 @@ static void vc4_hdmi_set_audio_infoframe(struct drm_encoder *encoder)
|
||||
frame.audio.sample_size = HDMI_AUDIO_SAMPLE_SIZE_STREAM;
|
||||
frame.audio.channels = vc4_hdmi->audio.channels;
|
||||
|
||||
/* Select a channel allocation that matches with ELD and pcm channels */
|
||||
frame.audio.channel_allocation = vc4_hdmi->audio.chmap_idx;
|
||||
|
||||
vc4_hdmi_write_infoframe(encoder, &frame);
|
||||
}
|
||||
|
||||
@@ -881,6 +1190,10 @@ static int vc4_hdmi_audio_startup(struct snd_pcm_substream *substream,
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* Select chmap supported */
|
||||
vc4_hdmi->audio.max_channels = 8;
|
||||
hdmi_codec_eld_chmap(vc4_hdmi);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -967,6 +1280,7 @@ static int vc4_hdmi_audio_prepare(struct snd_pcm_substream *substream,
|
||||
u32 channel_map;
|
||||
u32 mai_audio_format;
|
||||
u32 mai_sample_rate;
|
||||
int idx;
|
||||
|
||||
if (substream != vc4_hdmi->audio.substream)
|
||||
return -EINVAL;
|
||||
@@ -1027,6 +1341,14 @@ static int vc4_hdmi_audio_prepare(struct snd_pcm_substream *substream,
|
||||
HDMI_WRITE(HDMI_AUDIO_PACKET_CONFIG, audio_packet_config);
|
||||
vc4_hdmi_set_n_cts(vc4_hdmi);
|
||||
|
||||
idx = hdmi_codec_get_ch_alloc_table_idx(vc4_hdmi, vc4_hdmi->audio.channels);
|
||||
if (idx < 0) {
|
||||
DRM_ERROR("Not able to map channels to speakers (%d)\n", idx);
|
||||
vc4_hdmi->audio.chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN;
|
||||
} else {
|
||||
vc4_hdmi->audio.chmap_idx = hdmi_codec_channel_alloc[idx].ca_id;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1145,6 +1467,89 @@ static int vc4_spdif_mask_get(struct snd_kcontrol *kcontrol,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* ALSA API channel-map control callbacks
|
||||
*/
|
||||
static int vc4_chmap_ctl_info(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_info *uinfo)
|
||||
{
|
||||
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
|
||||
struct vc4_hdmi *vc4_hdmi = snd_component_to_hdmi(component);
|
||||
|
||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
|
||||
uinfo->count = vc4_hdmi->audio.max_channels;
|
||||
uinfo->value.integer.min = 0;
|
||||
uinfo->value.integer.max = SNDRV_CHMAP_LAST;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vc4_chmap_ctl_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
|
||||
struct vc4_hdmi *vc4_hdmi = snd_component_to_hdmi(component);
|
||||
unsigned const char *map;
|
||||
unsigned int i;
|
||||
|
||||
if (!vc4_hdmi->audio.chmap)
|
||||
return -EINVAL;
|
||||
|
||||
map = vc4_hdmi->audio.chmap[vc4_hdmi->audio.chmap_idx].map;
|
||||
|
||||
for (i = 0; i < vc4_hdmi->audio.max_channels; i++) {
|
||||
if (vc4_hdmi->audio.chmap_idx == HDMI_CODEC_CHMAP_IDX_UNKNOWN)
|
||||
ucontrol->value.integer.value[i] = 0;
|
||||
else
|
||||
ucontrol->value.integer.value[i] = map[i];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vc4_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag,
|
||||
unsigned int size, unsigned int __user *tlv)
|
||||
{
|
||||
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
|
||||
struct vc4_hdmi *vc4_hdmi = snd_component_to_hdmi(component);
|
||||
const struct snd_pcm_chmap_elem *map;
|
||||
unsigned int __user *dst;
|
||||
int c, count = 0;
|
||||
|
||||
if (!vc4_hdmi->audio.chmap)
|
||||
return -EINVAL;
|
||||
if (size < 8)
|
||||
return -ENOMEM;
|
||||
if (put_user(SNDRV_CTL_TLVT_CONTAINER, tlv))
|
||||
return -EFAULT;
|
||||
size -= 8;
|
||||
dst = tlv + 2;
|
||||
for (map = vc4_hdmi->audio.chmap; map->channels; map++) {
|
||||
int chs_bytes = map->channels * 4;
|
||||
//if (!valid_chmap_channels(info, map->channels))
|
||||
// continue;
|
||||
if (size < 8)
|
||||
return -ENOMEM;
|
||||
if (put_user(SNDRV_CTL_TLVT_CHMAP_FIXED, dst) ||
|
||||
put_user(chs_bytes, dst + 1))
|
||||
return -EFAULT;
|
||||
dst += 2;
|
||||
size -= 8;
|
||||
count += 8;
|
||||
if (size < chs_bytes)
|
||||
return -ENOMEM;
|
||||
size -= chs_bytes;
|
||||
count += chs_bytes;
|
||||
for (c = 0; c < map->channels; c++) {
|
||||
if (put_user(map->map[c], dst))
|
||||
return -EFAULT;
|
||||
dst++;
|
||||
}
|
||||
}
|
||||
if (put_user(count, tlv + 1))
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct snd_kcontrol_new vc4_hdmi_audio_controls[] = {
|
||||
{
|
||||
.access = SNDRV_CTL_ELEM_ACCESS_READ |
|
||||
@@ -1167,6 +1572,16 @@ static const struct snd_kcontrol_new vc4_hdmi_audio_controls[] = {
|
||||
.info = vc4_spdif_info,
|
||||
.get = vc4_spdif_mask_get,
|
||||
},
|
||||
{
|
||||
.access = SNDRV_CTL_ELEM_ACCESS_READ |
|
||||
SNDRV_CTL_ELEM_ACCESS_TLV_READ |
|
||||
SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK,
|
||||
.iface = SNDRV_CTL_ELEM_IFACE_PCM,
|
||||
.name = "Playback Channel Map",
|
||||
.info = vc4_chmap_ctl_info,
|
||||
.get = vc4_chmap_ctl_get,
|
||||
.tlv.c = vc4_chmap_ctl_tlv,
|
||||
},
|
||||
};
|
||||
|
||||
static const struct snd_soc_dapm_widget vc4_hdmi_audio_widgets[] = {
|
||||
|
||||
@@ -117,6 +117,9 @@ struct vc4_hdmi_audio {
|
||||
bool streaming;
|
||||
|
||||
unsigned char iec_status[4];
|
||||
const struct snd_pcm_chmap_elem *chmap;
|
||||
unsigned int chmap_idx;
|
||||
unsigned int max_channels;
|
||||
};
|
||||
|
||||
/* General HDMI hardware state. */
|
||||
|
||||
@@ -94,7 +94,6 @@ static void actpwr_trig_cycle(struct timer_list *t)
|
||||
{
|
||||
struct actpwr_trig_data *trig = &actpwr_data;
|
||||
struct actpwr_vled *active;
|
||||
enum led_brightness value;
|
||||
|
||||
active = &trig->virt_leds[trig->next_active];
|
||||
trig->active = active;
|
||||
|
||||
@@ -643,9 +643,9 @@ err:
|
||||
|
||||
static void ath9k_hif_usb_rx_cb(struct urb *urb)
|
||||
{
|
||||
struct rx_buf *rx_buf = (struct rx_buf *)urb->context;
|
||||
struct hif_device_usb *hif_dev = rx_buf->hif_dev;
|
||||
struct sk_buff *skb = rx_buf->skb;
|
||||
struct sk_buff *skb = (struct sk_buff *) urb->context;
|
||||
struct hif_device_usb *hif_dev =
|
||||
usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
|
||||
int ret;
|
||||
|
||||
if (!skb)
|
||||
@@ -685,15 +685,14 @@ resubmit:
|
||||
return;
|
||||
free:
|
||||
kfree_skb(skb);
|
||||
kfree(rx_buf);
|
||||
}
|
||||
|
||||
static void ath9k_hif_usb_reg_in_cb(struct urb *urb)
|
||||
{
|
||||
struct rx_buf *rx_buf = (struct rx_buf *)urb->context;
|
||||
struct hif_device_usb *hif_dev = rx_buf->hif_dev;
|
||||
struct sk_buff *skb = rx_buf->skb;
|
||||
struct sk_buff *skb = (struct sk_buff *) urb->context;
|
||||
struct sk_buff *nskb;
|
||||
struct hif_device_usb *hif_dev =
|
||||
usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
|
||||
int ret;
|
||||
|
||||
if (!skb)
|
||||
@@ -751,7 +750,6 @@ resubmit:
|
||||
return;
|
||||
free:
|
||||
kfree_skb(skb);
|
||||
kfree(rx_buf);
|
||||
urb->context = NULL;
|
||||
}
|
||||
|
||||
@@ -797,7 +795,7 @@ static int ath9k_hif_usb_alloc_tx_urbs(struct hif_device_usb *hif_dev)
|
||||
init_usb_anchor(&hif_dev->mgmt_submitted);
|
||||
|
||||
for (i = 0; i < MAX_TX_URB_NUM; i++) {
|
||||
tx_buf = kzalloc(sizeof(*tx_buf), GFP_KERNEL);
|
||||
tx_buf = kzalloc(sizeof(struct tx_buf), GFP_KERNEL);
|
||||
if (!tx_buf)
|
||||
goto err;
|
||||
|
||||
@@ -834,9 +832,8 @@ static void ath9k_hif_usb_dealloc_rx_urbs(struct hif_device_usb *hif_dev)
|
||||
|
||||
static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev)
|
||||
{
|
||||
struct rx_buf *rx_buf = NULL;
|
||||
struct sk_buff *skb = NULL;
|
||||
struct urb *urb = NULL;
|
||||
struct sk_buff *skb = NULL;
|
||||
int i, ret;
|
||||
|
||||
init_usb_anchor(&hif_dev->rx_submitted);
|
||||
@@ -844,12 +841,6 @@ static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev)
|
||||
|
||||
for (i = 0; i < MAX_RX_URB_NUM; i++) {
|
||||
|
||||
rx_buf = kzalloc(sizeof(*rx_buf), GFP_KERNEL);
|
||||
if (!rx_buf) {
|
||||
ret = -ENOMEM;
|
||||
goto err_rxb;
|
||||
}
|
||||
|
||||
/* Allocate URB */
|
||||
urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (urb == NULL) {
|
||||
@@ -864,14 +855,11 @@ static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev)
|
||||
goto err_skb;
|
||||
}
|
||||
|
||||
rx_buf->hif_dev = hif_dev;
|
||||
rx_buf->skb = skb;
|
||||
|
||||
usb_fill_bulk_urb(urb, hif_dev->udev,
|
||||
usb_rcvbulkpipe(hif_dev->udev,
|
||||
USB_WLAN_RX_PIPE),
|
||||
skb->data, MAX_RX_BUF_SIZE,
|
||||
ath9k_hif_usb_rx_cb, rx_buf);
|
||||
ath9k_hif_usb_rx_cb, skb);
|
||||
|
||||
/* Anchor URB */
|
||||
usb_anchor_urb(urb, &hif_dev->rx_submitted);
|
||||
@@ -897,8 +885,6 @@ err_submit:
|
||||
err_skb:
|
||||
usb_free_urb(urb);
|
||||
err_urb:
|
||||
kfree(rx_buf);
|
||||
err_rxb:
|
||||
ath9k_hif_usb_dealloc_rx_urbs(hif_dev);
|
||||
return ret;
|
||||
}
|
||||
@@ -910,21 +896,14 @@ static void ath9k_hif_usb_dealloc_reg_in_urbs(struct hif_device_usb *hif_dev)
|
||||
|
||||
static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev)
|
||||
{
|
||||
struct rx_buf *rx_buf = NULL;
|
||||
struct sk_buff *skb = NULL;
|
||||
struct urb *urb = NULL;
|
||||
struct sk_buff *skb = NULL;
|
||||
int i, ret;
|
||||
|
||||
init_usb_anchor(&hif_dev->reg_in_submitted);
|
||||
|
||||
for (i = 0; i < MAX_REG_IN_URB_NUM; i++) {
|
||||
|
||||
rx_buf = kzalloc(sizeof(*rx_buf), GFP_KERNEL);
|
||||
if (!rx_buf) {
|
||||
ret = -ENOMEM;
|
||||
goto err_rxb;
|
||||
}
|
||||
|
||||
/* Allocate URB */
|
||||
urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (urb == NULL) {
|
||||
@@ -939,14 +918,11 @@ static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev)
|
||||
goto err_skb;
|
||||
}
|
||||
|
||||
rx_buf->hif_dev = hif_dev;
|
||||
rx_buf->skb = skb;
|
||||
|
||||
usb_fill_int_urb(urb, hif_dev->udev,
|
||||
usb_rcvintpipe(hif_dev->udev,
|
||||
USB_REG_IN_PIPE),
|
||||
skb->data, MAX_REG_IN_BUF_SIZE,
|
||||
ath9k_hif_usb_reg_in_cb, rx_buf, 1);
|
||||
ath9k_hif_usb_reg_in_cb, skb, 1);
|
||||
|
||||
/* Anchor URB */
|
||||
usb_anchor_urb(urb, &hif_dev->reg_in_submitted);
|
||||
@@ -972,8 +948,6 @@ err_submit:
|
||||
err_skb:
|
||||
usb_free_urb(urb);
|
||||
err_urb:
|
||||
kfree(rx_buf);
|
||||
err_rxb:
|
||||
ath9k_hif_usb_dealloc_reg_in_urbs(hif_dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -86,11 +86,6 @@ struct tx_buf {
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
struct rx_buf {
|
||||
struct sk_buff *skb;
|
||||
struct hif_device_usb *hif_dev;
|
||||
};
|
||||
|
||||
#define HIF_USB_TX_STOP BIT(0)
|
||||
#define HIF_USB_TX_FLUSH BIT(1)
|
||||
|
||||
|
||||
@@ -3205,8 +3205,18 @@ vchiq_register_child(struct platform_device *pdev, const char *name)
|
||||
|
||||
child->dev.of_node = np;
|
||||
|
||||
/*
|
||||
* We want the dma-ranges etc to be copied from the parent VCHIQ device
|
||||
* to be passed on to the children without a node of their own.
|
||||
*/
|
||||
if (!np)
|
||||
np = pdev->dev.of_node;
|
||||
|
||||
of_dma_configure(&child->dev, np, true);
|
||||
|
||||
if (np != pdev->dev.of_node)
|
||||
of_node_put(np);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
|
||||
@@ -1791,7 +1791,6 @@ cifs_rename2(struct inode *source_dir, struct dentry *source_dentry,
|
||||
FILE_UNIX_BASIC_INFO *info_buf_target;
|
||||
unsigned int xid;
|
||||
int rc, tmprc;
|
||||
bool new_target = d_really_is_negative(target_dentry);
|
||||
|
||||
if (flags & ~RENAME_NOREPLACE)
|
||||
return -EINVAL;
|
||||
@@ -1868,13 +1867,8 @@ cifs_rename2(struct inode *source_dir, struct dentry *source_dentry,
|
||||
*/
|
||||
|
||||
unlink_target:
|
||||
/*
|
||||
* If the target dentry was created during the rename, try
|
||||
* unlinking it if it's not negative
|
||||
*/
|
||||
if (new_target &&
|
||||
d_really_is_positive(target_dentry) &&
|
||||
(rc == -EACCES || rc == -EEXIST)) {
|
||||
/* Try unlinking the target dentry if it's not negative */
|
||||
if (d_really_is_positive(target_dentry) && (rc == -EACCES || rc == -EEXIST)) {
|
||||
if (d_is_dir(target_dentry))
|
||||
tmprc = cifs_rmdir(target_dir, target_dentry);
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user