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

Commit 29aa09ac authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Takashi Iwai
Browse files

ALSA: oxfw: rename local functions for control elements so that they represent as local



This commit renames local functions with prefix 'spkr_', so that they're
for firewire-speakers.

Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent f3a0e32a
Loading
Loading
Loading
Loading
+20 −20
Original line number Original line Diff line number Diff line
@@ -14,7 +14,7 @@ enum control_attribute {
	CTL_CURRENT	= 0x10,
	CTL_CURRENT	= 0x10,
};
};


static int oxfw_mute_command(struct snd_oxfw *oxfw, bool *value,
static int spkr_mute_command(struct snd_oxfw *oxfw, bool *value,
			     enum control_action action)
			     enum control_action action)
{
{
	u8 *buf;
	u8 *buf;
@@ -70,7 +70,7 @@ static int oxfw_mute_command(struct snd_oxfw *oxfw, bool *value,
	return err;
	return err;
}
}


static int oxfw_volume_command(struct snd_oxfw *oxfw, s16 *value,
static int spkr_volume_command(struct snd_oxfw *oxfw, s16 *value,
			       unsigned int channel,
			       unsigned int channel,
			       enum control_attribute attribute,
			       enum control_attribute attribute,
			       enum control_action action)
			       enum control_action action)
@@ -131,7 +131,7 @@ static int oxfw_volume_command(struct snd_oxfw *oxfw, s16 *value,
	return err;
	return err;
}
}


static int oxfw_mute_get(struct snd_kcontrol *control,
static int spkr_mute_get(struct snd_kcontrol *control,
			 struct snd_ctl_elem_value *value)
			 struct snd_ctl_elem_value *value)
{
{
	struct snd_oxfw *oxfw = control->private_data;
	struct snd_oxfw *oxfw = control->private_data;
@@ -141,7 +141,7 @@ static int oxfw_mute_get(struct snd_kcontrol *control,
	return 0;
	return 0;
}
}


static int oxfw_mute_put(struct snd_kcontrol *control,
static int spkr_mute_put(struct snd_kcontrol *control,
			 struct snd_ctl_elem_value *value)
			 struct snd_ctl_elem_value *value)
{
{
	struct snd_oxfw *oxfw = control->private_data;
	struct snd_oxfw *oxfw = control->private_data;
@@ -153,7 +153,7 @@ static int oxfw_mute_put(struct snd_kcontrol *control,
	if (mute == oxfw->mute)
	if (mute == oxfw->mute)
		return 0;
		return 0;


	err = oxfw_mute_command(oxfw, &mute, CTL_WRITE);
	err = spkr_mute_command(oxfw, &mute, CTL_WRITE);
	if (err < 0)
	if (err < 0)
		return err;
		return err;
	oxfw->mute = mute;
	oxfw->mute = mute;
@@ -161,7 +161,7 @@ static int oxfw_mute_put(struct snd_kcontrol *control,
	return 1;
	return 1;
}
}


static int oxfw_volume_info(struct snd_kcontrol *control,
static int spkr_volume_info(struct snd_kcontrol *control,
			    struct snd_ctl_elem_info *info)
			    struct snd_ctl_elem_info *info)
{
{
	struct snd_oxfw *oxfw = control->private_data;
	struct snd_oxfw *oxfw = control->private_data;
@@ -176,7 +176,7 @@ static int oxfw_volume_info(struct snd_kcontrol *control,


static const u8 channel_map[6] = { 0, 1, 4, 5, 2, 3 };
static const u8 channel_map[6] = { 0, 1, 4, 5, 2, 3 };


static int oxfw_volume_get(struct snd_kcontrol *control,
static int spkr_volume_get(struct snd_kcontrol *control,
			   struct snd_ctl_elem_value *value)
			   struct snd_ctl_elem_value *value)
{
{
	struct snd_oxfw *oxfw = control->private_data;
	struct snd_oxfw *oxfw = control->private_data;
@@ -188,7 +188,7 @@ static int oxfw_volume_get(struct snd_kcontrol *control,
	return 0;
	return 0;
}
}


static int oxfw_volume_put(struct snd_kcontrol *control,
static int spkr_volume_put(struct snd_kcontrol *control,
			   struct snd_ctl_elem_value *value)
			   struct snd_ctl_elem_value *value)
{
{
	struct snd_oxfw *oxfw = control->private_data;
	struct snd_oxfw *oxfw = control->private_data;
@@ -218,7 +218,7 @@ static int oxfw_volume_put(struct snd_kcontrol *control,
	for (i = 0; i <= oxfw->device_info->mixer_channels; ++i) {
	for (i = 0; i <= oxfw->device_info->mixer_channels; ++i) {
		volume = value->value.integer.value[channel_map[i ? i - 1 : 0]];
		volume = value->value.integer.value[channel_map[i ? i - 1 : 0]];
		if (changed_channels & (1 << i)) {
		if (changed_channels & (1 << i)) {
			err = oxfw_volume_command(oxfw, &volume, i,
			err = spkr_volume_command(oxfw, &volume, i,
						   CTL_CURRENT, CTL_WRITE);
						   CTL_CURRENT, CTL_WRITE);
			if (err < 0)
			if (err < 0)
				return err;
				return err;
@@ -230,43 +230,43 @@ static int oxfw_volume_put(struct snd_kcontrol *control,
	return changed_channels != 0;
	return changed_channels != 0;
}
}


int snd_oxfw_create_mixer(struct snd_oxfw *oxfw)
int snd_oxfw_add_spkr(struct snd_oxfw *oxfw)
{
{
	static const struct snd_kcontrol_new controls[] = {
	static const struct snd_kcontrol_new controls[] = {
		{
		{
			.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
			.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
			.name = "PCM Playback Switch",
			.name = "PCM Playback Switch",
			.info = snd_ctl_boolean_mono_info,
			.info = snd_ctl_boolean_mono_info,
			.get = oxfw_mute_get,
			.get = spkr_mute_get,
			.put = oxfw_mute_put,
			.put = spkr_mute_put,
		},
		},
		{
		{
			.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
			.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
			.name = "PCM Playback Volume",
			.name = "PCM Playback Volume",
			.info = oxfw_volume_info,
			.info = spkr_volume_info,
			.get = oxfw_volume_get,
			.get = spkr_volume_get,
			.put = oxfw_volume_put,
			.put = spkr_volume_put,
		},
		},
	};
	};
	unsigned int i, first_ch;
	unsigned int i, first_ch;
	int err;
	int err;


	err = oxfw_volume_command(oxfw, &oxfw->volume_min,
	err = spkr_volume_command(oxfw, &oxfw->volume_min,
				   0, CTL_MIN, CTL_READ);
				   0, CTL_MIN, CTL_READ);
	if (err < 0)
	if (err < 0)
		return err;
		return err;
	err = oxfw_volume_command(oxfw, &oxfw->volume_max,
	err = spkr_volume_command(oxfw, &oxfw->volume_max,
				   0, CTL_MAX, CTL_READ);
				   0, CTL_MAX, CTL_READ);
	if (err < 0)
	if (err < 0)
		return err;
		return err;


	err = oxfw_mute_command(oxfw, &oxfw->mute, CTL_READ);
	err = spkr_mute_command(oxfw, &oxfw->mute, CTL_READ);
	if (err < 0)
	if (err < 0)
		return err;
		return err;


	first_ch = oxfw->device_info->mixer_channels == 1 ? 0 : 1;
	first_ch = oxfw->device_info->mixer_channels == 1 ? 0 : 1;
	for (i = 0; i < oxfw->device_info->mixer_channels; ++i) {
	for (i = 0; i < oxfw->device_info->mixer_channels; ++i) {
		err = oxfw_volume_command(oxfw, &oxfw->volume[i],
		err = spkr_volume_command(oxfw, &oxfw->volume[i],
					  first_ch + i, CTL_CURRENT, CTL_READ);
					  first_ch + i, CTL_CURRENT, CTL_READ);
		if (err < 0)
		if (err < 0)
			return err;
			return err;
+1 −1
Original line number Original line Diff line number Diff line
@@ -205,7 +205,7 @@ static int oxfw_probe(struct fw_unit *unit,
		goto error;
		goto error;


	if (oxfw->device_info) {
	if (oxfw->device_info) {
		err = snd_oxfw_create_mixer(oxfw);
		err = snd_oxfw_add_spkr(oxfw);
		if (err < 0)
		if (err < 0)
			goto error;
			goto error;
	}
	}
+2 −2
Original line number Original line Diff line number Diff line
@@ -138,10 +138,10 @@ void snd_oxfw_stream_lock_release(struct snd_oxfw *oxfw);


int snd_oxfw_create_pcm(struct snd_oxfw *oxfw);
int snd_oxfw_create_pcm(struct snd_oxfw *oxfw);


int snd_oxfw_create_mixer(struct snd_oxfw *oxfw);

void snd_oxfw_proc_init(struct snd_oxfw *oxfw);
void snd_oxfw_proc_init(struct snd_oxfw *oxfw);


int snd_oxfw_create_midi(struct snd_oxfw *oxfw);
int snd_oxfw_create_midi(struct snd_oxfw *oxfw);


int snd_oxfw_create_hwdep(struct snd_oxfw *oxfw);
int snd_oxfw_create_hwdep(struct snd_oxfw *oxfw);

int snd_oxfw_add_spkr(struct snd_oxfw *oxfw);