ALSA: asihpi - Use consistent err return variable, change some bad variable names.
Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>hifive-unleashed-5.1
parent
ba3a909962
commit
827492acb0
|
@ -310,7 +310,7 @@ u16 hpi_adapter_enumerate_property(u16 adapter_index, u16 index,
|
||||||
u16 hpi_format_create(struct hpi_format *p_format, u16 channels, u16 format,
|
u16 hpi_format_create(struct hpi_format *p_format, u16 channels, u16 format,
|
||||||
u32 sample_rate, u32 bit_rate, u32 attributes)
|
u32 sample_rate, u32 bit_rate, u32 attributes)
|
||||||
{
|
{
|
||||||
u16 error = 0;
|
u16 err = 0;
|
||||||
struct hpi_msg_format fmt;
|
struct hpi_msg_format fmt;
|
||||||
|
|
||||||
switch (channels) {
|
switch (channels) {
|
||||||
|
@ -322,8 +322,8 @@ u16 hpi_format_create(struct hpi_format *p_format, u16 channels, u16 format,
|
||||||
case 16:
|
case 16:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error = HPI_ERROR_INVALID_CHANNELS;
|
err = HPI_ERROR_INVALID_CHANNELS;
|
||||||
return error;
|
return err;
|
||||||
}
|
}
|
||||||
fmt.channels = channels;
|
fmt.channels = channels;
|
||||||
|
|
||||||
|
@ -346,17 +346,17 @@ u16 hpi_format_create(struct hpi_format *p_format, u16 channels, u16 format,
|
||||||
case HPI_FORMAT_OEM2:
|
case HPI_FORMAT_OEM2:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error = HPI_ERROR_INVALID_FORMAT;
|
err = HPI_ERROR_INVALID_FORMAT;
|
||||||
return error;
|
return err;
|
||||||
}
|
}
|
||||||
fmt.format = format;
|
fmt.format = format;
|
||||||
|
|
||||||
if (sample_rate < 8000L) {
|
if (sample_rate < 8000L) {
|
||||||
error = HPI_ERROR_INCOMPATIBLE_SAMPLERATE;
|
err = HPI_ERROR_INCOMPATIBLE_SAMPLERATE;
|
||||||
sample_rate = 8000L;
|
sample_rate = 8000L;
|
||||||
}
|
}
|
||||||
if (sample_rate > 200000L) {
|
if (sample_rate > 200000L) {
|
||||||
error = HPI_ERROR_INCOMPATIBLE_SAMPLERATE;
|
err = HPI_ERROR_INCOMPATIBLE_SAMPLERATE;
|
||||||
sample_rate = 200000L;
|
sample_rate = 200000L;
|
||||||
}
|
}
|
||||||
fmt.sample_rate = sample_rate;
|
fmt.sample_rate = sample_rate;
|
||||||
|
@ -387,10 +387,10 @@ u16 hpi_format_create(struct hpi_format *p_format, u16 channels, u16 format,
|
||||||
if ((channels == 1)
|
if ((channels == 1)
|
||||||
&& (attributes != HPI_MPEG_MODE_DEFAULT)) {
|
&& (attributes != HPI_MPEG_MODE_DEFAULT)) {
|
||||||
attributes = HPI_MPEG_MODE_DEFAULT;
|
attributes = HPI_MPEG_MODE_DEFAULT;
|
||||||
error = HPI_ERROR_INVALID_FORMAT;
|
err = HPI_ERROR_INVALID_FORMAT;
|
||||||
} else if (attributes > HPI_MPEG_MODE_DUALCHANNEL) {
|
} else if (attributes > HPI_MPEG_MODE_DUALCHANNEL) {
|
||||||
attributes = HPI_MPEG_MODE_DEFAULT;
|
attributes = HPI_MPEG_MODE_DEFAULT;
|
||||||
error = HPI_ERROR_INVALID_FORMAT;
|
err = HPI_ERROR_INVALID_FORMAT;
|
||||||
}
|
}
|
||||||
fmt.attributes = attributes;
|
fmt.attributes = attributes;
|
||||||
break;
|
break;
|
||||||
|
@ -399,7 +399,7 @@ u16 hpi_format_create(struct hpi_format *p_format, u16 channels, u16 format,
|
||||||
}
|
}
|
||||||
|
|
||||||
hpi_msg_to_format(p_format, &fmt);
|
hpi_msg_to_format(p_format, &fmt);
|
||||||
return error;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 hpi_stream_estimate_buffer_size(struct hpi_format *p_format,
|
u16 hpi_stream_estimate_buffer_size(struct hpi_format *p_format,
|
||||||
|
@ -1567,13 +1567,13 @@ u16 hpi_aesebu_receiver_get_channel_status(u32 h_control, u16 index,
|
||||||
u16 hpi_aesebu_receiver_get_error_status(u32 h_control, u16 *pw_error_data)
|
u16 hpi_aesebu_receiver_get_error_status(u32 h_control, u16 *pw_error_data)
|
||||||
{
|
{
|
||||||
u32 error_data = 0;
|
u32 error_data = 0;
|
||||||
u16 error = 0;
|
u16 err = 0;
|
||||||
|
|
||||||
error = hpi_control_param1_get(h_control, HPI_AESEBURX_ERRORSTATUS,
|
err = hpi_control_param1_get(h_control, HPI_AESEBURX_ERRORSTATUS,
|
||||||
&error_data);
|
&error_data);
|
||||||
if (pw_error_data)
|
if (pw_error_data)
|
||||||
*pw_error_data = (u16)error_data;
|
*pw_error_data = (u16)error_data;
|
||||||
return error;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 hpi_aesebu_transmitter_set_sample_rate(u32 h_control, u32 sample_rate)
|
u16 hpi_aesebu_transmitter_set_sample_rate(u32 h_control, u32 sample_rate)
|
||||||
|
@ -1680,11 +1680,11 @@ u16 hpi_channel_mode_set(u32 h_control, u16 mode)
|
||||||
u16 hpi_channel_mode_get(u32 h_control, u16 *mode)
|
u16 hpi_channel_mode_get(u32 h_control, u16 *mode)
|
||||||
{
|
{
|
||||||
u32 mode32 = 0;
|
u32 mode32 = 0;
|
||||||
u16 error = hpi_control_param1_get(h_control,
|
u16 err = hpi_control_param1_get(h_control,
|
||||||
HPI_CHANNEL_MODE_MODE, &mode32);
|
HPI_CHANNEL_MODE_MODE, &mode32);
|
||||||
if (mode)
|
if (mode)
|
||||||
*mode = (u16)mode32;
|
*mode = (u16)mode32;
|
||||||
return error;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 hpi_cobranet_hmi_write(u32 h_control, u32 hmi_address, u32 byte_count,
|
u16 hpi_cobranet_hmi_write(u32 h_control, u32 hmi_address, u32 byte_count,
|
||||||
|
@ -1785,9 +1785,9 @@ u16 hpi_cobranet_get_ip_address(u32 h_control, u32 *pdw_ip_address)
|
||||||
{
|
{
|
||||||
u32 byte_count;
|
u32 byte_count;
|
||||||
u32 iP;
|
u32 iP;
|
||||||
u16 error;
|
u16 err;
|
||||||
|
|
||||||
error = hpi_cobranet_hmi_read(h_control,
|
err = hpi_cobranet_hmi_read(h_control,
|
||||||
HPI_COBRANET_HMI_cobra_ip_mon_currentIP, 4, &byte_count,
|
HPI_COBRANET_HMI_cobra_ip_mon_currentIP, 4, &byte_count,
|
||||||
(u8 *)&iP);
|
(u8 *)&iP);
|
||||||
|
|
||||||
|
@ -1795,26 +1795,26 @@ u16 hpi_cobranet_get_ip_address(u32 h_control, u32 *pdw_ip_address)
|
||||||
((iP & 0xff000000) >> 8) | ((iP & 0x00ff0000) << 8) | ((iP &
|
((iP & 0xff000000) >> 8) | ((iP & 0x00ff0000) << 8) | ((iP &
|
||||||
0x0000ff00) >> 8) | ((iP & 0x000000ff) << 8);
|
0x0000ff00) >> 8) | ((iP & 0x000000ff) << 8);
|
||||||
|
|
||||||
if (error)
|
if (err)
|
||||||
*pdw_ip_address = 0;
|
*pdw_ip_address = 0;
|
||||||
|
|
||||||
return error;
|
return err;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 hpi_cobranet_set_ip_address(u32 h_control, u32 dw_ip_address)
|
u16 hpi_cobranet_set_ip_address(u32 h_control, u32 dw_ip_address)
|
||||||
{
|
{
|
||||||
u32 iP;
|
u32 iP;
|
||||||
u16 error;
|
u16 err;
|
||||||
|
|
||||||
iP = ((dw_ip_address & 0xff000000) >> 8) | ((dw_ip_address &
|
iP = ((dw_ip_address & 0xff000000) >> 8) | ((dw_ip_address &
|
||||||
0x00ff0000) << 8) | ((dw_ip_address & 0x0000ff00) >>
|
0x00ff0000) << 8) | ((dw_ip_address & 0x0000ff00) >>
|
||||||
8) | ((dw_ip_address & 0x000000ff) << 8);
|
8) | ((dw_ip_address & 0x000000ff) << 8);
|
||||||
|
|
||||||
error = hpi_cobranet_hmi_write(h_control,
|
err = hpi_cobranet_hmi_write(h_control,
|
||||||
HPI_COBRANET_HMI_cobra_ip_mon_currentIP, 4, (u8 *)&iP);
|
HPI_COBRANET_HMI_cobra_ip_mon_currentIP, 4, (u8 *)&iP);
|
||||||
|
|
||||||
return error;
|
return err;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1822,8 +1822,8 @@ u16 hpi_cobranet_get_static_ip_address(u32 h_control, u32 *pdw_ip_address)
|
||||||
{
|
{
|
||||||
u32 byte_count;
|
u32 byte_count;
|
||||||
u32 iP;
|
u32 iP;
|
||||||
u16 error;
|
u16 err;
|
||||||
error = hpi_cobranet_hmi_read(h_control,
|
err = hpi_cobranet_hmi_read(h_control,
|
||||||
HPI_COBRANET_HMI_cobra_ip_mon_staticIP, 4, &byte_count,
|
HPI_COBRANET_HMI_cobra_ip_mon_staticIP, 4, &byte_count,
|
||||||
(u8 *)&iP);
|
(u8 *)&iP);
|
||||||
|
|
||||||
|
@ -1831,55 +1831,62 @@ u16 hpi_cobranet_get_static_ip_address(u32 h_control, u32 *pdw_ip_address)
|
||||||
((iP & 0xff000000) >> 8) | ((iP & 0x00ff0000) << 8) | ((iP &
|
((iP & 0xff000000) >> 8) | ((iP & 0x00ff0000) << 8) | ((iP &
|
||||||
0x0000ff00) >> 8) | ((iP & 0x000000ff) << 8);
|
0x0000ff00) >> 8) | ((iP & 0x000000ff) << 8);
|
||||||
|
|
||||||
if (error)
|
if (err)
|
||||||
*pdw_ip_address = 0;
|
*pdw_ip_address = 0;
|
||||||
|
|
||||||
return error;
|
return err;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 hpi_cobranet_set_static_ip_address(u32 h_control, u32 dw_ip_address)
|
u16 hpi_cobranet_set_static_ip_address(u32 h_control, u32 dw_ip_address)
|
||||||
{
|
{
|
||||||
u32 iP;
|
u32 iP;
|
||||||
u16 error;
|
u16 err;
|
||||||
|
|
||||||
iP = ((dw_ip_address & 0xff000000) >> 8) | ((dw_ip_address &
|
iP = ((dw_ip_address & 0xff000000) >> 8) | ((dw_ip_address &
|
||||||
0x00ff0000) << 8) | ((dw_ip_address & 0x0000ff00) >>
|
0x00ff0000) << 8) | ((dw_ip_address & 0x0000ff00) >>
|
||||||
8) | ((dw_ip_address & 0x000000ff) << 8);
|
8) | ((dw_ip_address & 0x000000ff) << 8);
|
||||||
|
|
||||||
error = hpi_cobranet_hmi_write(h_control,
|
err = hpi_cobranet_hmi_write(h_control,
|
||||||
HPI_COBRANET_HMI_cobra_ip_mon_staticIP, 4, (u8 *)&iP);
|
HPI_COBRANET_HMI_cobra_ip_mon_staticIP, 4, (u8 *)&iP);
|
||||||
|
|
||||||
return error;
|
return err;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 hpi_cobranet_get_macaddress(u32 h_control, u32 *pmAC_MS_bs,
|
u16 hpi_cobranet_get_macaddress(u32 h_control, u32 *p_mac_msbs,
|
||||||
u32 *pmAC_LS_bs)
|
u32 *p_mac_lsbs)
|
||||||
{
|
{
|
||||||
u32 byte_count;
|
u32 byte_count;
|
||||||
u16 error;
|
u16 err;
|
||||||
u32 mAC;
|
u32 mac;
|
||||||
|
|
||||||
error = hpi_cobranet_hmi_read(h_control,
|
err = hpi_cobranet_hmi_read(h_control,
|
||||||
HPI_COBRANET_HMI_cobra_if_phy_address, 4, &byte_count,
|
HPI_COBRANET_HMI_cobra_if_phy_address, 4, &byte_count,
|
||||||
(u8 *)&mAC);
|
(u8 *)&mac);
|
||||||
*pmAC_MS_bs =
|
|
||||||
((mAC & 0xff000000) >> 8) | ((mAC & 0x00ff0000) << 8) | ((mAC
|
|
||||||
& 0x0000ff00) >> 8) | ((mAC & 0x000000ff) << 8);
|
|
||||||
error += hpi_cobranet_hmi_read(h_control,
|
|
||||||
HPI_COBRANET_HMI_cobra_if_phy_address + 1, 4, &byte_count,
|
|
||||||
(u8 *)&mAC);
|
|
||||||
*pmAC_LS_bs =
|
|
||||||
((mAC & 0xff000000) >> 8) | ((mAC & 0x00ff0000) << 8) | ((mAC
|
|
||||||
& 0x0000ff00) >> 8) | ((mAC & 0x000000ff) << 8);
|
|
||||||
|
|
||||||
if (error) {
|
if (!err) {
|
||||||
*pmAC_MS_bs = 0;
|
*p_mac_msbs =
|
||||||
*pmAC_LS_bs = 0;
|
((mac & 0xff000000) >> 8) | ((mac & 0x00ff0000) << 8)
|
||||||
|
| ((mac & 0x0000ff00) >> 8) | ((mac & 0x000000ff) <<
|
||||||
|
8);
|
||||||
|
|
||||||
|
err = hpi_cobranet_hmi_read(h_control,
|
||||||
|
HPI_COBRANET_HMI_cobra_if_phy_address + 1, 4,
|
||||||
|
&byte_count, (u8 *)&mac);
|
||||||
}
|
}
|
||||||
|
|
||||||
return error;
|
if (!err) {
|
||||||
|
*p_mac_lsbs =
|
||||||
|
((mac & 0xff000000) >> 8) | ((mac & 0x00ff0000) << 8)
|
||||||
|
| ((mac & 0x0000ff00) >> 8) | ((mac & 0x000000ff) <<
|
||||||
|
8);
|
||||||
|
} else {
|
||||||
|
*p_mac_msbs = 0;
|
||||||
|
*p_mac_lsbs = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 hpi_compander_set_enable(u32 h_control, u32 enable)
|
u16 hpi_compander_set_enable(u32 h_control, u32 enable)
|
||||||
|
@ -2158,14 +2165,14 @@ u16 hpi_multiplexer_get_source(u32 h_control, u16 *source_node_type,
|
||||||
u16 *source_node_index)
|
u16 *source_node_index)
|
||||||
{
|
{
|
||||||
u32 node, index;
|
u32 node, index;
|
||||||
u16 error = hpi_control_param2_get(h_control,
|
u16 err = hpi_control_param2_get(h_control,
|
||||||
HPI_MULTIPLEXER_SOURCE, &node,
|
HPI_MULTIPLEXER_SOURCE, &node,
|
||||||
&index);
|
&index);
|
||||||
if (source_node_type)
|
if (source_node_type)
|
||||||
*source_node_type = (u16)node;
|
*source_node_type = (u16)node;
|
||||||
if (source_node_index)
|
if (source_node_index)
|
||||||
*source_node_index = (u16)index;
|
*source_node_index = (u16)index;
|
||||||
return error;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 hpi_multiplexer_query_source(u32 h_control, u16 index,
|
u16 hpi_multiplexer_query_source(u32 h_control, u16 index,
|
||||||
|
@ -2304,14 +2311,14 @@ u16 hpi_sample_clock_set_source(u32 h_control, u16 source)
|
||||||
|
|
||||||
u16 hpi_sample_clock_get_source(u32 h_control, u16 *pw_source)
|
u16 hpi_sample_clock_get_source(u32 h_control, u16 *pw_source)
|
||||||
{
|
{
|
||||||
u16 error = 0;
|
u16 err = 0;
|
||||||
u32 source = 0;
|
u32 source = 0;
|
||||||
error = hpi_control_param1_get(h_control, HPI_SAMPLECLOCK_SOURCE,
|
err = hpi_control_param1_get(h_control, HPI_SAMPLECLOCK_SOURCE,
|
||||||
&source);
|
&source);
|
||||||
if (!error)
|
if (!err)
|
||||||
if (pw_source)
|
if (pw_source)
|
||||||
*pw_source = (u16)source;
|
*pw_source = (u16)source;
|
||||||
return error;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 hpi_sample_clock_query_source_index(const u32 h_clock, const u32 index,
|
u16 hpi_sample_clock_query_source_index(const u32 h_clock, const u32 index,
|
||||||
|
@ -2334,14 +2341,14 @@ u16 hpi_sample_clock_set_source_index(u32 h_control, u16 source_index)
|
||||||
|
|
||||||
u16 hpi_sample_clock_get_source_index(u32 h_control, u16 *pw_source_index)
|
u16 hpi_sample_clock_get_source_index(u32 h_control, u16 *pw_source_index)
|
||||||
{
|
{
|
||||||
u16 error = 0;
|
u16 err = 0;
|
||||||
u32 source_index = 0;
|
u32 source_index = 0;
|
||||||
error = hpi_control_param1_get(h_control,
|
err = hpi_control_param1_get(h_control, HPI_SAMPLECLOCK_SOURCE_INDEX,
|
||||||
HPI_SAMPLECLOCK_SOURCE_INDEX, &source_index);
|
&source_index);
|
||||||
if (!error)
|
if (!err)
|
||||||
if (pw_source_index)
|
if (pw_source_index)
|
||||||
*pw_source_index = (u16)source_index;
|
*pw_source_index = (u16)source_index;
|
||||||
return error;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 hpi_sample_clock_query_local_rate(const u32 h_clock, const u32 index,
|
u16 hpi_sample_clock_query_local_rate(const u32 h_clock, const u32 index,
|
||||||
|
@ -2362,26 +2369,26 @@ u16 hpi_sample_clock_set_local_rate(u32 h_control, u32 sample_rate)
|
||||||
|
|
||||||
u16 hpi_sample_clock_get_local_rate(u32 h_control, u32 *psample_rate)
|
u16 hpi_sample_clock_get_local_rate(u32 h_control, u32 *psample_rate)
|
||||||
{
|
{
|
||||||
u16 error = 0;
|
u16 err = 0;
|
||||||
u32 sample_rate = 0;
|
u32 sample_rate = 0;
|
||||||
error = hpi_control_param1_get(h_control,
|
err = hpi_control_param1_get(h_control,
|
||||||
HPI_SAMPLECLOCK_LOCAL_SAMPLERATE, &sample_rate);
|
HPI_SAMPLECLOCK_LOCAL_SAMPLERATE, &sample_rate);
|
||||||
if (!error)
|
if (!err)
|
||||||
if (psample_rate)
|
if (psample_rate)
|
||||||
*psample_rate = sample_rate;
|
*psample_rate = sample_rate;
|
||||||
return error;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 hpi_sample_clock_get_sample_rate(u32 h_control, u32 *psample_rate)
|
u16 hpi_sample_clock_get_sample_rate(u32 h_control, u32 *psample_rate)
|
||||||
{
|
{
|
||||||
u16 error = 0;
|
u16 err = 0;
|
||||||
u32 sample_rate = 0;
|
u32 sample_rate = 0;
|
||||||
error = hpi_control_param1_get(h_control, HPI_SAMPLECLOCK_SAMPLERATE,
|
err = hpi_control_param1_get(h_control, HPI_SAMPLECLOCK_SAMPLERATE,
|
||||||
&sample_rate);
|
&sample_rate);
|
||||||
if (!error)
|
if (!err)
|
||||||
if (psample_rate)
|
if (psample_rate)
|
||||||
*psample_rate = sample_rate;
|
*psample_rate = sample_rate;
|
||||||
return error;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 hpi_sample_clock_set_auto(u32 h_control, u32 enable)
|
u16 hpi_sample_clock_set_auto(u32 h_control, u32 enable)
|
||||||
|
|
Loading…
Reference in New Issue