summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/cx25840
diff options
context:
space:
mode:
authorHans Verkuil <devnull@localhost>2005-12-22 13:49:45 +0000
committerHans Verkuil <devnull@localhost>2005-12-22 13:49:45 +0000
commit3b7e6d1df0ee0051df0c9c70c9a90e3b9b75433f (patch)
treefb16a9ff957b7a88c2b59fd135bce193252bd864 /linux/drivers/media/video/cx25840
parent80815883388b791e62cf4ff2fb3a4b22680a5ea2 (diff)
downloadmediapointer-dvb-s2-3b7e6d1df0ee0051df0c9c70c9a90e3b9b75433f.tar.gz
mediapointer-dvb-s2-3b7e6d1df0ee0051df0c9c70c9a90e3b9b75433f.tar.bz2
Calculate the saa7115 AMCLK regs instead of using fixed values
- Calculate the audio master clock registers from the actual frequencies. This simplifies the code and it also prepares for adding CGC2 support. - VIDIOC_INT_AUDIO_CLOCK_FREQ now receives an u32 instead of an enum. It is more generic and actually easier to implement. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'linux/drivers/media/video/cx25840')
-rw-r--r--linux/drivers/media/video/cx25840/cx25840-audio.c20
-rw-r--r--linux/drivers/media/video/cx25840/cx25840-core.c10
-rw-r--r--linux/drivers/media/video/cx25840/cx25840.h2
3 files changed, 14 insertions, 18 deletions
diff --git a/linux/drivers/media/video/cx25840/cx25840-audio.c b/linux/drivers/media/video/cx25840/cx25840-audio.c
index 51b00e593..08063e983 100644
--- a/linux/drivers/media/video/cx25840/cx25840-audio.c
+++ b/linux/drivers/media/video/cx25840/cx25840-audio.c
@@ -27,11 +27,13 @@
#include "cx25840.h"
-inline static int set_audclk_freq(struct i2c_client *client,
- enum v4l2_audio_clock_freq freq)
+static int set_audclk_freq(struct i2c_client *client, u32 freq)
{
struct cx25840_state *state = i2c_get_clientdata(client);
+ if (freq != 32000 && freq != 44100 && freq != 48000)
+ return -EINVAL;
+
/* assert soft reset */
cx25840_and_or(client, 0x810, ~0x1, 0x01);
@@ -42,7 +44,7 @@ inline static int set_audclk_freq(struct i2c_client *client,
switch (state->audio_input) {
case AUDIO_TUNER:
switch (freq) {
- case V4L2_AUDCLK_32_KHZ:
+ case 32000:
/* VID_PLL and AUX_PLL */
cx25840_write4(client, 0x108, 0x0f040610);
@@ -55,7 +57,7 @@ inline static int set_audclk_freq(struct i2c_client *client,
cx25840_write4(client, 0x90c, 0x7ff70108);
break;
- case V4L2_AUDCLK_441_KHZ:
+ case 44100:
/* VID_PLL and AUX_PLL */
cx25840_write4(client, 0x108, 0x0f040910);
@@ -68,7 +70,7 @@ inline static int set_audclk_freq(struct i2c_client *client,
cx25840_write4(client, 0x90c, 0x596d0108);
break;
- case V4L2_AUDCLK_48_KHZ:
+ case 48000:
/* VID_PLL and AUX_PLL */
cx25840_write4(client, 0x108, 0x0f040a10);
@@ -88,7 +90,7 @@ inline static int set_audclk_freq(struct i2c_client *client,
case AUDIO_INTERN:
case AUDIO_RADIO:
switch (freq) {
- case V4L2_AUDCLK_32_KHZ:
+ case 32000:
/* VID_PLL and AUX_PLL */
cx25840_write4(client, 0x108, 0x0f04081e);
@@ -107,7 +109,7 @@ inline static int set_audclk_freq(struct i2c_client *client,
cx25840_write(client, 0x127, 0x54);
break;
- case V4L2_AUDCLK_441_KHZ:
+ case 44100:
/* VID_PLL and AUX_PLL */
cx25840_write4(client, 0x108, 0x0f040918);
@@ -123,7 +125,7 @@ inline static int set_audclk_freq(struct i2c_client *client,
cx25840_write4(client, 0x90c, 0x85730108);
break;
- case V4L2_AUDCLK_48_KHZ:
+ case 48000:
/* VID_PLL and AUX_PLL */
cx25840_write4(client, 0x108, 0x0f040a18);
@@ -321,7 +323,7 @@ int cx25840_audio(struct i2c_client *client, unsigned int cmd, void *arg)
case AUDC_SET_INPUT:
return set_input(client, *(int *)arg);
case VIDIOC_INT_AUDIO_CLOCK_FREQ:
- return set_audclk_freq(client, *(enum v4l2_audio_clock_freq *)arg);
+ return set_audclk_freq(client, *(u32 *)arg);
case VIDIOC_G_CTRL:
switch (ctrl->id) {
case V4L2_CID_AUDIO_VOLUME:
diff --git a/linux/drivers/media/video/cx25840/cx25840-core.c b/linux/drivers/media/video/cx25840/cx25840-core.c
index 86b69cb24..8ed4dc3cf 100644
--- a/linux/drivers/media/video/cx25840/cx25840-core.c
+++ b/linux/drivers/media/video/cx25840/cx25840-core.c
@@ -821,7 +821,7 @@ static int cx25840_detect_client(struct i2c_adapter *adapter, int address,
i2c_set_clientdata(client, state);
memset(state, 0, sizeof(struct cx25840_state));
state->input = CX25840_TUNER;
- state->audclk_freq = V4L2_AUDCLK_48_KHZ;
+ state->audclk_freq = 48000;
state->audio_input = AUDIO_TUNER;
state->cardtype = CARDTYPE_PVR150;
@@ -1042,13 +1042,7 @@ static void log_status(struct i2c_client *client)
cx25840_info("Specified audio input: %s\n",
state->audio_input == 0 ? "Tuner" : "External");
- switch (state->audclk_freq) {
- case V4L2_AUDCLK_441_KHZ: p = "44.1 kHz"; break;
- case V4L2_AUDCLK_48_KHZ: p = "48 kHz"; break;
- case V4L2_AUDCLK_32_KHZ: p = "32 kHz"; break;
- default: p = "undefined";
- }
- cx25840_info("Specified audioclock freq: %s\n", p);
+ cx25840_info("Specified audioclock freq: %d Hz\n", state->audclk_freq);
switch (pref_mode & 0xf) {
case 0: p = "mono/language A"; break;
diff --git a/linux/drivers/media/video/cx25840/cx25840.h b/linux/drivers/media/video/cx25840/cx25840.h
index 36b54fe8b..8fb844b4d 100644
--- a/linux/drivers/media/video/cx25840/cx25840.h
+++ b/linux/drivers/media/video/cx25840/cx25840.h
@@ -65,7 +65,7 @@ struct cx25840_state {
enum cx25840_cardtype cardtype;
enum cx25840_input input;
int audio_input;
- enum v4l2_audio_clock_freq audclk_freq;
+ u32 audclk_freq;
};
/* ----------------------------------------------------------------------- */