Commit 8fbe5e62 authored by Gerd Knorr's avatar Gerd Knorr Committed by Linus Torvalds

[PATCH] v4l: tvaudio update

- minor msp3400 updates.
- add tea6320 support.
Signed-off-by: default avatarGerd Knorr <kraxel@bytesex.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 21093ee5
......@@ -36,6 +36,7 @@
#include <linux/config.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/string.h>
......@@ -379,7 +380,7 @@ static void msp3400c_setvolume(struct i2c_client *client,
int val = 0, bal = 0;
if (!muted) {
val = (volume * 0x73 / 65535) << 8;
val = (volume * 0x7F / 65535) << 8;
}
if (val) {
bal = (balance / 256) - 128;
......@@ -1202,7 +1203,7 @@ static void msp34xxg_set_source(struct i2c_client *client, int source);
static int msp34xxg_init(struct i2c_client *client)
{
struct msp3400c *msp = i2c_get_clientdata(client);
int modus;
int modus,std;
if (msp3400c_reset(client))
return -1;
......@@ -1216,6 +1217,7 @@ static int msp34xxg_init(struct i2c_client *client)
/* step-by-step initialisation, as described in the manual */
modus = msp34xx_modus(msp->norm);
std = msp34xx_standard(msp->norm);
modus &= ~0x03; /* STATUS_CHANGE=0 */
modus |= 0x01; /* AUTOMATIC_SOUND_DETECTION=1 */
if (msp3400c_write(client,
......@@ -1223,6 +1225,11 @@ static int msp34xxg_init(struct i2c_client *client)
0x30/*MODUS*/,
modus))
return -1;
if (msp3400c_write(client,
I2C_MSP3400C_DEM,
0x20/*stanard*/,
std))
return -1;
/* write the dfps that may have an influence on
standard/audio autodetection right now */
......
......@@ -16,6 +16,7 @@
#include <linux/config.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/string.h>
......@@ -1027,6 +1028,21 @@ static int tda9874a_initialize(struct CHIPSTATE *chip)
#define TEA6300_S_SC 0x04 /* stereo C */
#define TEA6300_S_GMU 0x80 /* general mute */
#define TEA6320_V 0x00 /* volume (0-5)/loudness off (6)/zero crossing mute(7) */
#define TEA6320_FFR 0x01 /* fader front right (0-5) */
#define TEA6320_FFL 0x02 /* fader front left (0-5) */
#define TEA6320_FRR 0x03 /* fader rear right (0-5) */
#define TEA6320_FRL 0x04 /* fader rear left (0-5) */
#define TEA6320_BA 0x05 /* bass (0-4) */
#define TEA6320_TR 0x06 /* treble (0-4) */
#define TEA6320_S 0x07 /* switch register */
/* values for those registers: */
#define TEA6320_S_SA 0x07 /* stereo A input */
#define TEA6320_S_SB 0x06 /* stereo B */
#define TEA6320_S_SC 0x05 /* stereo C */
#define TEA6320_S_SD 0x04 /* stereo D */
#define TEA6320_S_GMU 0x80 /* general mute */
#define TEA6420_S_SA 0x00 /* stereo A input */
#define TEA6420_S_SB 0x01 /* stereo B */
#define TEA6420_S_SC 0x02 /* stereo C */
......@@ -1037,6 +1053,20 @@ static int tda9874a_initialize(struct CHIPSTATE *chip)
static int tea6300_shift10(int val) { return val >> 10; }
static int tea6300_shift12(int val) { return val >> 12; }
/* Assumes 16bit input (values 0x3f to 0x0c are unique, values less than */
/* 0x0c mirror those immediately higher) */
static int tea6320_volume(int val) { return (val / (65535/(63-12)) + 12) & 0x3f; }
static int tea6320_shift11(int val) { return val >> 11; }
static int tea6320_initialize(struct CHIPSTATE * chip)
{
chip_write(chip, TEA6320_FFR, 0x3f);
chip_write(chip, TEA6320_FFL, 0x3f);
chip_write(chip, TEA6320_FRR, 0x3f);
chip_write(chip, TEA6320_FRL, 0x3f);
return 0;
}
/* ---------------------------------------------------------------------- */
/* audio chip descriptions - defines+functions for tda8425 */
......@@ -1214,6 +1244,7 @@ int tda9855 = 1;
int tda9873 = 1;
int tda9874a = 1;
int tea6300 = 0; // address clash with msp34xx
int tea6320 = 0; // address clash with msp34xx
int tea6420 = 1;
int pic16c54 = 1;
int ta8874z = 0; // address clash with tda9840
......@@ -1225,6 +1256,7 @@ module_param(tda9855, int, 0444);
module_param(tda9873, int, 0444);
module_param(tda9874a, int, 0444);
module_param(tea6300, int, 0444);
module_param(tea6320, int, 0444);
module_param(tea6420, int, 0444);
module_param(pic16c54, int, 0444);
module_param(ta8874z, int, 0444);
......@@ -1338,6 +1370,28 @@ static struct CHIPDESC chiplist[] = {
.inputmap = { TEA6300_S_SA, TEA6300_S_SB, TEA6300_S_SC },
.inputmute = TEA6300_S_GMU,
},
{
.name = "tea6320",
.id = I2C_DRIVERID_TEA6300,
.initialize = tea6320_initialize,
.insmodopt = &tea6320,
.addr_lo = I2C_TEA6300 >> 1,
.addr_hi = I2C_TEA6300 >> 1,
.registers = 8,
.flags = CHIP_HAS_VOLUME | CHIP_HAS_BASSTREBLE | CHIP_HAS_INPUTSEL,
.leftreg = TEA6320_V,
.rightreg = TEA6320_V,
.bassreg = TEA6320_BA,
.treblereg = TEA6320_TR,
.volfunc = tea6320_volume,
.bassfunc = tea6320_shift11,
.treblefunc = tea6320_shift11,
.inputreg = TEA6320_S,
.inputmap = { TEA6320_S_SA, TEA6420_S_SB, TEA6300_S_SC, TEA6320_S_SD },
.inputmute = TEA6300_S_GMU,
},
{
.name = "tea6420",
.id = I2C_DRIVERID_TEA6420,
......@@ -1571,8 +1625,11 @@ static int chip_command(struct i2c_client *client,
if (desc->flags & CHIP_HAS_VOLUME) {
va->flags |= VIDEO_AUDIO_VOLUME;
va->volume = max(chip->left,chip->right);
if (va->volume)
va->balance = (32768*min(chip->left,chip->right))/
(va->volume ? va->volume : 1);
va->volume;
else
va->balance = 32768;
}
if (desc->flags & CHIP_HAS_BASSTREBLE) {
va->flags |= VIDEO_AUDIO_BASS | VIDEO_AUDIO_TREBLE;
......
......@@ -8,7 +8,7 @@
#define I2C_TDA985x_H 0xb6
#define I2C_TDA9874 0xb0 /* also used by 9875 */
#define I2C_TEA6300 0x80
#define I2C_TEA6300 0x80 /* also used by 6320 */
#define I2C_TEA6420 0x98
#define I2C_PIC16C54 0x96 /* PV951 */
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/string.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment