mirror of
https://github.com/torvalds/linux.git
synced 2026-05-02 13:32:40 -04:00
Add basic DisplayPort audio support. Support non-live audio playback from two PCMs (DMA channels), and the volume control in the audio mixer. As older dtb files may not have the audio DMA channels defined, the driver will just mark the audio support as disabled if the audio DMA is missing, and will continue with only display support. Note: Reset doesn't seem to work (ZYNQMP_DISP_AUD_SOFT_RESET). If we do a reset, audio playback won't start again even if, afaics, we do set up all the necessary registers. So, at the moment, resetting the audio block in dp_dai_hw_free() is commented out. Tested-by: Anatoliy Klymenko <anatoliy.klymenko@amd.com> Reviewed-by: Vishal Sagar <vishal.sagar@amd.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Link: https://patchwork.freedesktop.org/patch/msgid/20241023-xilinx-dp-audio-v4-3-5128881457be@ideasonboard.com
99 lines
2.4 KiB
C
99 lines
2.4 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* ZynqMP DPSUB Subsystem Driver
|
|
*
|
|
* Copyright (C) 2017 - 2020 Xilinx, Inc.
|
|
*
|
|
* Authors:
|
|
* - Hyun Woo Kwon <hyun.kwon@xilinx.com>
|
|
* - Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
*/
|
|
|
|
#ifndef _ZYNQMP_DPSUB_H_
|
|
#define _ZYNQMP_DPSUB_H_
|
|
|
|
#include <linux/types.h>
|
|
|
|
struct clk;
|
|
struct device;
|
|
struct drm_bridge;
|
|
struct zynqmp_disp;
|
|
struct zynqmp_disp_layer;
|
|
struct zynqmp_dp;
|
|
struct zynqmp_dpsub_drm;
|
|
|
|
#define ZYNQMP_DPSUB_NUM_LAYERS 2
|
|
|
|
enum zynqmp_dpsub_port {
|
|
ZYNQMP_DPSUB_PORT_LIVE_VIDEO,
|
|
ZYNQMP_DPSUB_PORT_LIVE_GFX,
|
|
ZYNQMP_DPSUB_PORT_LIVE_AUDIO,
|
|
ZYNQMP_DPSUB_PORT_OUT_VIDEO,
|
|
ZYNQMP_DPSUB_PORT_OUT_AUDIO,
|
|
ZYNQMP_DPSUB_PORT_OUT_DP,
|
|
ZYNQMP_DPSUB_NUM_PORTS,
|
|
};
|
|
|
|
enum zynqmp_dpsub_format {
|
|
ZYNQMP_DPSUB_FORMAT_RGB,
|
|
ZYNQMP_DPSUB_FORMAT_YCRCB444,
|
|
ZYNQMP_DPSUB_FORMAT_YCRCB422,
|
|
ZYNQMP_DPSUB_FORMAT_YONLY,
|
|
};
|
|
|
|
struct zynqmp_dpsub_audio;
|
|
|
|
/**
|
|
* struct zynqmp_dpsub - ZynqMP DisplayPort Subsystem
|
|
* @dev: The physical device
|
|
* @apb_clk: The APB clock
|
|
* @vid_clk: Video clock
|
|
* @vid_clk_from_ps: True of the video clock comes from PS, false from PL
|
|
* @aud_clk: Audio clock
|
|
* @aud_clk_from_ps: True of the audio clock comes from PS, false from PL
|
|
* @connected_ports: Bitmask of connected ports in the device tree
|
|
* @dma_enabled: True if the DMA interface is enabled, false if the DPSUB is
|
|
* driven by the live input
|
|
* @drm: The DRM/KMS device data
|
|
* @bridge: The DP encoder bridge
|
|
* @disp: The display controller
|
|
* @layers: Video and graphics layers
|
|
* @dp: The DisplayPort controller
|
|
* @dma_align: DMA alignment constraint (must be a power of 2)
|
|
*/
|
|
struct zynqmp_dpsub {
|
|
struct device *dev;
|
|
|
|
struct clk *apb_clk;
|
|
struct clk *vid_clk;
|
|
bool vid_clk_from_ps;
|
|
struct clk *aud_clk;
|
|
bool aud_clk_from_ps;
|
|
|
|
unsigned int connected_ports;
|
|
bool dma_enabled;
|
|
|
|
struct zynqmp_dpsub_drm *drm;
|
|
struct drm_bridge *bridge;
|
|
|
|
struct zynqmp_disp *disp;
|
|
struct zynqmp_disp_layer *layers[ZYNQMP_DPSUB_NUM_LAYERS];
|
|
struct zynqmp_dp *dp;
|
|
|
|
unsigned int dma_align;
|
|
|
|
struct zynqmp_dpsub_audio *audio;
|
|
};
|
|
|
|
#ifdef CONFIG_DRM_ZYNQMP_DPSUB_AUDIO
|
|
int zynqmp_audio_init(struct zynqmp_dpsub *dpsub);
|
|
void zynqmp_audio_uninit(struct zynqmp_dpsub *dpsub);
|
|
#else
|
|
static inline int zynqmp_audio_init(struct zynqmp_dpsub *dpsub) { return 0; }
|
|
static inline void zynqmp_audio_uninit(struct zynqmp_dpsub *dpsub) { }
|
|
#endif
|
|
|
|
void zynqmp_dpsub_release(struct zynqmp_dpsub *dpsub);
|
|
|
|
#endif /* _ZYNQMP_DPSUB_H_ */
|