sound/soc/codecs/cs48l32.c

Source file repositories/reference/linux-study-clean/sound/soc/codecs/cs48l32.c

File Facts

System
Linux kernel
Corpus path
sound/soc/codecs/cs48l32.c
Extension
.c
Size
123883 bytes
Lines
4077
Domain
Driver Families
Bucket
sound/soc
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (ret < 0) {
			dev_err(component->dev,
				"Failed to set ADC1L_INT_ENA_FRC: %d\n", ret);
			return ret;
		}

		ret = snd_soc_component_update_bits(component,
						    CS48L32_ADC1R_ANA_CONTROL1,
						    CS48L32_ADC1x_INT_ENA_FRC_MASK,
						    CS48L32_ADC1x_INT_ENA_FRC_MASK);
		if (ret < 0) {
			dev_err(component->dev,
				"Failed to set ADC1R_INT_ENA_FRC: %d\n", ret);
			return ret;
		}

		result = snd_soc_component_update_bits(component,
						       e->reg,
						       BIT(CS48L32_IN1_MODE_SHIFT),
						       0);
		if (result < 0) {
			dev_err(component->dev, "Failed to set input mode: %d\n", result);
			return result;
		}

		usleep_range(200, 300);

		ret = snd_soc_component_update_bits(component,
						    CS48L32_ADC1L_ANA_CONTROL1,
						    CS48L32_ADC1x_INT_ENA_FRC_MASK,
						    0);
		if (ret < 0) {
			dev_err(component->dev,
				"Failed to clear ADC1L_INT_ENA_FRC: %d\n", ret);
			return ret;
		}

		ret = snd_soc_component_update_bits(component,
						    CS48L32_ADC1R_ANA_CONTROL1,
						    CS48L32_ADC1x_INT_ENA_FRC_MASK,
						    0);
		if (ret < 0) {
			dev_err(component->dev,
				"Failed to clear ADC1R_INT_ENA_FRC: %d\n", ret);
			return ret;
		}

		if (result > 0)
			snd_soc_dapm_mux_update_power(dapm, kcontrol, mode, e, NULL);

		return result;
	case 1:
		return snd_soc_dapm_put_enum_double(kcontrol, ucontrol);
	default:
		return -EINVAL;
	}
}

static SOC_ENUM_SINGLE_DECL(cs48l32_in1dmode_enum,
			    CS48L32_INPUT1_CONTROL1,
			    CS48L32_IN1_MODE_SHIFT,
			    cs48l32_dmode_texts);

static const struct snd_kcontrol_new cs48l32_dmode_mux[] = {
	SOC_DAPM_ENUM_EXT("IN1 Mode", cs48l32_in1dmode_enum,
			  snd_soc_dapm_get_enum_double, cs48l32_dmode_put),
};

static const char * const cs48l32_in_texts[] = {
	"IN1L", "IN1R", "IN2L", "IN2R",
};
static_assert(ARRAY_SIZE(cs48l32_in_texts) == CS48L32_MAX_INPUT);

static const char * const cs48l32_us_freq_texts[] = {
	"16-24kHz", "20-28kHz",
};

static const unsigned int cs48l32_us_freq_val[] = {
	0x2, 0x3,
};

static const struct soc_enum cs48l32_us_freq[] = {
	SOC_VALUE_ENUM_SINGLE(CS48L32_US1_CONTROL,
			      CS48L32_US1_FREQ_SHIFT,
			      CS48L32_US1_FREQ_MASK >> CS48L32_US1_FREQ_SHIFT,
			      ARRAY_SIZE(cs48l32_us_freq_val),
			      cs48l32_us_freq_texts,
			      cs48l32_us_freq_val),
	SOC_VALUE_ENUM_SINGLE(CS48L32_US2_CONTROL,
			      CS48L32_US1_FREQ_SHIFT,

Annotation

Implementation Notes