Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5295a0dc authored by Moise Gergaud's avatar Moise Gergaud Committed by Mark Brown
Browse files

ASoC: sti: rename unip player type into common player & reader type

parent 38535e8e
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -1219,6 +1219,15 @@
#define UNIPERIF_FIFO_SIZE		70 /* FIFO is 70 cells deep */
#define UNIPERIF_FIFO_FRAMES		4  /* FDMA trigger limit in frames */

#define UNIPERIF_TYPE_IS_HDMI(p) \
	((p)->info->type == SND_ST_UNIPERIF_TYPE_HDMI)
#define UNIPERIF_TYPE_IS_PCM(p) \
	((p)->info->type == SND_ST_UNIPERIF_TYPE_PCM)
#define UNIPERIF_TYPE_IS_SPDIF(p) \
	((p)->info->type == SND_ST_UNIPERIF_TYPE_SPDIF)
#define UNIPERIF_TYPE_IS_IEC958(p) \
	(UNIPERIF_TYPE_IS_HDMI(p) || \
		UNIPERIF_TYPE_IS_SPDIF(p))
/*
 * Uniperipheral IP revisions
 */
@@ -1237,10 +1246,10 @@ enum uniperif_version {
};

enum uniperif_type {
	SND_ST_UNIPERIF_PLAYER_TYPE_NONE,
	SND_ST_UNIPERIF_PLAYER_TYPE_HDMI,
	SND_ST_UNIPERIF_PLAYER_TYPE_PCM,
	SND_ST_UNIPERIF_PLAYER_TYPE_SPDIF
	SND_ST_UNIPERIF_TYPE_NONE,
	SND_ST_UNIPERIF_TYPE_HDMI,
	SND_ST_UNIPERIF_TYPE_PCM,
	SND_ST_UNIPERIF_TYPE_SPDIF
};

enum uniperif_state {
@@ -1259,7 +1268,7 @@ enum uniperif_iec958_encoding_mode {

struct uniperif_info {
	int id; /* instance value of the uniperipheral IP */
	enum uniperif_type player_type;
	enum uniperif_type type;
	int underflow_enabled;		/* Underflow recovery mode */
};

+11 −20
Original line number Diff line number Diff line
@@ -26,15 +26,6 @@
/*
 * Driver specific types.
 */
#define UNIPERIF_PLAYER_TYPE_IS_HDMI(p) \
	((p)->info->player_type == SND_ST_UNIPERIF_PLAYER_TYPE_HDMI)
#define UNIPERIF_PLAYER_TYPE_IS_PCM(p) \
	((p)->info->player_type == SND_ST_UNIPERIF_PLAYER_TYPE_PCM)
#define UNIPERIF_PLAYER_TYPE_IS_SPDIF(p) \
	((p)->info->player_type == SND_ST_UNIPERIF_PLAYER_TYPE_SPDIF)
#define UNIPERIF_PLAYER_TYPE_IS_IEC958(p) \
	(UNIPERIF_PLAYER_TYPE_IS_HDMI(p) || \
		UNIPERIF_PLAYER_TYPE_IS_SPDIF(p))

#define UNIPERIF_PLAYER_CLK_ADJ_MIN  -999999
#define UNIPERIF_PLAYER_CLK_ADJ_MAX  1000000
@@ -738,14 +729,14 @@ static int uni_player_prepare(struct snd_pcm_substream *substream,
	SET_UNIPERIF_CONFIG_DMA_TRIG_LIMIT(player, trigger_limit);

	/* Uniperipheral setup depends on player type */
	switch (player->info->player_type) {
	case SND_ST_UNIPERIF_PLAYER_TYPE_HDMI:
	switch (player->info->type) {
	case SND_ST_UNIPERIF_TYPE_HDMI:
		ret = uni_player_prepare_iec958(player, runtime);
		break;
	case SND_ST_UNIPERIF_PLAYER_TYPE_PCM:
	case SND_ST_UNIPERIF_TYPE_PCM:
		ret = uni_player_prepare_pcm(player, runtime);
		break;
	case SND_ST_UNIPERIF_PLAYER_TYPE_SPDIF:
	case SND_ST_UNIPERIF_TYPE_SPDIF:
		ret = uni_player_prepare_iec958(player, runtime);
		break;
	default:
@@ -852,7 +843,7 @@ static int uni_player_start(struct uniperif *player)
	 * will not take affect and hang the player.
	 */
	if (player->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0)
		if (UNIPERIF_PLAYER_TYPE_IS_IEC958(player))
		if (UNIPERIF_TYPE_IS_IEC958(player))
			SET_UNIPERIF_CTRL_SPDIF_FMT_ON(player);

	/* Force channel status update (no update if clk disable) */
@@ -1012,13 +1003,13 @@ static int uni_player_parse_dt(struct platform_device *pdev,
	}

	if (strcasecmp(mode, "hdmi") == 0)
		info->player_type = SND_ST_UNIPERIF_PLAYER_TYPE_HDMI;
		info->type = SND_ST_UNIPERIF_TYPE_HDMI;
	else if (strcasecmp(mode, "pcm") == 0)
		info->player_type = SND_ST_UNIPERIF_PLAYER_TYPE_PCM;
		info->type = SND_ST_UNIPERIF_TYPE_PCM;
	else if (strcasecmp(mode, "spdif") == 0)
		info->player_type = SND_ST_UNIPERIF_PLAYER_TYPE_SPDIF;
		info->type = SND_ST_UNIPERIF_TYPE_SPDIF;
	else
		info->player_type = SND_ST_UNIPERIF_PLAYER_TYPE_NONE;
		info->type = SND_ST_UNIPERIF_TYPE_NONE;

	/* Save the info structure */
	player->info = info;
@@ -1087,7 +1078,7 @@ int uni_player_init(struct platform_device *pdev,
	SET_UNIPERIF_CTRL_SPDIF_LAT_OFF(player);
	SET_UNIPERIF_CONFIG_IDLE_MOD_DISABLE(player);

	if (UNIPERIF_PLAYER_TYPE_IS_IEC958(player)) {
	if (UNIPERIF_TYPE_IS_IEC958(player)) {
		/* Set default iec958 status bits  */

		/* Consumer, PCM, copyright, 2ch, mode 0 */