Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 17341
b: refs/heads/master
c: a8bbf12
h: refs/heads/master
i:
  17339: da9fe7c
v: v3
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Jan 9, 2006
1 parent 775bca4 commit 1e1cf0c
Show file tree
Hide file tree
Showing 4 changed files with 154 additions and 142 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3578d3dd0b1e468a44a76a83efe90476a854625d
refs/heads/master: a8bbf12ad8a8ad532cea0b67f0127ad90d336b04
51 changes: 15 additions & 36 deletions trunk/drivers/media/video/cx25840/cx25840-audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ static int set_audclk_freq(struct i2c_client *client, u32 freq)
/* SA_MCLK_SEL=1, SA_MCLK_DIV=0x10 */
cx25840_write(client, 0x127, 0x50);

switch (state->audio_input) {
case AUDIO_TUNER:
if (state->aud_input != CX25840_AUDIO_SERIAL) {
switch (freq) {
case 32000:
/* VID_PLL and AUX_PLL */
Expand Down Expand Up @@ -79,12 +78,7 @@ static int set_audclk_freq(struct i2c_client *client, u32 freq)
cx25840_write4(client, 0x90c, 0xaa4f0108);
break;
}
break;

case AUDIO_EXTERN_1:
case AUDIO_EXTERN_2:
case AUDIO_INTERN:
case AUDIO_RADIO:
} else {
switch (freq) {
case 32000:
/* VID_PLL and AUX_PLL */
Expand Down Expand Up @@ -137,7 +131,6 @@ static int set_audclk_freq(struct i2c_client *client, u32 freq)
cx25840_write4(client, 0x90c, 0x55550108);
break;
}
break;
}

/* deassert soft reset */
Expand All @@ -148,48 +141,33 @@ static int set_audclk_freq(struct i2c_client *client, u32 freq)
return 0;
}

static int set_input(struct i2c_client *client, int audio_input)
void cx25840_audio_set_path(struct i2c_client *client)
{
struct cx25840_state *state = i2c_get_clientdata(client);

cx25840_dbg("set audio input (%d)\n", audio_input);

/* stop microcontroller */
cx25840_and_or(client, 0x803, ~0x10, 0);

/* Mute everything to prevent the PFFT! */
cx25840_write(client, 0x8d3, 0x1f);

switch (audio_input) {
case AUDIO_TUNER:
/* Set Path1 to Analog Demod Main Channel */
cx25840_write4(client, 0x8d0, 0x7038061f);

/* When the microcontroller detects the
* audio format, it will unmute the lines */
cx25840_and_or(client, 0x803, ~0x10, 0x10);
break;

case AUDIO_EXTERN_1:
case AUDIO_EXTERN_2:
case AUDIO_INTERN:
case AUDIO_RADIO:
if (state->aud_input == CX25840_AUDIO_SERIAL) {
/* Set Path1 to Serial Audio Input */
cx25840_write4(client, 0x8d0, 0x12100101);

/* The microcontroller should not be started for the
* non-tuner inputs: autodetection is specific for
* TV audio. */
break;
} else {
/* Set Path1 to Analog Demod Main Channel */
cx25840_write4(client, 0x8d0, 0x7038061f);

default:
cx25840_dbg("Invalid audio input selection %d\n", audio_input);
return -EINVAL;
/* When the microcontroller detects the
* audio format, it will unmute the lines */
cx25840_and_or(client, 0x803, ~0x10, 0x10);
}

state->audio_input = audio_input;

return set_audclk_freq(client, state->audclk_freq);
set_audclk_freq(client, state->audclk_freq);
}

inline static int get_volume(struct i2c_client *client)
Expand Down Expand Up @@ -292,7 +270,7 @@ inline static void set_mute(struct i2c_client *client, int mute)
{
struct cx25840_state *state = i2c_get_clientdata(client);

if (state->audio_input == AUDIO_TUNER) {
if (state->aud_input != CX25840_AUDIO_SERIAL) {
/* Must turn off microcontroller in order to mute sound.
* Not sure if this is the best method, but it does work.
* If the microcontroller is running, then it will undo any
Expand All @@ -316,10 +294,9 @@ int cx25840_audio(struct i2c_client *client, unsigned int cmd, void *arg)
struct v4l2_control *ctrl = arg;

switch (cmd) {
case AUDC_SET_INPUT:
return set_input(client, *(int *)arg);
case VIDIOC_INT_AUDIO_CLOCK_FREQ:
return set_audclk_freq(client, *(u32 *)arg);

case VIDIOC_G_CTRL:
switch (ctrl->id) {
case V4L2_CID_AUDIO_VOLUME:
Expand All @@ -341,6 +318,7 @@ int cx25840_audio(struct i2c_client *client, unsigned int cmd, void *arg)
return -EINVAL;
}
break;

case VIDIOC_S_CTRL:
switch (ctrl->id) {
case V4L2_CID_AUDIO_VOLUME:
Expand All @@ -362,6 +340,7 @@ int cx25840_audio(struct i2c_client *client, unsigned int cmd, void *arg)
return -EINVAL;
}
break;

default:
return -EINVAL;
}
Expand Down
Loading

0 comments on commit 1e1cf0c

Please sign in to comment.