int set_i2s_dev_prop(int dev_id, struct am_ch_info *ch, struct audio_dev_property *dev_prop) { int bitsize = AUDIO_BIT_SIZE_16; ch->outcif.audio_channels = dev_prop->num_channels - 1; ch->outcif.client_channels = dev_prop->num_channels - 1; bitsize = get_bit_size(dev_prop->bits_per_sample); ch->outcif.audio_bits = bitsize; ch->outcif.client_bits = bitsize; ch->data_format = AUDIO_FRAME_FORMAT_I2S; switch (dev_prop->dac_dap_data_comm_format) { case dac_dap_data_format_dsp: ch->data_format = AUDIO_FRAME_FORMAT_DSP; break; default: ch->data_format = AUDIO_FRAME_FORMAT_I2S; break; } ch->lrck_polarity = (dev_prop->lrck_high_left) ? 1 : 0; i2s_set_samplerate(dev_id, dev_prop->rate); i2s_set_bit_format(dev_id, ch->data_format); i2s_set_left_right_control_polarity(dev_id, ch->lrck_polarity); i2s_set_acif(dev_id, AUDIO_TX_MODE, &ch->outcif); /* separate incif & outcif as needed */ i2s_set_acif(dev_id, AUDIO_RX_MODE, &ch->outcif); return 0; }
bool base_type_die::is_rep_compatible(std::shared_ptr<type_die> arg) const { // first, try to make arg concrete // HACK: strange infinite recursion bug here, so try using get_offset if (!arg->get_concrete_type()) return false; if (arg->get_concrete_type()->get_offset() != arg->get_offset()) return this->is_rep_compatible( arg->get_concrete_type()); auto arg_base_type = std::dynamic_pointer_cast<base_type_die>(arg); if (!arg_base_type) return false; return arg_base_type->get_encoding() == this->get_encoding() && arg_base_type->get_byte_size() == this->get_byte_size() && arg_base_type->get_bit_size () == this->get_bit_size() && arg_base_type->get_bit_offset() == this->get_bit_offset(); }
static inline int init_device_port(enum tegra_audio_codec_type codec_type) { struct audio_dev_property dev_prop; int port_idx = tegra_das_port_none; struct am_ch_info *ch = NULL; port_idx = tegra_das_get_device_i2s_port(codec_type); if (port_idx != tegra_das_port_none) { memset(&dev_prop, 0 , sizeof(struct audio_dev_property)); tegra_das_get_device_property(codec_type, &dev_prop); ch = &aud_manager->i2s_ch[port_idx]; ch->sfmt.bitsize = get_bit_size(dev_prop.bits_per_sample); ch->sfmt.channels = dev_prop.num_channels - 1; ch->sfmt.samplerate = dev_prop.rate; } AM_DEBUG_PRINT("%s port index %d\n", __func__, port_idx); return port_idx; }