* cleanup

* use gpio count for gpio quirks


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34355 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2009-11-29 21:16:41 +00:00
parent 51b0c01316
commit 4aafe92a0e
5 changed files with 14 additions and 12 deletions

View File

@ -252,6 +252,7 @@ struct hda_audio_group {
uint32 widget_count;
uint32 association_count;
uint32 gpio;
hda_widget* widgets;
hda_association associations[MAX_ASSOCIATIONS];

View File

@ -625,6 +625,7 @@ hda_codec_parse_audio_group(hda_audio_group* audioGroup)
GPIO_COUNT_GPIWAKE(resp[1]) ? "yes" : "no");
dump_widget_stream_support(audioGroup->widget);
audioGroup->gpio = resp[1];
audioGroup->widget_start = SUB_NODE_COUNT_START(resp[2]);
audioGroup->widget_count = SUB_NODE_COUNT_TOTAL(resp[2]);
@ -987,7 +988,7 @@ TRACE("build tree!\n");
// GPIO
uint32 gpio = 0;
for (int32 i = 0; i < 8; i++) {
for (int32 i = 0; i < GPIO_COUNT_NUM_GPIO(audioGroup->gpio); i++) {
if (audioGroup->codec->quirks & (1 << i)) {
gpio |= (1 << i);
}
@ -996,7 +997,7 @@ TRACE("build tree!\n");
if (gpio != 0) {
corb_t verb[] = {
MAKE_VERB(audioGroup->codec->addr,
audioGroup->widget.node_id, VID_SET_GPIODATA, gpio),
audioGroup->widget.node_id, VID_SET_GPIO_DATA, gpio),
MAKE_VERB(audioGroup->codec->addr,
audioGroup->widget.node_id, VID_SET_GPIO_EN, gpio),
MAKE_VERB(audioGroup->codec->addr,

View File

@ -94,10 +94,10 @@ enum pin_dev_type {
#define VID_SET_GPIUNSOL 0x71200
#define VID_GET_GPISTICKY 0xF1300
#define VID_SET_GPISTICKY 0x71300
#define VID_GET_GPODATA 0xF1400
#define VID_SET_GPODATA 0x71400
#define VID_GET_GPIODATA 0xF1500
#define VID_SET_GPIODATA 0x71500
#define VID_GET_GPO_DATA 0xF1400
#define VID_SET_GPO_DATA 0x71400
#define VID_GET_GPIO_DATA 0xF1500
#define VID_SET_GPIO_DATA 0x71500
#define VID_GET_GPIO_EN 0xF1600
#define VID_SET_GPIO_EN 0x71600
#define VID_GET_GPIO_DIR 0xF1700

View File

@ -523,7 +523,7 @@ status_t
hda_stream_setup_buffers(hda_audio_group* audioGroup, hda_stream* stream,
const char* desc)
{
uint32 bufferSize, bufferPhysicalAddress, alloc;
uint32 bufferPhysicalAddress;
uint32 response[2];
physical_entry pe;
bdl_entry_t* bufferDescriptors;
@ -584,7 +584,7 @@ hda_stream_setup_buffers(hda_audio_group* audioGroup, hda_stream* stream,
}
/* Calculate size of buffer (aligned to 128 bytes) */
bufferSize = stream->sample_size * stream->num_channels
uint32 bufferSize = stream->sample_size * stream->num_channels
* stream->buffer_length;
bufferSize = ALIGN(bufferSize, 128);
@ -594,7 +594,7 @@ hda_stream_setup_buffers(hda_audio_group* audioGroup, hda_stream* stream,
stream->rate, stream->bps, format, stream->sample_format);
/* Calculate total size of all buffers (aligned to size of B_PAGE_SIZE) */
alloc = bufferSize * stream->num_buffers;
uint32 alloc = bufferSize * stream->num_buffers;
alloc = PAGE_ALIGN(alloc);
/* Allocate memory for buffers */
@ -623,7 +623,8 @@ hda_stream_setup_buffers(hda_audio_group* audioGroup, hda_stream* stream,
}
/* Now allocate BDL for buffer range */
alloc = (stream->num_buffers + ((offset > 0) ? 1 : 0)) * sizeof(bdl_entry_t);
uint32 bdlCount = stream->num_buffers + (offset > 0 ? 1 : 0);
alloc = bdlCount * sizeof(bdl_entry_t);
alloc = PAGE_ALIGN(alloc);
stream->buffer_descriptors_area = create_area("hda buffer descriptors",
@ -645,7 +646,7 @@ hda_stream_setup_buffers(hda_audio_group* audioGroup, hda_stream* stream,
stream->physical_buffer_descriptors = (uint32)pe.address;
dprintf("%s(%s): Allocated %ld bytes for %ld BDLEs\n", __func__, desc,
alloc, stream->num_buffers);
alloc, bdlCount);
uint32 fragments = 0;
if (offset > 0) {

View File

@ -988,7 +988,6 @@ buffer_force_stop(hda_audio_group* audioGroup)
hda_stream_stop(audioGroup->codec->controller,
audioGroup->record_stream);
}
//hda_stream_stop(audioGroup->codec->controller, audioGroup->record_stream);
return B_OK;
}