Commit 6e9ef32f authored by Takashi Iwai's avatar Takashi Iwai

ALSA: ppc: More constifications

Apply const prefix to each possible place: the static tables for rate,
volume, etc.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-18-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent f16a4e96
...@@ -44,7 +44,7 @@ void snd_pmac_beep_stop(struct snd_pmac *chip) ...@@ -44,7 +44,7 @@ void snd_pmac_beep_stop(struct snd_pmac *chip)
* so we can multiply by an amplitude in the range 0..100 to get a * so we can multiply by an amplitude in the range 0..100 to get a
* signed short value to put in the output buffer. * signed short value to put in the output buffer.
*/ */
static short beep_wform[256] = { static const short beep_wform[256] = {
0, 40, 79, 117, 153, 187, 218, 245, 0, 40, 79, 117, 153, 187, 218, 245,
269, 288, 304, 316, 323, 327, 327, 324, 269, 288, 304, 316, 323, 327, 327, 324,
318, 310, 299, 288, 275, 262, 249, 236, 318, 310, 299, 288, 275, 262, 249, 236,
......
...@@ -24,11 +24,11 @@ ...@@ -24,11 +24,11 @@
/* fixed frequency table for awacs, screamer, burgundy, DACA (44100 max) */ /* fixed frequency table for awacs, screamer, burgundy, DACA (44100 max) */
static int awacs_freqs[8] = { static const int awacs_freqs[8] = {
44100, 29400, 22050, 17640, 14700, 11025, 8820, 7350 44100, 29400, 22050, 17640, 14700, 11025, 8820, 7350
}; };
/* fixed frequency table for tumbler */ /* fixed frequency table for tumbler */
static int tumbler_freqs[1] = { static const int tumbler_freqs[1] = {
44100 44100
}; };
...@@ -1174,7 +1174,7 @@ int snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return) ...@@ -1174,7 +1174,7 @@ int snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return)
np = chip->node; np = chip->node;
chip->requested = 0; chip->requested = 0;
if (chip->is_k2) { if (chip->is_k2) {
static char *rnames[] = { static const char * const rnames[] = {
"Sound Control", "Sound DMA" }; "Sound Control", "Sound DMA" };
for (i = 0; i < 2; i ++) { for (i = 0; i < 2; i ++) {
if (of_address_to_resource(np->parent, i, if (of_address_to_resource(np->parent, i,
...@@ -1199,7 +1199,7 @@ int snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return) ...@@ -1199,7 +1199,7 @@ int snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return)
txdma_addr = chip->rsrc[1].start; txdma_addr = chip->rsrc[1].start;
rxdma_addr = txdma_addr + 0x100; rxdma_addr = txdma_addr + 0x100;
} else { } else {
static char *rnames[] = { static const char * const rnames[] = {
"Sound Control", "Sound Tx DMA", "Sound Rx DMA" }; "Sound Control", "Sound Tx DMA", "Sound Rx DMA" };
for (i = 0; i < 3; i ++) { for (i = 0; i < 3; i ++) {
if (of_address_to_resource(np, i, if (of_address_to_resource(np, i,
......
...@@ -104,7 +104,7 @@ struct snd_pmac { ...@@ -104,7 +104,7 @@ struct snd_pmac {
struct resource rsrc[3]; struct resource rsrc[3];
int num_freqs; int num_freqs;
int *freq_table; const int *freq_table;
unsigned int freqs_ok; /* bit flags */ unsigned int freqs_ok; /* bit flags */
unsigned int formats_ok; /* pcm hwinfo */ unsigned int formats_ok; /* pcm hwinfo */
int active; int active;
......
...@@ -106,7 +106,7 @@ struct pmac_tumbler { ...@@ -106,7 +106,7 @@ struct pmac_tumbler {
/* /*
*/ */
static int send_init_client(struct pmac_keywest *i2c, unsigned int *regs) static int send_init_client(struct pmac_keywest *i2c, const unsigned int *regs)
{ {
while (*regs > 0) { while (*regs > 0) {
int err, count = 10; int err, count = 10;
...@@ -128,7 +128,7 @@ static int send_init_client(struct pmac_keywest *i2c, unsigned int *regs) ...@@ -128,7 +128,7 @@ static int send_init_client(struct pmac_keywest *i2c, unsigned int *regs)
static int tumbler_init_client(struct pmac_keywest *i2c) static int tumbler_init_client(struct pmac_keywest *i2c)
{ {
static unsigned int regs[] = { static const unsigned int regs[] = {
/* normal operation, SCLK=64fps, i2s output, i2s input, 16bit width */ /* normal operation, SCLK=64fps, i2s output, i2s input, 16bit width */
TAS_REG_MCS, (1<<6)|(2<<4)|(2<<2)|0, TAS_REG_MCS, (1<<6)|(2<<4)|(2<<2)|0,
0, /* terminator */ 0, /* terminator */
...@@ -139,7 +139,7 @@ static int tumbler_init_client(struct pmac_keywest *i2c) ...@@ -139,7 +139,7 @@ static int tumbler_init_client(struct pmac_keywest *i2c)
static int snapper_init_client(struct pmac_keywest *i2c) static int snapper_init_client(struct pmac_keywest *i2c)
{ {
static unsigned int regs[] = { static const unsigned int regs[] = {
/* normal operation, SCLK=64fps, i2s output, 16bit width */ /* normal operation, SCLK=64fps, i2s output, 16bit width */
TAS_REG_MCS, (1<<6)|(2<<4)|0, TAS_REG_MCS, (1<<6)|(2<<4)|0,
/* normal operation, all-pass mode */ /* normal operation, all-pass mode */
...@@ -478,11 +478,11 @@ struct tumbler_mono_vol { ...@@ -478,11 +478,11 @@ struct tumbler_mono_vol {
int reg; int reg;
int bytes; int bytes;
unsigned int max; unsigned int max;
unsigned int *table; const unsigned int *table;
}; };
static int tumbler_set_mono_volume(struct pmac_tumbler *mix, static int tumbler_set_mono_volume(struct pmac_tumbler *mix,
struct tumbler_mono_vol *info) const struct tumbler_mono_vol *info)
{ {
unsigned char block[4]; unsigned char block[4];
unsigned int vol; unsigned int vol;
...@@ -553,7 +553,7 @@ static int tumbler_put_mono(struct snd_kcontrol *kcontrol, ...@@ -553,7 +553,7 @@ static int tumbler_put_mono(struct snd_kcontrol *kcontrol,
} }
/* TAS3001c mono volumes */ /* TAS3001c mono volumes */
static struct tumbler_mono_vol tumbler_pcm_vol_info = { static const struct tumbler_mono_vol tumbler_pcm_vol_info = {
.index = VOL_IDX_PCM_MONO, .index = VOL_IDX_PCM_MONO,
.reg = TAS_REG_PCM, .reg = TAS_REG_PCM,
.bytes = 3, .bytes = 3,
...@@ -561,7 +561,7 @@ static struct tumbler_mono_vol tumbler_pcm_vol_info = { ...@@ -561,7 +561,7 @@ static struct tumbler_mono_vol tumbler_pcm_vol_info = {
.table = mixer_volume_table, .table = mixer_volume_table,
}; };
static struct tumbler_mono_vol tumbler_bass_vol_info = { static const struct tumbler_mono_vol tumbler_bass_vol_info = {
.index = VOL_IDX_BASS, .index = VOL_IDX_BASS,
.reg = TAS_REG_BASS, .reg = TAS_REG_BASS,
.bytes = 1, .bytes = 1,
...@@ -569,7 +569,7 @@ static struct tumbler_mono_vol tumbler_bass_vol_info = { ...@@ -569,7 +569,7 @@ static struct tumbler_mono_vol tumbler_bass_vol_info = {
.table = bass_volume_table, .table = bass_volume_table,
}; };
static struct tumbler_mono_vol tumbler_treble_vol_info = { static const struct tumbler_mono_vol tumbler_treble_vol_info = {
.index = VOL_IDX_TREBLE, .index = VOL_IDX_TREBLE,
.reg = TAS_REG_TREBLE, .reg = TAS_REG_TREBLE,
.bytes = 1, .bytes = 1,
...@@ -578,7 +578,7 @@ static struct tumbler_mono_vol tumbler_treble_vol_info = { ...@@ -578,7 +578,7 @@ static struct tumbler_mono_vol tumbler_treble_vol_info = {
}; };
/* TAS3004 mono volumes */ /* TAS3004 mono volumes */
static struct tumbler_mono_vol snapper_bass_vol_info = { static const struct tumbler_mono_vol snapper_bass_vol_info = {
.index = VOL_IDX_BASS, .index = VOL_IDX_BASS,
.reg = TAS_REG_BASS, .reg = TAS_REG_BASS,
.bytes = 1, .bytes = 1,
...@@ -586,7 +586,7 @@ static struct tumbler_mono_vol snapper_bass_vol_info = { ...@@ -586,7 +586,7 @@ static struct tumbler_mono_vol snapper_bass_vol_info = {
.table = snapper_bass_volume_table, .table = snapper_bass_volume_table,
}; };
static struct tumbler_mono_vol snapper_treble_vol_info = { static const struct tumbler_mono_vol snapper_treble_vol_info = {
.index = VOL_IDX_TREBLE, .index = VOL_IDX_TREBLE,
.reg = TAS_REG_TREBLE, .reg = TAS_REG_TREBLE,
.bytes = 1, .bytes = 1,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* volume tables, taken from TAS3001c data manual */ /* volume tables, taken from TAS3001c data manual */
/* volume gain values */ /* volume gain values */
/* 0 = -70 dB, 175 = 18.0 dB in 0.5 dB step */ /* 0 = -70 dB, 175 = 18.0 dB in 0.5 dB step */
static unsigned int master_volume_table[] = { static const unsigned int master_volume_table[] = {
0x00000015, 0x00000016, 0x00000017, 0x00000015, 0x00000016, 0x00000017,
0x00000019, 0x0000001a, 0x0000001c, 0x00000019, 0x0000001a, 0x0000001c,
0x0000001d, 0x0000001f, 0x00000021, 0x0000001d, 0x0000001f, 0x00000021,
...@@ -66,7 +66,7 @@ static unsigned int master_volume_table[] = { ...@@ -66,7 +66,7 @@ static unsigned int master_volume_table[] = {
/* treble table for TAS3001c */ /* treble table for TAS3001c */
/* 0 = -18 dB, 72 = 18 dB in 0.5 dB step */ /* 0 = -18 dB, 72 = 18 dB in 0.5 dB step */
static unsigned int treble_volume_table[] = { static const unsigned int treble_volume_table[] = {
0x96, 0x95, 0x94, 0x96, 0x95, 0x94,
0x93, 0x92, 0x91, 0x93, 0x92, 0x91,
0x90, 0x8f, 0x8e, 0x90, 0x8f, 0x8e,
...@@ -96,7 +96,7 @@ static unsigned int treble_volume_table[] = { ...@@ -96,7 +96,7 @@ static unsigned int treble_volume_table[] = {
/* bass table for TAS3001c */ /* bass table for TAS3001c */
/* 0 = -18 dB, 72 = 18 dB in 0.5 dB step */ /* 0 = -18 dB, 72 = 18 dB in 0.5 dB step */
static unsigned int bass_volume_table[] = { static const unsigned int bass_volume_table[] = {
0x86, 0x82, 0x7f, 0x86, 0x82, 0x7f,
0x7d, 0x7a, 0x78, 0x7d, 0x7a, 0x78,
0x76, 0x74, 0x72, 0x76, 0x74, 0x72,
...@@ -126,7 +126,7 @@ static unsigned int bass_volume_table[] = { ...@@ -126,7 +126,7 @@ static unsigned int bass_volume_table[] = {
/* mixer (pcm) volume table */ /* mixer (pcm) volume table */
/* 0 = -70 dB, 175 = 18.0 dB in 0.5 dB step */ /* 0 = -70 dB, 175 = 18.0 dB in 0.5 dB step */
static unsigned int mixer_volume_table[] = { static const unsigned int mixer_volume_table[] = {
0x00014b, 0x00015f, 0x000174, 0x00014b, 0x00015f, 0x000174,
0x00018a, 0x0001a1, 0x0001ba, 0x00018a, 0x0001a1, 0x0001ba,
0x0001d4, 0x0001f0, 0x00020d, 0x0001d4, 0x0001f0, 0x00020d,
...@@ -191,7 +191,7 @@ static unsigned int mixer_volume_table[] = { ...@@ -191,7 +191,7 @@ static unsigned int mixer_volume_table[] = {
/* treble table for TAS3004 */ /* treble table for TAS3004 */
/* 0 = -18 dB, 72 = 18 dB in 0.5 dB step */ /* 0 = -18 dB, 72 = 18 dB in 0.5 dB step */
static unsigned int snapper_treble_volume_table[] = { static const unsigned int snapper_treble_volume_table[] = {
0x96, 0x95, 0x94, 0x96, 0x95, 0x94,
0x93, 0x92, 0x91, 0x93, 0x92, 0x91,
0x90, 0x8f, 0x8e, 0x90, 0x8f, 0x8e,
...@@ -221,7 +221,7 @@ static unsigned int snapper_treble_volume_table[] = { ...@@ -221,7 +221,7 @@ static unsigned int snapper_treble_volume_table[] = {
/* bass table for TAS3004 */ /* bass table for TAS3004 */
/* 0 = -18 dB, 72 = 18 dB in 0.5 dB step */ /* 0 = -18 dB, 72 = 18 dB in 0.5 dB step */
static unsigned int snapper_bass_volume_table[] = { static const unsigned int snapper_bass_volume_table[] = {
0x96, 0x95, 0x94, 0x96, 0x95, 0x94,
0x93, 0x92, 0x91, 0x93, 0x92, 0x91,
0x90, 0x8f, 0x8e, 0x90, 0x8f, 0x8e,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment