Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 57534
b: refs/heads/master
c: 624fc7f
h: refs/heads/master
v: v3
  • Loading branch information
Russell King authored and Mauro Carvalho Chehab committed Jun 8, 2007
1 parent 0e7e320 commit a269eed
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 31 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: 05f85839a2ffcaa75d505526ca8e74097be18d8c
refs/heads/master: 624fc7f52b48f69fd9d1fe7a594c211762c89825
49 changes: 19 additions & 30 deletions trunk/drivers/media/video/saa7111.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ struct saa7111 {
int norm;
int input;
int enable;
int bright;
int contrast;
int hue;
int sat;
};

#define I2C_SAA7111 0x48
Expand All @@ -96,6 +92,17 @@ saa7111_write (struct i2c_client *client,
return i2c_smbus_write_byte_data(client, reg, value);
}

static inline void
saa7111_write_if_changed(struct i2c_client *client, u8 reg, u8 value)
{
struct saa7111 *decoder = i2c_get_clientdata(client);

if (decoder->reg[reg] != value) {
decoder->reg[reg] = value;
i2c_smbus_write_byte_data(client, reg, value);
}
}

static int
saa7111_write_block (struct i2c_client *client,
const u8 *data,
Expand Down Expand Up @@ -439,28 +446,14 @@ saa7111_command (struct i2c_client *client,
{
struct video_picture *pic = arg;

if (decoder->bright != pic->brightness) {
/* We want 0 to 255 we get 0-65535 */
decoder->bright = pic->brightness;
saa7111_write(client, 0x0a, decoder->bright >> 8);
}
if (decoder->contrast != pic->contrast) {
/* We want 0 to 127 we get 0-65535 */
decoder->contrast = pic->contrast;
saa7111_write(client, 0x0b,
decoder->contrast >> 9);
}
if (decoder->sat != pic->colour) {
/* We want 0 to 127 we get 0-65535 */
decoder->sat = pic->colour;
saa7111_write(client, 0x0c, decoder->sat >> 9);
}
if (decoder->hue != pic->hue) {
/* We want -128 to 127 we get 0-65535 */
decoder->hue = pic->hue;
saa7111_write(client, 0x0d,
(decoder->hue - 32768) >> 8);
}
/* We want 0 to 255 we get 0-65535 */
saa7111_write_if_changed(client, 0x0a, pic->brightness >> 8);
/* We want 0 to 127 we get 0-65535 */
saa7111_write(client, 0x0b, pic->contrast >> 9);
/* We want 0 to 127 we get 0-65535 */
saa7111_write(client, 0x0c, pic->colour >> 9);
/* We want -128 to 127 we get 0-65535 */
saa7111_write(client, 0x0d, (pic->hue - 32768) >> 8);
}
break;

Expand Down Expand Up @@ -524,10 +517,6 @@ saa7111_detect_client (struct i2c_adapter *adapter,
decoder->norm = VIDEO_MODE_NTSC;
decoder->input = 0;
decoder->enable = 1;
decoder->bright = 32768;
decoder->contrast = 32768;
decoder->hue = 32768;
decoder->sat = 32768;
i2c_set_clientdata(client, decoder);

i = i2c_attach_client(client);
Expand Down

0 comments on commit a269eed

Please sign in to comment.