Exemplo n.º 1
0
static ssize_t headphone_pa_gain_store(struct kobject *kobj,
		struct kobj_attribute *attr, const char *buf, size_t count)
{
	unsigned int lval, rval, chksum;
	unsigned int gain, status;
	unsigned int out;

	sscanf(buf, "%u %u %u", &lval, &rval, &chksum);

	if (calc_checksum(lval, rval, chksum)) {
	gain = tabla_read(fauxsound_codec_ptr, TABLA_A_RX_HPH_L_GAIN);
	out = (gain & 0xf0) | lval;
	tabla_write(fauxsound_codec_ptr, TABLA_A_RX_HPH_L_GAIN, out);

	status = tabla_read(fauxsound_codec_ptr, TABLA_A_RX_HPH_L_STATUS);
	out = (status & 0x0f) | (lval << 4);
	tabla_write(fauxsound_codec_ptr, TABLA_A_RX_HPH_L_STATUS, out);

	gain = tabla_read(fauxsound_codec_ptr, TABLA_A_RX_HPH_R_GAIN);
	out = (gain & 0xf0) | rval;
	tabla_write(fauxsound_codec_ptr, TABLA_A_RX_HPH_R_GAIN, out);

	status = tabla_read(fauxsound_codec_ptr, TABLA_A_RX_HPH_R_STATUS);
	out = (status & 0x0f) | (rval << 4);
	tabla_write(fauxsound_codec_ptr, TABLA_A_RX_HPH_R_STATUS, out);
	}
	return count;
}
Exemplo n.º 2
0
static ssize_t headphone_gain_store(struct kobject *kobj,
		struct kobj_attribute *attr, const char *buf, size_t count)
{
	unsigned int lval, rval, chksum;

	sscanf(buf, "%u %u %u", &lval, &rval, &chksum);

	if (calc_checksum(lval, rval, chksum)) {
		tabla_write(fauxsound_codec_ptr,
			TABLA_A_CDC_RX1_VOL_CTL_B2_CTL, lval);
		tabla_write(fauxsound_codec_ptr,
			TABLA_A_CDC_RX2_VOL_CTL_B2_CTL, rval);
	}
	return count;
}
static ssize_t sound_reg_write_store(struct kobject *kobj,
                struct kobj_attribute *attr, const char *buf, size_t count)
{
        unsigned int out, chksum;

	sscanf(buf, "%u %u", &out, &chksum);
	if (calc_checksum(out, 0, chksum)) {
		if (selected_reg != 0xdeadbeef)
			tabla_write(fauxsound_codec_ptr, selected_reg, out);
	}
	return count;
}
Exemplo n.º 4
0
static ssize_t cam_mic_gain_store(struct kobject *kobj,
		struct kobj_attribute *attr, const char *buf, size_t count)
{
	unsigned int lval, chksum;

	sscanf(buf, "%u %u", &lval, &chksum);

	if (calc_checksum(lval, 0, chksum)) {
		tabla_write(fauxsound_codec_ptr,
			TABLA_A_CDC_TX6_VOL_CTL_GAIN, lval);
	}
	return count;
}