int cx18_av_s_clock_freq(struct v4l2_subdev *sd, u32 freq) { struct cx18 *cx = v4l2_get_subdevdata(sd); struct cx18_av_state *state = &cx->av_state; int retval; u8 v; if (state->aud_input > CX18_AV_AUDIO_SERIAL2) { v = cx18_av_read(cx, 0x803) & ~0x10; cx18_av_write_expect(cx, 0x803, v, v, 0x1f); cx18_av_write(cx, 0x8d3, 0x1f); } v = cx18_av_read(cx, 0x810) | 0x1; cx18_av_write_expect(cx, 0x810, v, v, 0x0f); retval = set_audclk_freq(cx, freq); v = cx18_av_read(cx, 0x810) & ~0x1; cx18_av_write_expect(cx, 0x810, v, v, 0x0f); if (state->aud_input > CX18_AV_AUDIO_SERIAL2) { v = cx18_av_read(cx, 0x803) | 0x10; cx18_av_write_expect(cx, 0x803, v, v, 0x1f); } return retval; }
void cx25840_audio_set_path(struct i2c_client *client) { struct cx25840_state *state = i2c_get_clientdata(client); /* stop microcontroller */ cx25840_and_or(client, 0x803, ~0x10, 0); /* Mute everything to prevent the PFFT! */ cx25840_write(client, 0x8d3, 0x1f); 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. */ } else { /* 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); } set_audclk_freq(client, state->audclk_freq); }
int cx25840_audio(struct i2c_client *client, unsigned int cmd, void *arg) { struct v4l2_control *ctrl = arg; switch (cmd) { 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: ctrl->value = get_volume(client); break; case V4L2_CID_AUDIO_BASS: ctrl->value = get_bass(client); break; case V4L2_CID_AUDIO_TREBLE: ctrl->value = get_treble(client); break; case V4L2_CID_AUDIO_BALANCE: ctrl->value = get_balance(client); break; case V4L2_CID_AUDIO_MUTE: ctrl->value = get_mute(client); break; default: return -EINVAL; } break; case VIDIOC_S_CTRL: switch (ctrl->id) { case V4L2_CID_AUDIO_VOLUME: set_volume(client, ctrl->value); break; case V4L2_CID_AUDIO_BASS: set_bass(client, ctrl->value); break; case V4L2_CID_AUDIO_TREBLE: set_treble(client, ctrl->value); break; case V4L2_CID_AUDIO_BALANCE: set_balance(client, ctrl->value); break; case V4L2_CID_AUDIO_MUTE: set_mute(client, ctrl->value); break; default: return -EINVAL; } break; default: return -EINVAL; } return 0; }
void cx25840_audio_set_path(struct i2c_client *client) { struct cx25840_state *state = to_state(i2c_get_clientdata(client)); if (!is_cx2583x(state)) { /* assert soft reset */ cx25840_and_or(client, 0x810, ~0x1, 0x01); /* stop microcontroller */ cx25840_and_or(client, 0x803, ~0x10, 0); /* Mute everything to prevent the PFFT! */ cx25840_write(client, 0x8d3, 0x1f); if (state->aud_input == CX25840_AUDIO_SERIAL) { /* Set Path1 to Serial Audio Input */ cx25840_write4(client, 0x8d0, 0x01011012); /* The microcontroller should not be started for the * non-tuner inputs: autodetection is specific for * TV audio. */ } else { /* Set Path1 to Analog Demod Main Channel */ cx25840_write4(client, 0x8d0, 0x1f063870); } } set_audclk_freq(client, state->audclk_freq); if (!is_cx2583x(state)) { if (state->aud_input != CX25840_AUDIO_SERIAL) { /* When the microcontroller detects the * audio format, it will unmute the lines */ cx25840_and_or(client, 0x803, ~0x10, 0x10); } /* deassert soft reset */ cx25840_and_or(client, 0x810, ~0x1, 0x00); /* Ensure the controller is running when we exit */ if (is_cx2388x(state) || is_cx231xx(state)) cx25840_and_or(client, 0x803, ~0x10, 0x10); } }
int cx25840_s_clock_freq(struct v4l2_subdev *sd, u32 freq) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct cx25840_state *state = to_state(sd); int retval; if (!state->is_cx25836) cx25840_and_or(client, 0x810, ~0x1, 1); if (state->aud_input != CX25840_AUDIO_SERIAL) { cx25840_and_or(client, 0x803, ~0x10, 0); cx25840_write(client, 0x8d3, 0x1f); } retval = set_audclk_freq(client, freq); if (state->aud_input != CX25840_AUDIO_SERIAL) cx25840_and_or(client, 0x803, ~0x10, 0x10); if (!state->is_cx25836) cx25840_and_or(client, 0x810, ~0x1, 0); return retval; }
void cx18_av_audio_set_path(struct cx18 *cx) { struct cx18_av_state *state = &cx->av_state; u8 v; /* stop microcontroller */ v = cx18_av_read(cx, 0x803) & ~0x10; cx18_av_write_expect(cx, 0x803, v, v, 0x1f); /* assert soft reset */ v = cx18_av_read(cx, 0x810) | 0x01; cx18_av_write_expect(cx, 0x810, v, v, 0x0f); /* Mute everything to prevent the PFFT! */ cx18_av_write(cx, 0x8d3, 0x1f); if (state->aud_input <= CX18_AV_AUDIO_SERIAL2) { /* Set Path1 to Serial Audio Input */ cx18_av_write4(cx, 0x8d0, 0x01011012); /* The microcontroller should not be started for the * non-tuner inputs: autodetection is specific for * TV audio. */ } else { /* Set Path1 to Analog Demod Main Channel */ cx18_av_write4(cx, 0x8d0, 0x1f063870); } set_audclk_freq(cx, state->audclk_freq); /* deassert soft reset */ v = cx18_av_read(cx, 0x810) & ~0x01; cx18_av_write_expect(cx, 0x810, v, v, 0x0f); if (state->aud_input > CX18_AV_AUDIO_SERIAL2) { /* When the microcontroller detects the * audio format, it will unmute the lines */ v = cx18_av_read(cx, 0x803) | 0x10; cx18_av_write_expect(cx, 0x803, v, v, 0x1f); } }
int cx25840_audio(struct i2c_client *client, unsigned int cmd, void *arg) { struct cx25840_state *state = i2c_get_clientdata(client); struct v4l2_control *ctrl = arg; int retval; switch (cmd) { case VIDIOC_INT_AUDIO_CLOCK_FREQ: if (!state->is_cx25836) cx25840_and_or(client, 0x810, ~0x1, 1); if (state->aud_input != CX25840_AUDIO_SERIAL) { cx25840_and_or(client, 0x803, ~0x10, 0); cx25840_write(client, 0x8d3, 0x1f); } retval = set_audclk_freq(client, *(u32 *)arg); if (state->aud_input != CX25840_AUDIO_SERIAL) { cx25840_and_or(client, 0x803, ~0x10, 0x10); } if (!state->is_cx25836) cx25840_and_or(client, 0x810, ~0x1, 0); return retval; case VIDIOC_G_CTRL: switch (ctrl->id) { case V4L2_CID_AUDIO_VOLUME: ctrl->value = get_volume(client); break; case V4L2_CID_AUDIO_BASS: ctrl->value = get_bass(client); break; case V4L2_CID_AUDIO_TREBLE: ctrl->value = get_treble(client); break; case V4L2_CID_AUDIO_BALANCE: ctrl->value = get_balance(client); break; case V4L2_CID_AUDIO_MUTE: ctrl->value = get_mute(client); break; default: return -EINVAL; } break; case VIDIOC_S_CTRL: switch (ctrl->id) { case V4L2_CID_AUDIO_VOLUME: set_volume(client, ctrl->value); break; case V4L2_CID_AUDIO_BASS: set_bass(client, ctrl->value); break; case V4L2_CID_AUDIO_TREBLE: set_treble(client, ctrl->value); break; case V4L2_CID_AUDIO_BALANCE: set_balance(client, ctrl->value); break; case V4L2_CID_AUDIO_MUTE: set_mute(client, ctrl->value); break; default: return -EINVAL; } break; default: return -EINVAL; } return 0; }
int cx18_av_audio(struct cx18 *cx, unsigned int cmd, void *arg) { struct cx18_av_state *state = &cx->av_state; struct v4l2_control *ctrl = arg; int retval; switch (cmd) { case VIDIOC_INT_AUDIO_CLOCK_FREQ: if (state->aud_input > CX18_AV_AUDIO_SERIAL2) { cx18_av_and_or(cx, 0x803, ~0x10, 0); cx18_av_write(cx, 0x8d3, 0x1f); } cx18_av_and_or(cx, 0x810, ~0x1, 1); retval = set_audclk_freq(cx, *(u32 *)arg); cx18_av_and_or(cx, 0x810, ~0x1, 0); if (state->aud_input > CX18_AV_AUDIO_SERIAL2) cx18_av_and_or(cx, 0x803, ~0x10, 0x10); return retval; case VIDIOC_G_CTRL: switch (ctrl->id) { case V4L2_CID_AUDIO_VOLUME: ctrl->value = get_volume(cx); break; case V4L2_CID_AUDIO_BASS: ctrl->value = get_bass(cx); break; case V4L2_CID_AUDIO_TREBLE: ctrl->value = get_treble(cx); break; case V4L2_CID_AUDIO_BALANCE: ctrl->value = get_balance(cx); break; case V4L2_CID_AUDIO_MUTE: ctrl->value = get_mute(cx); break; default: return -EINVAL; } break; case VIDIOC_S_CTRL: switch (ctrl->id) { case V4L2_CID_AUDIO_VOLUME: set_volume(cx, ctrl->value); break; case V4L2_CID_AUDIO_BASS: set_bass(cx, ctrl->value); break; case V4L2_CID_AUDIO_TREBLE: set_treble(cx, ctrl->value); break; case V4L2_CID_AUDIO_BALANCE: set_balance(cx, ctrl->value); break; case V4L2_CID_AUDIO_MUTE: set_mute(cx, ctrl->value); break; default: return -EINVAL; } break; default: return -EINVAL; } return 0; }