Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 17357
b: refs/heads/master
c: fac9e89
h: refs/heads/master
i:
  17355: e171c35
v: v3
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Jan 9, 2006
1 parent c72ff33 commit 49c3549
Show file tree
Hide file tree
Showing 16 changed files with 187 additions and 267 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: 0e7072ef6623c3dc58faf3f7310aba77b0a5845e
refs/heads/master: fac9e89999a12f378112fe93764b30196bc03f46
29 changes: 7 additions & 22 deletions trunk/drivers/media/video/cs53l32a.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <linux/i2c.h>
#include <linux/i2c-id.h>
#include <linux/videodev.h>
#include <media/audiochip.h>
#include <media/v4l2-common.h>

MODULE_DESCRIPTION("i2c device driver for cs53l32a Audio ADC");
MODULE_AUTHOR("Martin Vaughan");
Expand All @@ -39,21 +39,6 @@ module_param(debug, bool, 0644);

MODULE_PARM_DESC(debug, "Debugging messages\n\t\t\t0=Off (default), 1=On");

#define cs53l32a_dbg(fmt, arg...) \
do { \
if (debug) \
printk(KERN_INFO "%s debug %d-%04x: " fmt, \
client->driver->driver.name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); \
} while (0)

#define cs53l32a_err(fmt, arg...) do { \
printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->driver.name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
#define cs53l32a_info(fmt, arg...) do { \
printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->driver.name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)

static unsigned short normal_i2c[] = { 0x22 >> 1, I2C_CLIENT_END };


Expand Down Expand Up @@ -84,7 +69,7 @@ static int cs53l32a_command(struct i2c_client *client, unsigned int cmd,
the second goes through the PGA. Hence there are three
possible inputs to choose from. */
if (input->index > 2) {
cs53l32a_err("Invalid input %d.\n", input->index);
v4l_err(client, "Invalid input %d.\n", input->index);
return -EINVAL;
}
cs53l32a_write(client, 0x01, 0x01 + (input->index << 4));
Expand Down Expand Up @@ -124,9 +109,9 @@ static int cs53l32a_command(struct i2c_client *client, unsigned int cmd,
u8 m = cs53l32a_read(client, 0x03);
s8 vol = cs53l32a_read(client, 0x04);

cs53l32a_info("Input: %d%s\n", (v >> 4) & 3,
v4l_info(client, "Input: %d%s\n", (v >> 4) & 3,
(m & 0xC0) ? " (muted)" : "");
cs53l32a_info("Volume: %d dB\n", vol);
v4l_info(client, "Volume: %d dB\n", vol);
break;
}

Expand Down Expand Up @@ -166,12 +151,12 @@ static int cs53l32a_attach(struct i2c_adapter *adapter, int address, int kind)
client->driver = &i2c_driver;
snprintf(client->name, sizeof(client->name) - 1, "cs53l32a");

cs53l32a_info("chip found @ 0x%x (%s)\n", address << 1, adapter->name);
v4l_info(client, "chip found @ 0x%x (%s)\n", address << 1, adapter->name);

for (i = 1; i <= 7; i++) {
u8 v = cs53l32a_read(client, i);

cs53l32a_dbg("Read Reg %d %02x\n", i, v);
v4l_dbg(1, client, "Read Reg %d %02x\n", i, v);
}

/* Set cs53l32a internal register for Adaptec 2010/2410 setup */
Expand All @@ -189,7 +174,7 @@ static int cs53l32a_attach(struct i2c_adapter *adapter, int address, int kind)
for (i = 1; i <= 7; i++) {
u8 v = cs53l32a_read(client, i);

cs53l32a_dbg("Read Reg %d %02x\n", i, v);
v4l_dbg(1, client, "Read Reg %d %02x\n", i, v);
}

i2c_attach_client(client);
Expand Down
70 changes: 35 additions & 35 deletions trunk/drivers/media/video/cx25840/cx25840-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ MODULE_LICENSE("GPL");
static unsigned short normal_i2c[] = { 0x88 >> 1, I2C_CLIENT_END };


int cx25840_debug = 0;
int debug = 0;

module_param(cx25840_debug, bool, 0644);
module_param(debug, bool, 0644);

MODULE_PARM_DESC(cx25840_debug, "Debugging messages [0=Off (default) 1=On]");
MODULE_PARM_DESC(debug, "Debugging messages [0=Off (default) 1=On]");

I2C_CLIENT_INSMOD;

Expand Down Expand Up @@ -265,7 +265,7 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp
vid_input <= CX25840_COMPOSITE8);
u8 reg;

cx25840_dbg("decoder set video input %d, audio input %d\n",
v4l_dbg(1, client, "decoder set video input %d, audio input %d\n",
vid_input, aud_input);

if (is_composite) {
Expand All @@ -277,7 +277,7 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp
if ((vid_input & ~0xff0) ||
luma < CX25840_SVIDEO_LUMA1 || luma > CX25840_SVIDEO_LUMA4 ||
chroma < CX25840_SVIDEO_CHROMA4 || chroma > CX25840_SVIDEO_CHROMA8) {
cx25840_err("0x%04x is not a valid video input!\n", vid_input);
v4l_err(client, "0x%04x is not a valid video input!\n", vid_input);
return -EINVAL;
}
reg = 0xf0 + ((luma - CX25840_SVIDEO_LUMA1) >> 4);
Expand All @@ -301,7 +301,7 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp
case CX25840_AUDIO8: reg &= ~0xc0; reg |= 0x40; break;

default:
cx25840_err("0x%04x is not a valid audio input!\n", aud_input);
v4l_err(client, "0x%04x is not a valid audio input!\n", aud_input);
return -EINVAL;
}

Expand Down Expand Up @@ -396,7 +396,7 @@ static int set_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl)

case V4L2_CID_BRIGHTNESS:
if (ctrl->value < 0 || ctrl->value > 255) {
cx25840_err("invalid brightness setting %d\n",
v4l_err(client, "invalid brightness setting %d\n",
ctrl->value);
return -ERANGE;
}
Expand All @@ -406,7 +406,7 @@ static int set_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl)

case V4L2_CID_CONTRAST:
if (ctrl->value < 0 || ctrl->value > 127) {
cx25840_err("invalid contrast setting %d\n",
v4l_err(client, "invalid contrast setting %d\n",
ctrl->value);
return -ERANGE;
}
Expand All @@ -416,7 +416,7 @@ static int set_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl)

case V4L2_CID_SATURATION:
if (ctrl->value < 0 || ctrl->value > 127) {
cx25840_err("invalid saturation setting %d\n",
v4l_err(client, "invalid saturation setting %d\n",
ctrl->value);
return -ERANGE;
}
Expand All @@ -427,7 +427,7 @@ static int set_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl)

case V4L2_CID_HUE:
if (ctrl->value < -127 || ctrl->value > 127) {
cx25840_err("invalid hue setting %d\n", ctrl->value);
v4l_err(client, "invalid hue setting %d\n", ctrl->value);
return -ERANGE;
}

Expand Down Expand Up @@ -515,7 +515,7 @@ static int set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt)

if ((pix->width * 16 < Hsrc) || (Hsrc < pix->width) ||
(Vlines * 8 < Vsrc) || (Vsrc < Vlines)) {
cx25840_err("%dx%d is not a valid size!\n",
v4l_err(client, "%dx%d is not a valid size!\n",
pix->width, pix->height);
return -ERANGE;
}
Expand All @@ -533,7 +533,7 @@ static int set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt)
else
filter = 3;

cx25840_dbg("decoder set size %dx%d -> scale %ux%u\n",
v4l_dbg(1, client, "decoder set size %dx%d -> scale %ux%u\n",
pix->width, pix->height, HSC, VSC);

/* HSCALE=HSC */
Expand Down Expand Up @@ -602,13 +602,13 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd,
return cx25840_audio(client, cmd, arg);

case VIDIOC_STREAMON:
cx25840_dbg("enable output\n");
v4l_dbg(1, client, "enable output\n");
cx25840_write(client, 0x115, 0x8c);
cx25840_write(client, 0x116, 0x07);
break;

case VIDIOC_STREAMOFF:
cx25840_dbg("disable output\n");
v4l_dbg(1, client, "disable output\n");
cx25840_write(client, 0x115, 0x00);
cx25840_write(client, 0x116, 0x00);
break;
Expand Down Expand Up @@ -774,20 +774,20 @@ static int cx25840_detect_client(struct i2c_adapter *adapter, int address,
client->driver = &i2c_driver_cx25840;
snprintf(client->name, sizeof(client->name) - 1, "cx25840");

cx25840_dbg("detecting cx25840 client on address 0x%x\n", address << 1);
v4l_dbg(1, client, "detecting cx25840 client on address 0x%x\n", address << 1);

device_id = cx25840_read(client, 0x101) << 8;
device_id |= cx25840_read(client, 0x100);

/* The high byte of the device ID should be
* 0x84 if chip is present */
if ((device_id & 0xff00) != 0x8400) {
cx25840_dbg("cx25840 not found\n");
v4l_dbg(1, client, "cx25840 not found\n");
kfree(client);
return 0;
}

cx25840_info("cx25%3x-2%x found @ 0x%x (%s)\n",
v4l_info(client, "cx25%3x-2%x found @ 0x%x (%s)\n",
(device_id & 0xfff0) >> 4,
(device_id & 0x0f) < 3 ? (device_id & 0x0f) + 1 : 3,
address << 1, adapter->name);
Expand Down Expand Up @@ -891,9 +891,9 @@ static void log_status(struct i2c_client *client)
int aud_input = state->aud_input;
char *p;

cx25840_info("Video signal: %spresent\n",
v4l_info(client, "Video signal: %spresent\n",
(microctrl_vidfmt & 0x10) ? "" : "not ");
cx25840_info("Detected format: %s\n",
v4l_info(client, "Detected format: %s\n",
fmt_strs[gen_stat1 & 0xf]);

switch (mod_det_stat0) {
Expand All @@ -908,7 +908,7 @@ static void log_status(struct i2c_client *client)
case 0xfe: p = "forced mode"; break;
default: p = "not defined";
}
cx25840_info("Detected audio mode: %s\n", p);
v4l_info(client, "Detected audio mode: %s\n", p);

switch (mod_det_stat1) {
case 0x00: p = "not defined"; break;
Expand All @@ -934,10 +934,10 @@ static void log_status(struct i2c_client *client)
case 0xff: p = "no detected audio standard"; break;
default: p = "not defined";
}
cx25840_info("Detected audio standard: %s\n", p);
cx25840_info("Audio muted: %s\n",
v4l_info(client, "Detected audio standard: %s\n", p);
v4l_info(client, "Audio muted: %s\n",
(mute_ctl & 0x2) ? "yes" : "no");
cx25840_info("Audio microcontroller: %s\n",
v4l_info(client, "Audio microcontroller: %s\n",
(download_ctl & 0x10) ? "running" : "stopped");

switch (audio_config >> 4) {
Expand All @@ -959,7 +959,7 @@ static void log_status(struct i2c_client *client)
case 0x0f: p = "automatic detection"; break;
default: p = "undefined";
}
cx25840_info("Configured audio standard: %s\n", p);
v4l_info(client, "Configured audio standard: %s\n", p);

if ((audio_config >> 4) < 0xF) {
switch (audio_config & 0xF) {
Expand All @@ -976,7 +976,7 @@ static void log_status(struct i2c_client *client)
case 0x0a: p = "SAP"; break;
default: p = "undefined";
}
cx25840_info("Configured audio mode: %s\n", p);
v4l_info(client, "Configured audio mode: %s\n", p);
} else {
switch (audio_config & 0xF) {
case 0x00: p = "BG"; break;
Expand All @@ -992,27 +992,27 @@ static void log_status(struct i2c_client *client)
case 0x0f: p = "automatic standard and mode detection"; break;
default: p = "undefined";
}
cx25840_info("Configured audio system: %s\n", p);
v4l_info(client, "Configured audio system: %s\n", p);
}

cx25840_info("Specified standard: %s\n",
v4l_info(client, "Specified standard: %s\n",
vidfmt_sel ? fmt_strs[vidfmt_sel] : "automatic detection");

if (vid_input >= CX25840_COMPOSITE1 &&
vid_input <= CX25840_COMPOSITE8) {
cx25840_info("Specified video input: Composite %d\n",
v4l_info(client, "Specified video input: Composite %d\n",
vid_input - CX25840_COMPOSITE1 + 1);
} else {
cx25840_info("Specified video input: S-Video (Luma In%d, Chroma In%d)\n",
v4l_info(client, "Specified video input: S-Video (Luma In%d, Chroma In%d)\n",
(vid_input & 0xf0) >> 4, (vid_input & 0xf00) >> 8);
}
if (aud_input) {
cx25840_info("Specified audio input: Tuner (In%d)\n", aud_input);
v4l_info(client, "Specified audio input: Tuner (In%d)\n", aud_input);
} else {
cx25840_info("Specified audio input: External\n");
v4l_info(client, "Specified audio input: External\n");
}

cx25840_info("Specified audioclock freq: %d Hz\n", state->audclk_freq);
v4l_info(client, "Specified audioclock freq: %d Hz\n", state->audclk_freq);

switch (pref_mode & 0xf) {
case 0: p = "mono/language A"; break;
Expand All @@ -1025,7 +1025,7 @@ static void log_status(struct i2c_client *client)
case 7: p = "language AB"; break;
default: p = "undefined";
}
cx25840_info("Preferred audio mode: %s\n", p);
v4l_info(client, "Preferred audio mode: %s\n", p);

if ((audio_config & 0xf) == 0xf) {
switch ((afc0 >> 3) & 0x3) {
Expand All @@ -1034,7 +1034,7 @@ static void log_status(struct i2c_client *client)
case 2: p = "autodetect"; break;
default: p = "undefined";
}
cx25840_info("Selected 65 MHz format: %s\n", p);
v4l_info(client, "Selected 65 MHz format: %s\n", p);

switch (afc0 & 0x7) {
case 0: p = "chroma"; break;
Expand All @@ -1044,6 +1044,6 @@ static void log_status(struct i2c_client *client)
case 4: p = "autodetect"; break;
default: p = "undefined";
}
cx25840_info("Selected 45 MHz format: %s\n", p);
v4l_info(client, "Selected 45 MHz format: %s\n", p);
}
}
13 changes: 6 additions & 7 deletions trunk/drivers/media/video/cx25840/cx25840-firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ static inline int check_fw_load(struct i2c_client *client, int size)
s |= cx25840_read(client, 0x800);

if (size != s) {
cx25840_err("firmware %s load failed\n", firmware);
v4l_err(client, "firmware %s load failed\n", firmware);
return -EINVAL;
}

cx25840_info("loaded %s firmware (%d bytes)\n", firmware, size);
v4l_info(client, "loaded %s firmware (%d bytes)\n", firmware, size);
return 0;
}

Expand All @@ -98,7 +98,7 @@ static inline int fw_write(struct i2c_client *client, u8 * data, int size)
if ((sent = i2c_master_send(client, data, size)) < size) {

if (fastfw) {
cx25840_err("333MHz i2c firmware load failed\n");
v4l_err(client, "333MHz i2c firmware load failed\n");
fastfw = 0;
set_i2c_delay(client, 10);

Expand All @@ -111,13 +111,12 @@ static inline int fw_write(struct i2c_client *client, u8 * data, int size)
}

if (i2c_master_send(client, data, size) < size) {
cx25840_err
("100MHz i2c firmware load failed\n");
v4l_err(client, "100MHz i2c firmware load failed\n");
return -ENOSYS;
}

} else {
cx25840_err("firmware load i2c failure\n");
v4l_err(client, "firmware load i2c failure\n");
return -ENOSYS;
}

Expand All @@ -133,7 +132,7 @@ int cx25840_loadfw(struct i2c_client *client)
int size, send, retval;

if (request_firmware(&fw, firmware, FWDEV(client)) != 0) {
cx25840_err("unable to open firmware %s\n", firmware);
v4l_err(client, "unable to open firmware %s\n", firmware);
return -EINVAL;
}

Expand Down
Loading

0 comments on commit 49c3549

Please sign in to comment.