diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2007-11-01 06:58:17 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-25 16:03:17 -0500 |
commit | 574dec611f1578b52dd37df5c95f855a28652e42 (patch) | |
tree | 16735f23d3b7293665edd5527fb5b42f9cce5edc /drivers/media/video/tlv320aic23b.c | |
parent | 4c05de9c971b70a61d81cd2f1c78db85e2632d1c (diff) |
V4L/DVB (6740): tlv320aic23b: codingstyle cleanups
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/tlv320aic23b.c')
-rw-r--r-- | drivers/media/video/tlv320aic23b.c | 63 |
1 files changed, 34 insertions, 29 deletions
diff --git a/drivers/media/video/tlv320aic23b.c b/drivers/media/video/tlv320aic23b.c index e906528348a9..dc7b9c220b90 100644 --- a/drivers/media/video/tlv320aic23b.c +++ b/drivers/media/video/tlv320aic23b.c | |||
@@ -57,37 +57,35 @@ static int tlv320aic23b_write(struct i2c_client *client, int reg, u16 val) | |||
57 | return -1; | 57 | return -1; |
58 | } | 58 | } |
59 | 59 | ||
60 | for (i = 0; i < 3; i++) { | 60 | for (i = 0; i < 3; i++) |
61 | if (i2c_smbus_write_byte_data(client, (reg << 1) | | 61 | if (i2c_smbus_write_byte_data(client, |
62 | (val >> 8), val & 0xff) == 0) { | 62 | (reg << 1) | (val >> 8), val & 0xff) == 0) |
63 | return 0; | 63 | return 0; |
64 | } | ||
65 | } | ||
66 | v4l_err(client, "I2C: cannot write %03x to register R%d\n", val, reg); | 64 | v4l_err(client, "I2C: cannot write %03x to register R%d\n", val, reg); |
67 | return -1; | 65 | return -1; |
68 | } | 66 | } |
69 | 67 | ||
70 | static int tlv320aic23b_command(struct i2c_client *client, unsigned int cmd, | 68 | static int tlv320aic23b_command(struct i2c_client *client, |
71 | void *arg) | 69 | unsigned int cmd, void *arg) |
72 | { | 70 | { |
73 | struct tlv320aic23b_state *state = i2c_get_clientdata(client); | 71 | struct tlv320aic23b_state *state = i2c_get_clientdata(client); |
74 | struct v4l2_control *ctrl = arg; | 72 | struct v4l2_control *ctrl = arg; |
75 | u32* freq = arg; | 73 | u32 *freq = arg; |
76 | 74 | ||
77 | switch (cmd) { | 75 | switch (cmd) { |
78 | case VIDIOC_INT_AUDIO_CLOCK_FREQ: | 76 | case VIDIOC_INT_AUDIO_CLOCK_FREQ: |
79 | switch (*freq) { | 77 | switch (*freq) { |
80 | case 32000: /* set sample rate to 32 kHz */ | 78 | case 32000: /* set sample rate to 32 kHz */ |
81 | tlv320aic23b_write(client, 8, 0x018); | 79 | tlv320aic23b_write(client, 8, 0x018); |
82 | break; | 80 | break; |
83 | case 44100: /* set sample rate to 44.1 kHz */ | 81 | case 44100: /* set sample rate to 44.1 kHz */ |
84 | tlv320aic23b_write(client, 8, 0x022); | 82 | tlv320aic23b_write(client, 8, 0x022); |
85 | break; | 83 | break; |
86 | case 48000: /* set sample rate to 48 kHz */ | 84 | case 48000: /* set sample rate to 48 kHz */ |
87 | tlv320aic23b_write(client, 8, 0x000); | 85 | tlv320aic23b_write(client, 8, 0x000); |
88 | break; | 86 | break; |
89 | default: | 87 | default: |
90 | return -EINVAL; | 88 | return -EINVAL; |
91 | } | 89 | } |
92 | break; | 90 | break; |
93 | 91 | ||
@@ -135,22 +133,29 @@ static int tlv320aic23b_probe(struct i2c_client *client) | |||
135 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 133 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
136 | return -EIO; | 134 | return -EIO; |
137 | 135 | ||
138 | v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); | 136 | v4l_info(client, "chip found @ 0x%x (%s)\n", |
137 | client->addr << 1, client->adapter->name); | ||
139 | 138 | ||
140 | state = kmalloc(sizeof(struct tlv320aic23b_state), GFP_KERNEL); | 139 | state = kmalloc(sizeof(struct tlv320aic23b_state), GFP_KERNEL); |
141 | if (state == NULL) { | 140 | if (state == NULL) |
142 | return -ENOMEM; | 141 | return -ENOMEM; |
143 | } | ||
144 | state->muted = 0; | 142 | state->muted = 0; |
145 | i2c_set_clientdata(client, state); | 143 | i2c_set_clientdata(client, state); |
146 | 144 | ||
147 | /* initialize tlv320aic23b */ | 145 | /* Initialize tlv320aic23b */ |
148 | tlv320aic23b_write(client, 15, 0x000); /* RESET */ | 146 | |
149 | tlv320aic23b_write(client, 6, 0x00A); /* turn off DAC & mic input */ | 147 | /* RESET */ |
150 | tlv320aic23b_write(client, 7, 0x049); /* left-justified, 24-bit, master mode */ | 148 | tlv320aic23b_write(client, 15, 0x000); |
151 | tlv320aic23b_write(client, 0, 0x119); /* set gain on both channels to +3.0 dB */ | 149 | /* turn off DAC & mic input */ |
152 | tlv320aic23b_write(client, 8, 0x000); /* set sample rate to 48 kHz */ | 150 | tlv320aic23b_write(client, 6, 0x00A); |
153 | tlv320aic23b_write(client, 9, 0x001); /* activate digital interface */ | 151 | /* left-justified, 24-bit, master mode */ |
152 | tlv320aic23b_write(client, 7, 0x049); | ||
153 | /* set gain on both channels to +3.0 dB */ | ||
154 | tlv320aic23b_write(client, 0, 0x119); | ||
155 | /* set sample rate to 48 kHz */ | ||
156 | tlv320aic23b_write(client, 8, 0x000); | ||
157 | /* activate digital interface */ | ||
158 | tlv320aic23b_write(client, 9, 0x001); | ||
154 | return 0; | 159 | return 0; |
155 | } | 160 | } |
156 | 161 | ||