diff options
Diffstat (limited to 'sound/soc/codecs/sigmadsp.c')
-rw-r--r-- | sound/soc/codecs/sigmadsp.c | 65 |
1 files changed, 2 insertions, 63 deletions
diff --git a/sound/soc/codecs/sigmadsp.c b/sound/soc/codecs/sigmadsp.c index 4068f2491232..f2de7e049bc6 100644 --- a/sound/soc/codecs/sigmadsp.c +++ b/sound/soc/codecs/sigmadsp.c | |||
@@ -34,23 +34,6 @@ enum { | |||
34 | SIGMA_ACTION_END, | 34 | SIGMA_ACTION_END, |
35 | }; | 35 | }; |
36 | 36 | ||
37 | struct sigma_action { | ||
38 | u8 instr; | ||
39 | u8 len_hi; | ||
40 | __le16 len; | ||
41 | __be16 addr; | ||
42 | unsigned char payload[]; | ||
43 | } __packed; | ||
44 | |||
45 | struct sigma_firmware { | ||
46 | const struct firmware *fw; | ||
47 | size_t pos; | ||
48 | |||
49 | void *control_data; | ||
50 | int (*write)(void *control_data, const struct sigma_action *sa, | ||
51 | size_t len); | ||
52 | }; | ||
53 | |||
54 | static inline u32 sigma_action_len(struct sigma_action *sa) | 37 | static inline u32 sigma_action_len(struct sigma_action *sa) |
55 | { | 38 | { |
56 | return (sa->len_hi << 16) | le16_to_cpu(sa->len); | 39 | return (sa->len_hi << 16) | le16_to_cpu(sa->len); |
@@ -138,7 +121,7 @@ process_sigma_actions(struct sigma_firmware *ssfw) | |||
138 | return 0; | 121 | return 0; |
139 | } | 122 | } |
140 | 123 | ||
141 | static int _process_sigma_firmware(struct device *dev, | 124 | int _process_sigma_firmware(struct device *dev, |
142 | struct sigma_firmware *ssfw, const char *name) | 125 | struct sigma_firmware *ssfw, const char *name) |
143 | { | 126 | { |
144 | int ret; | 127 | int ret; |
@@ -197,50 +180,6 @@ static int _process_sigma_firmware(struct device *dev, | |||
197 | 180 | ||
198 | return ret; | 181 | return ret; |
199 | } | 182 | } |
200 | 183 | EXPORT_SYMBOL_GPL(_process_sigma_firmware); | |
201 | #if IS_ENABLED(CONFIG_I2C) | ||
202 | |||
203 | static int sigma_action_write_i2c(void *control_data, | ||
204 | const struct sigma_action *sa, size_t len) | ||
205 | { | ||
206 | return i2c_master_send(control_data, (const unsigned char *)&sa->addr, | ||
207 | len); | ||
208 | } | ||
209 | |||
210 | int process_sigma_firmware(struct i2c_client *client, const char *name) | ||
211 | { | ||
212 | struct sigma_firmware ssfw; | ||
213 | |||
214 | ssfw.control_data = client; | ||
215 | ssfw.write = sigma_action_write_i2c; | ||
216 | |||
217 | return _process_sigma_firmware(&client->dev, &ssfw, name); | ||
218 | } | ||
219 | EXPORT_SYMBOL(process_sigma_firmware); | ||
220 | |||
221 | #endif | ||
222 | |||
223 | #if IS_ENABLED(CONFIG_REGMAP) | ||
224 | |||
225 | static int sigma_action_write_regmap(void *control_data, | ||
226 | const struct sigma_action *sa, size_t len) | ||
227 | { | ||
228 | return regmap_raw_write(control_data, be16_to_cpu(sa->addr), | ||
229 | sa->payload, len - 2); | ||
230 | } | ||
231 | |||
232 | int process_sigma_firmware_regmap(struct device *dev, struct regmap *regmap, | ||
233 | const char *name) | ||
234 | { | ||
235 | struct sigma_firmware ssfw; | ||
236 | |||
237 | ssfw.control_data = regmap; | ||
238 | ssfw.write = sigma_action_write_regmap; | ||
239 | |||
240 | return _process_sigma_firmware(dev, &ssfw, name); | ||
241 | } | ||
242 | EXPORT_SYMBOL(process_sigma_firmware_regmap); | ||
243 | |||
244 | #endif | ||
245 | 184 | ||
246 | MODULE_LICENSE("GPL"); | 185 | MODULE_LICENSE("GPL"); |