| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * PMac Tumbler/Snapper lowlevel functions |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) by Takashi Iwai <tiwai@suse.de> |
|---|
| 5 | 6 | * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 8 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | | - * (at your option) any later version. |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | | - * GNU General Public License for more details. |
|---|
| 15 | | - * |
|---|
| 16 | | - * You should have received a copy of the GNU General Public License |
|---|
| 17 | | - * along with this program; if not, write to the Free Software |
|---|
| 18 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 19 | | - * |
|---|
| 20 | 7 | * Rene Rebe <rene.rebe@gmx.net>: |
|---|
| 21 | 8 | * * update from shadow registers on wakeup and headphone plug |
|---|
| 22 | 9 | * * automatically toggle DRC on headphone plug |
|---|
| 23 | | - * |
|---|
| 24 | 10 | */ |
|---|
| 25 | 11 | |
|---|
| 26 | 12 | |
|---|
| .. | .. |
|---|
| 120 | 106 | /* |
|---|
| 121 | 107 | */ |
|---|
| 122 | 108 | |
|---|
| 123 | | -static int send_init_client(struct pmac_keywest *i2c, unsigned int *regs) |
|---|
| 109 | +static int send_init_client(struct pmac_keywest *i2c, const unsigned int *regs) |
|---|
| 124 | 110 | { |
|---|
| 125 | 111 | while (*regs > 0) { |
|---|
| 126 | 112 | int err, count = 10; |
|---|
| .. | .. |
|---|
| 142 | 128 | |
|---|
| 143 | 129 | static int tumbler_init_client(struct pmac_keywest *i2c) |
|---|
| 144 | 130 | { |
|---|
| 145 | | - static unsigned int regs[] = { |
|---|
| 131 | + static const unsigned int regs[] = { |
|---|
| 146 | 132 | /* normal operation, SCLK=64fps, i2s output, i2s input, 16bit width */ |
|---|
| 147 | 133 | TAS_REG_MCS, (1<<6)|(2<<4)|(2<<2)|0, |
|---|
| 148 | 134 | 0, /* terminator */ |
|---|
| .. | .. |
|---|
| 153 | 139 | |
|---|
| 154 | 140 | static int snapper_init_client(struct pmac_keywest *i2c) |
|---|
| 155 | 141 | { |
|---|
| 156 | | - static unsigned int regs[] = { |
|---|
| 142 | + static const unsigned int regs[] = { |
|---|
| 157 | 143 | /* normal operation, SCLK=64fps, i2s output, 16bit width */ |
|---|
| 158 | 144 | TAS_REG_MCS, (1<<6)|(2<<4)|0, |
|---|
| 159 | 145 | /* normal operation, all-pass mode */ |
|---|
| .. | .. |
|---|
| 492 | 478 | int reg; |
|---|
| 493 | 479 | int bytes; |
|---|
| 494 | 480 | unsigned int max; |
|---|
| 495 | | - unsigned int *table; |
|---|
| 481 | + const unsigned int *table; |
|---|
| 496 | 482 | }; |
|---|
| 497 | 483 | |
|---|
| 498 | 484 | static int tumbler_set_mono_volume(struct pmac_tumbler *mix, |
|---|
| 499 | | - struct tumbler_mono_vol *info) |
|---|
| 485 | + const struct tumbler_mono_vol *info) |
|---|
| 500 | 486 | { |
|---|
| 501 | 487 | unsigned char block[4]; |
|---|
| 502 | 488 | unsigned int vol; |
|---|
| .. | .. |
|---|
| 567 | 553 | } |
|---|
| 568 | 554 | |
|---|
| 569 | 555 | /* TAS3001c mono volumes */ |
|---|
| 570 | | -static struct tumbler_mono_vol tumbler_pcm_vol_info = { |
|---|
| 556 | +static const struct tumbler_mono_vol tumbler_pcm_vol_info = { |
|---|
| 571 | 557 | .index = VOL_IDX_PCM_MONO, |
|---|
| 572 | 558 | .reg = TAS_REG_PCM, |
|---|
| 573 | 559 | .bytes = 3, |
|---|
| .. | .. |
|---|
| 575 | 561 | .table = mixer_volume_table, |
|---|
| 576 | 562 | }; |
|---|
| 577 | 563 | |
|---|
| 578 | | -static struct tumbler_mono_vol tumbler_bass_vol_info = { |
|---|
| 564 | +static const struct tumbler_mono_vol tumbler_bass_vol_info = { |
|---|
| 579 | 565 | .index = VOL_IDX_BASS, |
|---|
| 580 | 566 | .reg = TAS_REG_BASS, |
|---|
| 581 | 567 | .bytes = 1, |
|---|
| .. | .. |
|---|
| 583 | 569 | .table = bass_volume_table, |
|---|
| 584 | 570 | }; |
|---|
| 585 | 571 | |
|---|
| 586 | | -static struct tumbler_mono_vol tumbler_treble_vol_info = { |
|---|
| 572 | +static const struct tumbler_mono_vol tumbler_treble_vol_info = { |
|---|
| 587 | 573 | .index = VOL_IDX_TREBLE, |
|---|
| 588 | 574 | .reg = TAS_REG_TREBLE, |
|---|
| 589 | 575 | .bytes = 1, |
|---|
| .. | .. |
|---|
| 592 | 578 | }; |
|---|
| 593 | 579 | |
|---|
| 594 | 580 | /* TAS3004 mono volumes */ |
|---|
| 595 | | -static struct tumbler_mono_vol snapper_bass_vol_info = { |
|---|
| 581 | +static const struct tumbler_mono_vol snapper_bass_vol_info = { |
|---|
| 596 | 582 | .index = VOL_IDX_BASS, |
|---|
| 597 | 583 | .reg = TAS_REG_BASS, |
|---|
| 598 | 584 | .bytes = 1, |
|---|
| .. | .. |
|---|
| 600 | 586 | .table = snapper_bass_volume_table, |
|---|
| 601 | 587 | }; |
|---|
| 602 | 588 | |
|---|
| 603 | | -static struct tumbler_mono_vol snapper_treble_vol_info = { |
|---|
| 589 | +static const struct tumbler_mono_vol snapper_treble_vol_info = { |
|---|
| 604 | 590 | .index = VOL_IDX_TREBLE, |
|---|
| 605 | 591 | .reg = TAS_REG_TREBLE, |
|---|
| 606 | 592 | .bytes = 1, |
|---|
| .. | .. |
|---|
| 840 | 826 | |
|---|
| 841 | 827 | /* |
|---|
| 842 | 828 | */ |
|---|
| 843 | | -static struct snd_kcontrol_new tumbler_mixers[] = { |
|---|
| 829 | +static const struct snd_kcontrol_new tumbler_mixers[] = { |
|---|
| 844 | 830 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
|---|
| 845 | 831 | .name = "Master Playback Volume", |
|---|
| 846 | 832 | .info = tumbler_info_master_volume, |
|---|
| .. | .. |
|---|
| 864 | 850 | }, |
|---|
| 865 | 851 | }; |
|---|
| 866 | 852 | |
|---|
| 867 | | -static struct snd_kcontrol_new snapper_mixers[] = { |
|---|
| 853 | +static const struct snd_kcontrol_new snapper_mixers[] = { |
|---|
| 868 | 854 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
|---|
| 869 | 855 | .name = "Master Playback Volume", |
|---|
| 870 | 856 | .info = tumbler_info_master_volume, |
|---|
| .. | .. |
|---|
| 1365 | 1351 | mix->anded_reset = 0; |
|---|
| 1366 | 1352 | mix->reset_on_sleep = 1; |
|---|
| 1367 | 1353 | |
|---|
| 1368 | | - for (np = chip->node->child; np; np = np->sibling) { |
|---|
| 1369 | | - if (!strcmp(np->name, "sound")) { |
|---|
| 1354 | + for_each_child_of_node(chip->node, np) { |
|---|
| 1355 | + if (of_node_name_eq(np, "sound")) { |
|---|
| 1370 | 1356 | if (of_get_property(np, "has-anded-reset", NULL)) |
|---|
| 1371 | 1357 | mix->anded_reset = 1; |
|---|
| 1372 | 1358 | if (of_get_property(np, "layout-id", NULL)) |
|---|
| 1373 | 1359 | mix->reset_on_sleep = 0; |
|---|
| 1360 | + of_node_put(np); |
|---|
| 1374 | 1361 | break; |
|---|
| 1375 | 1362 | } |
|---|
| 1376 | 1363 | } |
|---|