[haiku-commits] haiku: hrev43316 - src/add-ons/kernel/drivers/audio/ice1712

  • From: korli@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 24 Nov 2011 20:54:54 +0100 (CET)

hrev43316 adds 1 changeset to branch 'master'
old head: dea8f9c7666e897a50d904ab02ea3f37107f734b
new head: 6fabf01910f42c9fd2aaf4e739b5c2abe5ddbd48

----------------------------------------------------------------------------

4 files changed, 115 insertions(+), 110 deletions(-)
src/add-ons/kernel/drivers/audio/ice1712/ice1712.c |   52 ++++----
src/add-ons/kernel/drivers/audio/ice1712/ice1712.h |   63 +++++-----
src/add-ons/kernel/drivers/audio/ice1712/midi.c    |    4 +-
src/add-ons/kernel/drivers/audio/ice1712/multi.c   |  106 ++++++++--------

############################################################################

Revision:    hrev43316
Commit:      6fabf01910f42c9fd2aaf4e739b5c2abe5ddbd48
URL:         http://cgit.haiku-os.org/haiku/commit/?id=6fabf01
Author:      Jérôme Leveque <jerome.leveque@xxxxxxxxx>
Date:        Mon Nov 21 21:24:52 2011 UTC
Committer: Jérôme Duval <jerome.duval@xxxxxxxxx>
Commit-Date: Thu Nov 24 19:54:41 2011 UTC

ice1712: Style cleanup and improvements

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/drivers/audio/ice1712/ice1712.c 
b/src/add-ons/kernel/drivers/audio/ice1712/ice1712.c
index b39e4ba..378c9ca 100644
--- a/src/add-ons/kernel/drivers/audio/ice1712/ice1712.c
+++ b/src/add-ons/kernel/drivers/audio/ice1712/ice1712.c
@@ -207,9 +207,9 @@ ice1712_setup(ice1712 *ice)
        // B : Stereo ADC number minus 1 (=> 1 to 4)
        // A : Stereo DAC number minus 1 (=> 1 to 4)
 
-       ice->nb_DAC = ((reg8 & 0x03) + 1) * 2;
+       ice->config.nb_DAC = ((reg8 & 0x03) + 1) * 2;
        reg8 >>= 2;
-       ice->nb_ADC = ((reg8 & 0x03) + 1) * 2;
+       ice->config.nb_ADC = ((reg8 & 0x03) + 1) * 2;
        reg8 >>= 2;
 
        if ((reg8 & 0x01) != 0) {//Consumer AC'97 Exist
@@ -223,16 +223,16 @@ ice1712_setup(ice1712 *ice)
                TRACE("Consumer AC'97 does NOT exist\n");
        }
        reg8 >>= 1;
-       ice->nb_MPU401 = (reg8 & 0x1) + 1;
+       ice->config.nb_MPU401 = (reg8 & 0x1) + 1;
 
-       for (i = 0; i < ice->nb_MPU401; i++) {
+       for (i = 0; i < ice->config.nb_MPU401; i++) {
                sprintf(ice->midi_interf[i].name, "midi/ice1712/%ld/%d",
                        ice - cards + 1, i + 1);
                names[num_names++] = ice->midi_interf[i].name;
        }
 
        TRACE("E2PROM_MAP_SPDIF : 0x%x\n", ice->eeprom_data[E2PROM_MAP_SPDIF]);
-       ice->spdif_config       = ice->eeprom_data[E2PROM_MAP_SPDIF];
+       ice->config.spdif = ice->eeprom_data[E2PROM_MAP_SPDIF];
 
        switch (ice->product) {
                case ICE1712_SUBDEVICE_DELTA66 :
@@ -312,12 +312,12 @@ ice1712_setup(ice1712 *ice)
        ice->frames_count = 0;
        ice->buffer_size = MAX_BUFFER_FRAMES;
 
-       ice->total_output_channels = ice->nb_DAC;
-       if (ice->spdif_config & NO_IN_YES_OUT)
+       ice->total_output_channels = ice->config.nb_DAC;
+       if (ice->config.spdif & SPDIF_OUT_PRESENT)
                ice->total_output_channels += 2;
 
-       ice->total_input_channels = ice->nb_ADC + 2;
-       if (ice->spdif_config & YES_IN_NO_OUT)
+       ice->total_input_channels = ice->config.nb_ADC + 2;
+       if (ice->config.spdif & SPDIF_IN_PRESENT)
                ice->total_input_channels += 2;
 
        //Write bits in the GPIO
@@ -343,7 +343,7 @@ ice1712_setup(ice1712 *ice)
 
        //Mute all input
        mute = (ICE1712_MUTE_VALUE << 0) | (ICE1712_MUTE_VALUE << 8);
-       for (i = 0; i < 2 * MAX_HARDWARE_VOLUME; i++) {
+       for (i = 0; i < 2 * ICE1712_HARDWARE_VOLUME; i++) {
                write_mt_uint8(ice, MT_VOLUME_CONTROL_CHANNEL_INDEX, i);
                write_mt_uint16(ice, MT_VOLUME_CONTROL_CHANNEL_INDEX, mute);
        }
@@ -707,14 +707,14 @@ applySettings(ice1712 *card)
        uint16 val, mt30 = 0;
        uint32 mt34 = 0;
 
-       for (i = 0; i < MAX_HARDWARE_VOLUME; i++) {
+       for (i = 0; i < ICE1712_HARDWARE_VOLUME; i++) {
                //Select the channel
                write_mt_uint8(card, MT_VOLUME_CONTROL_CHANNEL_INDEX, i);
 
-               if (card->settings.Playback[i].Mute == true) {
+               if (card->settings.playback[i].mute == true) {
                        val = (ICE1712_MUTE_VALUE << 0) | (ICE1712_MUTE_VALUE 
<< 8);
                } else {
-                       unsigned char volume = 
card->settings.Playback[i].Volume / -1.5;
+                       unsigned char volume = 
card->settings.playback[i].volume / -1.5;
                        if (i & 1) {//a right channel
                                val = ICE1712_MUTE_VALUE << 0; //Mute left 
volume
                                val |= volume << 8;
@@ -728,15 +728,15 @@ applySettings(ice1712 *card)
                TRACE_VV("Apply Settings %d : 0x%x\n", i, val);
        }
 
-       for (i = 0; i < MAX_HARDWARE_VOLUME; i++) {
+       for (i = 0; i < ICE1712_HARDWARE_VOLUME; i++) {
                //Select the channel
                write_mt_uint8(card, MT_VOLUME_CONTROL_CHANNEL_INDEX,
-                       i + MAX_HARDWARE_VOLUME);
+                       i + ICE1712_HARDWARE_VOLUME);
 
-               if (card->settings.Record[i].Mute == true) {
+               if (card->settings.record[i].mute == true) {
                        val = (ICE1712_MUTE_VALUE << 0) | (ICE1712_MUTE_VALUE 
<< 8);
                } else {
-                       unsigned char volume = card->settings.Record[i].Volume 
/ -1.5;
+                       uint8 volume = card->settings.record[i].volume / -1.5;
                        if (i & 1) {//a right channel
                                val = ICE1712_MUTE_VALUE << 0; //Mute left 
volume
                                val |= volume << 8;
@@ -752,11 +752,11 @@ applySettings(ice1712 *card)
 
        //Analog output selection
        for (i = 0; i < 4; i++) {
-               uint8 out = card->settings.Output[i];
+               uint8 out = card->settings.output[i];
                if (out == 0) {
                        TRACE_VV("Output %d is haiku output\n", i);
                        //Nothing to do
-               } else if (out <= (card->nb_ADC / 2)) {
+               } else if (out <= (card->config.nb_ADC / 2)) {
                        uint8 mt34_c;
                        out--;
                        TRACE_VV("Output %d is input %d\n", i, out);
@@ -764,8 +764,8 @@ applySettings(ice1712 *card)
                        mt34_c |= (out * 2 + 1) << 4;
                        mt30 |= 0x0202 << (2*i);
                        mt30 |= mt34_c << (8*i);
-               } else if (out == ((card->nb_ADC / 2) + 1)
-                               && (card->spdif_config & YES_IN_NO_OUT) != 0) {
+               } else if (out == ((card->config.nb_ADC / 2) + 1)
+                               && (card->config.spdif & SPDIF_IN_PRESENT) != 
0) {
                        TRACE_VV("Output %d is digital input\n", i);
                        mt30 |= 0x0303 << (2*i);
                        mt34 |= 0x80 << (8*i);
@@ -778,20 +778,20 @@ applySettings(ice1712 *card)
        write_mt_uint32(card, MT_CAPTURED_DATA, mt34);
        
        //Digital output
-       if ((card->spdif_config & NO_IN_YES_OUT) != 0) {
+       if ((card->config.spdif & SPDIF_OUT_PRESENT) != 0) {
                uint16 mt32 = 0;
-               uint8 out = card->settings.Output[4];
+               uint8 out = card->settings.output[4];
                if (out == 0) {
                        TRACE_VV("Digital output is haiku output\n");
                        //Nothing to do
-               } else if (out <= (card->nb_ADC / 2)) {
+               } else if (out <= (card->config.nb_ADC / 2)) {
                        out--;
                        TRACE_VV("Digital output is input %d\n", out);
                        mt32 |= 0x0202;
                        mt32 |= (out * 2) << 8;
                        mt32 |= (out * 2 + 1) << 12;
-               } else if (out == ((card->nb_ADC / 2) + 1)
-                               && (card->spdif_config & YES_IN_NO_OUT) != 0) {
+               } else if (out == ((card->config.nb_ADC / 2) + 1)
+                               && (card->config.spdif & SPDIF_IN_PRESENT) != 
0) {
                        TRACE_VV("Digital output is digital input\n");
                        mt32 |= 0x800F;
                } else {
diff --git a/src/add-ons/kernel/drivers/audio/ice1712/ice1712.h 
b/src/add-ons/kernel/drivers/audio/ice1712/ice1712.h
index a3745e0..5a2c49e 100644
--- a/src/add-ons/kernel/drivers/audio/ice1712/ice1712.h
+++ b/src/add-ons/kernel/drivers/audio/ice1712/ice1712.h
@@ -40,7 +40,7 @@ typedef enum product_t {
 #define MIN_BUFFER_FRAMES                      64
 #define MAX_BUFFER_FRAMES                      2048
 
-#define MAX_HARDWARE_VOLUME                    10
+#define ICE1712_HARDWARE_VOLUME                10
 #define ICE1712_MUTE_VALUE                     0x7F
 
 #define PLAYBACK_BUFFER_SIZE           (MAX_BUFFER_FRAMES * MAX_DAC * 
SAMPLE_SIZE)
@@ -54,12 +54,13 @@ typedef enum product_t {
 #define MIXER_OUT_LEFT                         10
 #define MIXER_OUT_RIGHT                                11
 
-typedef enum {
-       NO_IN_NO_OUT = 0,
-       NO_IN_YES_OUT = 1,
-       YES_IN_NO_OUT = 2,
-       YES_IN_YES_OUT = 3,
-} _spdif_config_ ;
+#define SPDIF_OUT_PRESENT                      1
+#define SPDIF_IN_PRESENT                       2
+
+#define ICE1712_SAMPLERATE_96K         0x7
+#define ICE1712_SAMPLERATE_48K         0x0
+#define ICE1712_SAMPLERATE_88K2                0xB
+#define ICE1712_SAMPLERATE_44K1                0x8
 
 typedef struct _midi_dev {
        struct _ice1712_        *card;
@@ -78,32 +79,40 @@ typedef struct _codecCommLines
        uint8   reserved[4];
 } codecCommLines;
 
-typedef struct ChannelVolume
+typedef struct channel_volume
 {
-       float Volume;
-       bool Mute;
-} ChannelVolume;
+       float volume;
+       bool mute;
+} channel_volume;
 
-typedef struct Ice1712_Settings
+typedef struct ice1712_settings
 {
-       ChannelVolume Playback[MAX_HARDWARE_VOLUME];
-       ChannelVolume Record[MAX_HARDWARE_VOLUME];
+       channel_volume playback[ICE1712_HARDWARE_VOLUME];
+       channel_volume record[ICE1712_HARDWARE_VOLUME];
 
        //General Settings
-       uint8 Clock; //an index
-       uint8 BufferSize; //an index
-       uint8 DebugMode; //an index for debugging
+       uint8 clock; //an index
+       uint8 bufferSize; //an index
+       uint8 debugMode; //an index for debugging
 
        //S/PDif Settings
-       uint8 OutFormat; //an index
-       uint8 Emphasis; //an index
-       uint8 CopyMode; //an index
+       uint8 outFormat; //an index
+       uint8 emphasis; //an index
+       uint8 copyMode; //an index
 
        //Output settings
-       uint8 Output[5]; //an index
+       uint8 output[5]; //an index
+
+       uint8 reserved[32];
+} ice1712_settings;
 
-       uint8 Reserved[32];
-} Ice1712_Settings;
+typedef struct ice1712_hconfig
+{
+       int8 nb_ADC; //Mono Channel
+       int8 nb_DAC; //Mono Channel
+       int8 nb_MPU401;
+       int8 spdif;
+} ice1712_hconfig;
 
 typedef struct ice1712
 {
@@ -120,11 +129,6 @@ typedef struct ice1712
 
        uint8 eeprom_data[32];
 
-       int8 nb_ADC; //Mono Channel
-       int8 nb_DAC; //Mono Channel
-       _spdif_config_ spdif_config;
-       int8 nb_MPU401;
-
        product_t product;
 
        //We hope all manufacturers will use same
@@ -151,7 +155,8 @@ typedef struct ice1712
        uint8 sampling_rate; //in the format of the register
        uint32 lock_source;
 
-       Ice1712_Settings settings;
+       ice1712_hconfig         config;
+       ice1712_settings        settings;
 } ice1712;
 
 status_t applySettings(ice1712 *card);
diff --git a/src/add-ons/kernel/drivers/audio/ice1712/midi.c 
b/src/add-ons/kernel/drivers/audio/ice1712/midi.c
index 6da8f30..ac8cd7b 100644
--- a/src/add-ons/kernel/drivers/audio/ice1712/midi.c
+++ b/src/add-ons/kernel/drivers/audio/ice1712/midi.c
@@ -99,7 +99,7 @@ static status_t midi_open(const char * name, uint32 flags, 
void ** cookie)
 
        *cookie = NULL;
        for (ix = 0; ix < num_cards; ix++) {
-               for (i = 0; i < cards[ix].nb_MPU401; i++)
+               for (i = 0; i < cards[ix].config.nb_MPU401; i++)
                        if (!strcmp(name, cards[ix].midi_interf[i].name)) {
                                used_midi = i;
                                break;
@@ -139,7 +139,7 @@ static status_t midi_free(void * cookie)
        TRACE("midi_free()\n");
        f = (*mpu401->free_hook)(cookie);
        for (ix = 0; ix < num_cards; ix++) {
-               for (i = 0; i < cards[ix].nb_MPU401; i++)
+               for (i = 0; i < cards[ix].config.nb_MPU401; i++)
                        if (cards[ix].midi_interf[i].cookie == cookie) {
                                if (atomic_add(&cards[ix].midi_interf[i].count, 
-1) == 1) {
                                        cards[ix].midi_interf[i].cookie = NULL;
diff --git a/src/add-ons/kernel/drivers/audio/ice1712/multi.c 
b/src/add-ons/kernel/drivers/audio/ice1712/multi.c
index 93d0605..693801b 100644
--- a/src/add-ons/kernel/drivers/audio/ice1712/multi.c
+++ b/src/add-ons/kernel/drivers/audio/ice1712/multi.c
@@ -21,7 +21,7 @@
 
 #define AUTHORIZED_RATE (B_SR_SAME_AS_INPUT | B_SR_IS_GLOBAL | B_SR_96000 \
        | B_SR_88200 | B_SR_48000 | B_SR_44100)
-#define AUTHORIZED_SAMPLE_SIZE (B_FMT_24BIT)
+#define AUTHORIZED_SAMPLE_SIZE (B_FMT_32BIT)
 
 #define MAX_CONTROL    32
 
@@ -160,7 +160,7 @@ ice1712_get_description(ice1712 *card, multi_description 
*data)
        TRACE_VV("request_channel_count = %ld\n", data->request_channel_count);
 
        if (size <= data->request_channel_count) {
-               for (i = 0; i < card->nb_DAC; i++) {
+               for (i = 0; i < card->config.nb_DAC; i++) {
                //Analog STEREO output
                        data->channels[chan].channel_id = chan;
                        data->channels[chan].kind = B_MULTI_OUTPUT_CHANNEL;
@@ -170,7 +170,7 @@ ice1712_get_description(ice1712 *card, multi_description 
*data)
                        chan++;
                }
 
-               if (card->spdif_config & NO_IN_YES_OUT) {
+               if (card->config.spdif & SPDIF_OUT_PRESENT) {
                //SPDIF STEREO output
                        data->channels[chan].channel_id = chan;
                        data->channels[chan].kind = B_MULTI_OUTPUT_CHANNEL;
@@ -186,7 +186,7 @@ ice1712_get_description(ice1712 *card, multi_description 
*data)
                        chan++;
                }
 
-               for (i = 0; i < card->nb_ADC; i++) {
+               for (i = 0; i < card->config.nb_ADC; i++) {
                //Analog STEREO input
                        data->channels[chan].channel_id = chan;
                        data->channels[chan].kind = B_MULTI_INPUT_CHANNEL;
@@ -196,7 +196,7 @@ ice1712_get_description(ice1712 *card, multi_description 
*data)
                        chan++;
                }
 
-               if (card->spdif_config & YES_IN_NO_OUT) {
+               if (card->config.spdif & SPDIF_IN_PRESENT) {
                //SPDIF STEREO input
                        data->channels[chan].channel_id = chan;
                        data->channels[chan].kind = B_MULTI_INPUT_CHANNEL;
@@ -301,19 +301,19 @@ ice1712_get_global_format(ice1712 *card, 
multi_format_info *data)
        uint8 sr = read_mt_uint8(card, MT_SAMPLING_RATE_SELECT);
 
        switch (sr) {
-               case 0x0:
+               case ICE1712_SAMPLERATE_48K:
                        data->input.rate = data->output.rate = B_SR_48000;
                        data->input.cvsr = data->output.cvsr = 48000.0f;
                        break;
-               case 0x7:
+               case ICE1712_SAMPLERATE_96K:
                        data->input.rate = data->output.rate = B_SR_96000;
                        data->input.cvsr = data->output.cvsr = 96000.0f;
                        break;
-               case 0x8:
+               case ICE1712_SAMPLERATE_44K1:
                        data->input.rate = data->output.rate = B_SR_44100;
                        data->input.cvsr = data->output.cvsr = 44100.0f;
                        break;
-               case 0xB:
+               case ICE1712_SAMPLERATE_88K2:
                        data->input.rate = data->output.rate = B_SR_88200;
                        data->input.cvsr = data->output.cvsr = 88200.0f;
                        break;
@@ -372,23 +372,23 @@ get_combo_cb(ice1712 *card, uint32 index)
 
        switch (index) {
                case 0:
-                       value = card->settings.Clock;
+                       value = card->settings.clock;
                        break;
 
                case 1:
-                       value = card->settings.BufferSize;
+                       value = card->settings.bufferSize;
                        break;
 
                case 2:
-                       value = card->settings.OutFormat;
+                       value = card->settings.outFormat;
                        break;
 
                case 3:
-                       value = card->settings.Emphasis;
+                       value = card->settings.emphasis;
                        break;
 
                case 4:
-                       value = card->settings.CopyMode;
+                       value = card->settings.copyMode;
                        break;
        }
 
@@ -404,12 +404,12 @@ set_combo_cb(ice1712 *card, uint32 index, uint32 value)
        switch (index) {
                case 0:
                        if (value < 2)
-                               card->settings.Clock = value;
+                               card->settings.clock = value;
                        break;
 
                case 1:
                        if (value < 6) {
-                               card->settings.BufferSize = value;
+                               card->settings.bufferSize = value;
 //                             card->buffer_size = 64 * (1 << value);
 //                             ice1712_buffer_force_stop(card);
 //                             start_DMA(card);
@@ -418,17 +418,17 @@ set_combo_cb(ice1712 *card, uint32 index, uint32 value)
 
                case 2:
                        if (value < 2)
-                               card->settings.OutFormat = value;
+                               card->settings.outFormat = value;
                        break;
 
                case 3:
                        if (value < 3)
-                               card->settings.Emphasis = value;
+                               card->settings.emphasis = value;
                        break;
 
                case 4:
                        if (value < 3)
-                               card->settings.CopyMode = value;
+                               card->settings.copyMode = value;
                        break;
        }
 }
@@ -440,7 +440,7 @@ get_output_cb(ice1712 *card, uint32 index)
        uint32 value = 0;
 
        if (index < 5)
-               value = card->settings.Output[index];
+               value = card->settings.output[index];
 
        TRACE_VV("   get_output_cb: %ld, %ld\n", index, value);
 
@@ -452,7 +452,7 @@ static void
 set_output_cb(ice1712 *card, uint32 index, uint32 value)
 {
        if (index < 5)
-               card->settings.Output[index] = value;
+               card->settings.output[index] = value;
 
        TRACE_VV("   set_output_cb: %ld, %ld\n", index, value);
 }
@@ -461,23 +461,23 @@ set_output_cb(ice1712 *card, uint32 index, uint32 value)
 static void
 get_volume_cb(ice1712 *card, multi_mix_value *mmv)
 {
-       ChannelVolume *vol;
+       channel_volume *vol;
        uint32 chan = ICE1712_MULTI_GET_CHANNEL(mmv->id);
 
        TRACE_VV("   get_volume_cb\n");
 
-       if (chan < MAX_HARDWARE_VOLUME) {
-               vol = card->settings.Playback;
+       if (chan < ICE1712_HARDWARE_VOLUME) {
+               vol = card->settings.playback;
        }
        else {
-               vol = card->settings.Record;
-               chan -= MAX_HARDWARE_VOLUME;
+               vol = card->settings.record;
+               chan -= ICE1712_HARDWARE_VOLUME;
        }
 
-       //chan is normaly <= MAX_HARDWARE_VOLUME
+       //chan is normaly <= ICE1712_HARDWARE_VOLUME
        switch (ICE1712_MULTI_GET_INDEX(mmv->id)) {
                case 0: //Mute
-                       mmv->u.enable = vol[chan].Mute | vol[chan + 1].Mute;
+                       mmv->u.enable = vol[chan].mute | vol[chan + 1].mute;
                        TRACE_VV("\tGet mute %d for channel %d or %d\n",
                                mmv->u.enable, (int)chan, (int)chan + 1);
                        break;
@@ -486,7 +486,7 @@ get_volume_cb(ice1712 *card, multi_mix_value *mmv)
                        chan++;
                        //No break
                case 1: //Left channel
-                       mmv->u.gain = vol[chan].Volume;
+                       mmv->u.gain = vol[chan].volume;
                        TRACE_VV("\tGet Volume %f for channel %d\n",
                                mmv->u.gain, (int)chan);
                        break;
@@ -497,24 +497,24 @@ get_volume_cb(ice1712 *card, multi_mix_value *mmv)
 static void
 set_volume_cb(ice1712 *card, multi_mix_value *mmv)
 {
-       ChannelVolume *vol;
+       channel_volume *vol;
        uint32 chan = ICE1712_MULTI_GET_CHANNEL(mmv->id);
 
        TRACE_VV("   set_volume_cb\n");
 
-       if (chan < MAX_HARDWARE_VOLUME) {
-               vol = card->settings.Playback;
+       if (chan < ICE1712_HARDWARE_VOLUME) {
+               vol = card->settings.playback;
        }
        else {
-               vol = card->settings.Record;
-               chan -= MAX_HARDWARE_VOLUME;
+               vol = card->settings.record;
+               chan -= ICE1712_HARDWARE_VOLUME;
        }
 
-       //chan is normaly <= MAX_HARDWARE_VOLUME
+       //chan is normaly <= ICE1712_HARDWARE_VOLUME
        switch (ICE1712_MULTI_GET_INDEX(mmv->id)) {
                case 0: //Mute
-                       vol[chan].Mute = mmv->u.enable;
-                       vol[chan + 1].Mute = mmv->u.enable;
+                       vol[chan].mute = mmv->u.enable;
+                       vol[chan + 1].mute = mmv->u.enable;
                        TRACE_VV("\tChange mute to %d for channel %d and %d\n",
                                mmv->u.enable, (int)chan, (int)chan + 1);
                        break;
@@ -523,7 +523,7 @@ set_volume_cb(ice1712 *card, multi_mix_value *mmv)
                        chan++;
                        //No break
                case 1: //Left channel
-                       vol[chan].Volume = mmv->u.gain;
+                       vol[chan].volume = mmv->u.gain;
                        TRACE_VV("\tChange Volume to %f for channel %d\n",
                                mmv->u.gain, (int)chan);
                        break;
@@ -848,7 +848,7 @@ create_output_choice(ice1712 *card, multi_mix_control 
**p_mmc,
        nb_control_created++; mmc++;
 
        //Physical Input
-       for (i = 0; i < card->nb_DAC; i += 2) {
+       for (i = 0; i < card->config.nb_DAC; i += 2) {
                mmc->id = id++;
                mmc->flags = B_MULTI_MIX_MUX_VALUE;
                mmc->parent = parentControl;
@@ -860,7 +860,7 @@ create_output_choice(ice1712 *card, multi_mix_control 
**p_mmc,
        }
 
        //Physical Digital Input
-       if (card->spdif_config & YES_IN_NO_OUT) {
+       if (card->config.spdif & SPDIF_IN_PRESENT) {
                mmc->id = id++;
                mmc->flags = B_MULTI_MIX_MUX_VALUE;
                mmc->parent = parentControl;
@@ -924,11 +924,11 @@ ice1712_list_mix_controls(ice1712 *card, 
multi_mix_control_info *mmci)
        //Output Selection Settings
        parentTabColumn = create_group_control(&mmc, group++, parentTab,
                S_null, string_list[3]);
-       for (i = 0; i < card->nb_DAC; i += 2) {
+       for (i = 0; i < card->config.nb_DAC; i += 2) {
                create_output_choice(card, &mmc, i / 2, parentTabColumn);
        }
 
-       if (card->spdif_config & NO_IN_YES_OUT) {
+       if (card->config.spdif & SPDIF_OUT_PRESENT) {
                create_output_choice(card, &mmc, 4, parentTabColumn);
        }
 
@@ -937,31 +937,31 @@ ice1712_list_mix_controls(ice1712 *card, 
multi_mix_control_info *mmci)
        parentTab = create_group_control(&mmc, group++, CONTROL_IS_MASTER,
                S_null, string_list[4]);
 
-       for (i = 0; i < card->nb_DAC; i += 2) {
+       for (i = 0; i < card->config.nb_DAC; i += 2) {
                parentTabColumn = create_group_control(&mmc, group++, parentTab,
                        S_null, string_list[(i / 2) + 11]);
                create_channel_control(&mmc, channel++, parentTabColumn, NULL);
        }
 
-       if (card->spdif_config & NO_IN_YES_OUT) {
+       if (card->config.spdif & SPDIF_OUT_PRESENT) {
                parentTabColumn = create_group_control(&mmc, group++, parentTab,
                        S_null, string_list[15]);
-               create_channel_control(&mmc, MAX_HARDWARE_VOLUME - 2,
+               create_channel_control(&mmc, ICE1712_HARDWARE_VOLUME - 2,
                        parentTabColumn, NULL);
        }
 
        //Input
-       channel = MAX_HARDWARE_VOLUME;
-       for (i = 0; i < card->nb_ADC; i += 2) {
+       channel = ICE1712_HARDWARE_VOLUME;
+       for (i = 0; i < card->config.nb_ADC; i += 2) {
                parentTabColumn = create_group_control(&mmc, group++, parentTab,
                         S_null, string_list[(i / 2) + 17]);
                create_channel_control(&mmc, channel++, parentTabColumn, NULL);
        }
 
-       if (card->spdif_config & YES_IN_NO_OUT) {
+       if (card->config.spdif & SPDIF_IN_PRESENT) {
                parentTabColumn = create_group_control(&mmc, group++, parentTab,
                        S_null, string_list[21]);
-               create_channel_control(&mmc, 2 * MAX_HARDWARE_VOLUME - 2,
+               create_channel_control(&mmc, 2 * ICE1712_HARDWARE_VOLUME - 2,
                        parentTabColumn, NULL);
        }
 
@@ -1006,7 +1006,7 @@ ice1712_get_buffers(ice1712 *card, multi_buffer_list 
*data)
                uint32 buf_i = stride_i * card->buffer_size;
 
                if (data->request_playback_channels == 
card->total_output_channels) {
-                       for (chan_o = 0; chan_o < card->nb_DAC; chan_o++) {
+                       for (chan_o = 0; chan_o < card->config.nb_DAC; 
chan_o++) {
                        //Analog STEREO output
                                data->playback_buffers[buff][chan_o].base = 
card->log_addr_pb
                                        + buf_o * buff + SAMPLE_SIZE * chan_o;
@@ -1015,7 +1015,7 @@ ice1712_get_buffers(ice1712 *card, multi_buffer_list 
*data)
                                        
data->playback_buffers[buff][chan_o].base);
                        }
 
-                       if (card->spdif_config & NO_IN_YES_OUT) {
+                       if (card->config.spdif & SPDIF_OUT_PRESENT) {
                        //SPDIF STEREO output
                                data->playback_buffers[buff][chan_o].base = 
card->log_addr_pb
                                        + buf_o * buff + SAMPLE_SIZE * 
SPDIF_LEFT;
@@ -1034,7 +1034,7 @@ ice1712_get_buffers(ice1712 *card, multi_buffer_list 
*data)
                }
 
                if (data->request_record_channels == 
card->total_input_channels) {
-                       for (chan_i = 0; chan_i < card->nb_ADC; chan_i++) {
+                       for (chan_i = 0; chan_i < card->config.nb_ADC; 
chan_i++) {
                        //Analog STEREO input
                                data->record_buffers[buff][chan_i].base = 
card->log_addr_rec
                                        + buf_i * buff + SAMPLE_SIZE * chan_i;
@@ -1043,7 +1043,7 @@ ice1712_get_buffers(ice1712 *card, multi_buffer_list 
*data)
                                        
data->record_buffers[buff][chan_i].base);
                        }
 
-                       if (card->spdif_config & YES_IN_NO_OUT) {
+                       if (card->config.spdif & SPDIF_IN_PRESENT) {
                        //SPDIF STEREO input
                                data->record_buffers[buff][chan_i].base = 
card->log_addr_rec
                                        + buf_i * buff + SAMPLE_SIZE * 
SPDIF_LEFT;


Other related posts:

  • » [haiku-commits] haiku: hrev43316 - src/add-ons/kernel/drivers/audio/ice1712 - korli