Commit a2070c66 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

V4L/DVB (9747): em28xx: Properly handles XCLK and I2C speed

The previous patches removed XCLK and I2C magic. Now, we finally know
what those registers do. Also, only a very few cards need different
setups for those.

Instead of keeping the setups for those values inside the per-device
hack magic switch, move the uncommon values to the board-specific
struct, and have a common setup for all other boards.

So, almost 100 lines of hacking magic were removed.

A co-lateral effect of this patch is that it also fixes a bug at em28xx-core, where xclk
were set, without taking any care about not overriding a previous xclk setup.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 6d676d8a
This diff is collapsed.
......@@ -399,7 +399,7 @@ struct em28xx_vol_table outputs[] = {
int em28xx_audio_analog_set(struct em28xx *dev)
{
int ret, i;
u8 xclk = 0x07;
u8 xclk;
if (!dev->audio_mode.has_audio)
return 0;
......@@ -417,13 +417,11 @@ int em28xx_audio_analog_set(struct em28xx *dev)
}
}
if (dev->has_12mhz_i2s)
xclk |= 0x20;
xclk = dev->xclk & 0x7f;
if (!dev->mute)
xclk |= 0x80;
ret = em28xx_write_reg_bits(dev, EM28XX_R0F_XCLK, xclk, 0xa7);
ret = em28xx_write_reg(dev, EM28XX_R0F_XCLK, xclk);
if (ret < 0)
return ret;
msleep(10);
......
......@@ -338,12 +338,13 @@ struct em28xx_board {
unsigned int is_em2800:1;
unsigned int has_msp34xx:1;
unsigned int mts_firmware:1;
unsigned int has_12mhz_i2s:1;
unsigned int max_range_640_480:1;
unsigned int has_dvb:1;
unsigned int has_snapshot_button:1;
unsigned int valid:1;
unsigned char xclk, i2c_speed;
enum em28xx_decoder decoder;
struct em28xx_input input[MAX_EM28XX_INPUT];
......@@ -422,12 +423,13 @@ struct em28xx {
unsigned int stream_on:1; /* Locks streams */
unsigned int has_audio_class:1;
unsigned int has_alsa_audio:1;
unsigned int has_12mhz_i2s:1;
unsigned int max_range_640_480:1;
unsigned int has_dvb:1;
unsigned int has_snapshot_button:1;
unsigned int valid:1; /* report for validated boards */
unsigned char xclk, i2c_speed;
struct em28xx_IR *ir;
/* Some older em28xx chips needs a waiting time after writing */
......
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