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

Commit 5985837e authored by Rickard Strandqvist's avatar Rickard Strandqvist Committed by Mark Brown
Browse files

ASoC: intel: sst-haswell-ipc: Remove unused functions



Removes some functions that are not used anywhere:
sst_hsw_stream_unmute() sst_hsw_stream_mute() msg_set_stage_type()
sst_hsw_dx_get_state() sst_hsw_stream_set_write_position()
sst_hsw_stream_get_vol_reg() sst_hsw_stream_get_peak_reg()
sst_hsw_stream_get_pointer_reg() sst_hsw_stream_get_read_reg()
sst_hsw_stream_get_mixer_id() sst_hsw_stream_get_hw_id()
sst_hsw_mixer_set_volume_curve() sst_hsw_mixer_unmute()
sst_hsw_mixer_mute() sst_hsw_stream_set_volume_curve()

This was partially found by using a static code analysis program called cppcheck.

Signed-off-by: default avatarRickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 8a5b6901
Loading
Loading
Loading
Loading
+0 −168
Original line number Diff line number Diff line
@@ -338,12 +338,6 @@ static inline u32 msg_get_stage_type(u32 msg)
	return (msg & IPC_STG_TYPE_MASK) >>  IPC_STG_TYPE_SHIFT;
}

static inline u32 msg_set_stage_type(u32 msg, u32 type)
{
	return (msg & ~IPC_STG_TYPE_MASK) +
		(type << IPC_STG_TYPE_SHIFT);
}

static inline u32 msg_get_stream_id(u32 msg)
{
	return (msg & IPC_STR_ID_MASK) >>  IPC_STR_ID_SHIFT;
@@ -970,45 +964,6 @@ int sst_hsw_fw_get_version(struct sst_hsw *hsw,
}

/* Mixer Controls */
int sst_hsw_stream_mute(struct sst_hsw *hsw, struct sst_hsw_stream *stream,
	u32 stage_id, u32 channel)
{
	int ret;

	ret = sst_hsw_stream_get_volume(hsw, stream, stage_id, channel,
		&stream->mute_volume[channel]);
	if (ret < 0)
		return ret;

	ret = sst_hsw_stream_set_volume(hsw, stream, stage_id, channel, 0);
	if (ret < 0) {
		dev_err(hsw->dev, "error: can't unmute stream %d channel %d\n",
			stream->reply.stream_hw_id, channel);
		return ret;
	}

	stream->mute[channel] = 1;
	return 0;
}

int sst_hsw_stream_unmute(struct sst_hsw *hsw, struct sst_hsw_stream *stream,
	u32 stage_id, u32 channel)

{
	int ret;

	stream->mute[channel] = 0;
	ret = sst_hsw_stream_set_volume(hsw, stream, stage_id, channel,
		stream->mute_volume[channel]);
	if (ret < 0) {
		dev_err(hsw->dev, "error: can't unmute stream %d channel %d\n",
			stream->reply.stream_hw_id, channel);
		return ret;
	}

	return 0;
}

int sst_hsw_stream_get_volume(struct sst_hsw *hsw, struct sst_hsw_stream *stream,
	u32 stage_id, u32 channel, u32 *volume)
{
@@ -1022,17 +977,6 @@ int sst_hsw_stream_get_volume(struct sst_hsw *hsw, struct sst_hsw_stream *stream
	return 0;
}

int sst_hsw_stream_set_volume_curve(struct sst_hsw *hsw,
	struct sst_hsw_stream *stream, u64 curve_duration,
	enum sst_hsw_volume_curve curve)
{
	/* curve duration in steps of 100ns */
	stream->vol_req.curve_duration = curve_duration;
	stream->vol_req.curve_type = curve;

	return 0;
}

/* stream volume */
int sst_hsw_stream_set_volume(struct sst_hsw *hsw,
	struct sst_hsw_stream *stream, u32 stage_id, u32 channel, u32 volume)
@@ -1084,42 +1028,6 @@ int sst_hsw_stream_set_volume(struct sst_hsw *hsw,
	return 0;
}

int sst_hsw_mixer_mute(struct sst_hsw *hsw, u32 stage_id, u32 channel)
{
	int ret;

	ret = sst_hsw_mixer_get_volume(hsw, stage_id, channel,
		&hsw->mute_volume[channel]);
	if (ret < 0)
		return ret;

	ret = sst_hsw_mixer_set_volume(hsw, stage_id, channel, 0);
	if (ret < 0) {
		dev_err(hsw->dev, "error: failed to unmute mixer channel %d\n",
			channel);
		return ret;
	}

	hsw->mute[channel] = 1;
	return 0;
}

int sst_hsw_mixer_unmute(struct sst_hsw *hsw, u32 stage_id, u32 channel)
{
	int ret;

	ret = sst_hsw_mixer_set_volume(hsw, stage_id, channel,
		hsw->mixer_info.volume_register_address[channel]);
	if (ret < 0) {
		dev_err(hsw->dev, "error: failed to unmute mixer channel %d\n",
			channel);
		return ret;
	}

	hsw->mute[channel] = 0;
	return 0;
}

int sst_hsw_mixer_get_volume(struct sst_hsw *hsw, u32 stage_id, u32 channel,
	u32 *volume)
{
@@ -1133,16 +1041,6 @@ int sst_hsw_mixer_get_volume(struct sst_hsw *hsw, u32 stage_id, u32 channel,
	return 0;
}

int sst_hsw_mixer_set_volume_curve(struct sst_hsw *hsw,
	 u64 curve_duration, enum sst_hsw_volume_curve curve)
{
	/* curve duration in steps of 100ns */
	hsw->curve_duration = curve_duration;
	hsw->curve_type = curve;

	return 0;
}

/* global mixer volume */
int sst_hsw_mixer_set_volume(struct sst_hsw *hsw, u32 stage_id, u32 channel,
	u32 volume)
@@ -1451,48 +1349,6 @@ int sst_hsw_stream_commit(struct sst_hsw *hsw, struct sst_hsw_stream *stream)

/* Stream Information - these calls could be inline but we want the IPC
 ABI to be opaque to client PCM drivers to cope with any future ABI changes */
int sst_hsw_stream_get_hw_id(struct sst_hsw *hsw,
	struct sst_hsw_stream *stream)
{
	return stream->reply.stream_hw_id;
}

int sst_hsw_stream_get_mixer_id(struct sst_hsw *hsw,
	struct sst_hsw_stream *stream)
{
	return stream->reply.mixer_hw_id;
}

u32 sst_hsw_stream_get_read_reg(struct sst_hsw *hsw,
	struct sst_hsw_stream *stream)
{
	return stream->reply.read_position_register_address;
}

u32 sst_hsw_stream_get_pointer_reg(struct sst_hsw *hsw,
	struct sst_hsw_stream *stream)
{
	return stream->reply.presentation_position_register_address;
}

u32 sst_hsw_stream_get_peak_reg(struct sst_hsw *hsw,
	struct sst_hsw_stream *stream, u32 channel)
{
	if (channel >= 2)
		return 0;

	return stream->reply.peak_meter_register_address[channel];
}

u32 sst_hsw_stream_get_vol_reg(struct sst_hsw *hsw,
	struct sst_hsw_stream *stream, u32 channel)
{
	if (channel >= 2)
		return 0;

	return stream->reply.volume_register_address[channel];
}

int sst_hsw_mixer_get_info(struct sst_hsw *hsw)
{
	struct sst_hsw_ipc_stream_info_reply *reply;
@@ -1630,30 +1486,6 @@ u64 sst_hsw_get_dsp_presentation_position(struct sst_hsw *hsw,
	return ppos;
}

int sst_hsw_stream_set_write_position(struct sst_hsw *hsw,
	struct sst_hsw_stream *stream, u32 stage_id, u32 position)
{
	u32 header;
	int ret;

	trace_stream_write_position(stream->reply.stream_hw_id, position);

	header = IPC_GLB_TYPE(IPC_GLB_STREAM_MESSAGE) |
		IPC_STR_TYPE(IPC_STR_STAGE_MESSAGE);
	header |= (stream->reply.stream_hw_id << IPC_STR_ID_SHIFT);
	header |= (IPC_STG_SET_WRITE_POSITION << IPC_STG_TYPE_SHIFT);
	header |= (stage_id << IPC_STG_ID_SHIFT);
	stream->wpos.position = position;

	ret = ipc_tx_message_nowait(hsw, header, &stream->wpos,
		sizeof(stream->wpos));
	if (ret < 0)
		dev_err(hsw->dev, "error: stream %d set position %d failed\n",
			stream->reply.stream_hw_id, position);

	return ret;
}

/* physical BE config */
int sst_hsw_device_set_config(struct sst_hsw *hsw,
	enum sst_hsw_device_id dev, enum sst_hsw_device_mclk mclk,
+0 −31
Original line number Diff line number Diff line
@@ -376,32 +376,17 @@ int sst_hsw_fw_get_version(struct sst_hsw *hsw,
u32 create_channel_map(enum sst_hsw_channel_config config);

/* Stream Mixer Controls - */
int sst_hsw_stream_mute(struct sst_hsw *hsw, struct sst_hsw_stream *stream,
	u32 stage_id, u32 channel);
int sst_hsw_stream_unmute(struct sst_hsw *hsw, struct sst_hsw_stream *stream,
	u32 stage_id, u32 channel);

int sst_hsw_stream_set_volume(struct sst_hsw *hsw,
	struct sst_hsw_stream *stream, u32 stage_id, u32 channel, u32 volume);
int sst_hsw_stream_get_volume(struct sst_hsw *hsw,
	struct sst_hsw_stream *stream, u32 stage_id, u32 channel, u32 *volume);

int sst_hsw_stream_set_volume_curve(struct sst_hsw *hsw,
	struct sst_hsw_stream *stream, u64 curve_duration,
	enum sst_hsw_volume_curve curve);

/* Global Mixer Controls - */
int sst_hsw_mixer_mute(struct sst_hsw *hsw, u32 stage_id, u32 channel);
int sst_hsw_mixer_unmute(struct sst_hsw *hsw, u32 stage_id, u32 channel);

int sst_hsw_mixer_set_volume(struct sst_hsw *hsw, u32 stage_id, u32 channel,
	u32 volume);
int sst_hsw_mixer_get_volume(struct sst_hsw *hsw, u32 stage_id, u32 channel,
	u32 *volume);

int sst_hsw_mixer_set_volume_curve(struct sst_hsw *hsw,
	u64 curve_duration, enum sst_hsw_volume_curve curve);

/* Stream API */
struct sst_hsw_stream *sst_hsw_stream_new(struct sst_hsw *hsw, int id,
	u32 (*get_write_position)(struct sst_hsw_stream *stream, void *data),
@@ -440,18 +425,6 @@ int sst_hsw_stream_set_pmemory_info(struct sst_hsw *hsw,
	struct sst_hsw_stream *stream, u32 offset, u32 size);
int sst_hsw_stream_set_smemory_info(struct sst_hsw *hsw,
	struct sst_hsw_stream *stream, u32 offset, u32 size);
int sst_hsw_stream_get_hw_id(struct sst_hsw *hsw,
	struct sst_hsw_stream *stream);
int sst_hsw_stream_get_mixer_id(struct sst_hsw *hsw,
	struct sst_hsw_stream *stream);
u32 sst_hsw_stream_get_read_reg(struct sst_hsw *hsw,
	struct sst_hsw_stream *stream);
u32 sst_hsw_stream_get_pointer_reg(struct sst_hsw *hsw,
	struct sst_hsw_stream *stream);
u32 sst_hsw_stream_get_peak_reg(struct sst_hsw *hsw,
	struct sst_hsw_stream *stream, u32 channel);
u32 sst_hsw_stream_get_vol_reg(struct sst_hsw *hsw,
	struct sst_hsw_stream *stream, u32 channel);
int sst_hsw_mixer_get_info(struct sst_hsw *hsw);

/* Stream ALSA trigger operations */
@@ -466,8 +439,6 @@ int sst_hsw_stream_get_read_pos(struct sst_hsw *hsw,
	struct sst_hsw_stream *stream, u32 *position);
int sst_hsw_stream_get_write_pos(struct sst_hsw *hsw,
	struct sst_hsw_stream *stream, u32 *position);
int sst_hsw_stream_set_write_position(struct sst_hsw *hsw,
	struct sst_hsw_stream *stream, u32 stage_id, u32 position);
u32 sst_hsw_get_dsp_position(struct sst_hsw *hsw,
	struct sst_hsw_stream *stream);
u64 sst_hsw_get_dsp_presentation_position(struct sst_hsw *hsw,
@@ -481,8 +452,6 @@ int sst_hsw_device_set_config(struct sst_hsw *hsw,
/* DX Config */
int sst_hsw_dx_set_state(struct sst_hsw *hsw,
	enum sst_hsw_dx_state state, struct sst_hsw_ipc_dx_reply *dx);
int sst_hsw_dx_get_state(struct sst_hsw *hsw, u32 item,
	u32 *offset, u32 *size, u32 *source);

/* init */
int sst_hsw_dsp_init(struct device *dev, struct sst_pdata *pdata);