diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/aoa/codecs/onyx.c | 76 | ||||
-rw-r--r-- | sound/aoa/codecs/tas.c | 66 | ||||
-rw-r--r-- | sound/arm/pxa2xx-ac97-lib.c | 2 | ||||
-rw-r--r-- | sound/pci/ac97/ac97_codec.c | 2 | ||||
-rw-r--r-- | sound/pci/atiixp.c | 6 | ||||
-rw-r--r-- | sound/pci/emu10k1/io.c | 2 | ||||
-rw-r--r-- | sound/pci/intel8x0.c | 18 | ||||
-rw-r--r-- | sound/ppc/keywest.c | 82 | ||||
-rw-r--r-- | sound/soc/codecs/Makefile | 1 | ||||
-rw-r--r-- | sound/soc/codecs/wm8580.c | 16 | ||||
-rw-r--r-- | sound/soc/codecs/wm9705.c | 2 | ||||
-rw-r--r-- | sound/soc/omap/n810.c | 4 | ||||
-rw-r--r-- | sound/soc/omap/omap-mcbsp.c | 12 | ||||
-rw-r--r-- | sound/soc/omap/omap-mcbsp.h | 3 | ||||
-rw-r--r-- | sound/soc/omap/omap-pcm.c | 5 | ||||
-rw-r--r-- | sound/soc/omap/omap-pcm.h | 3 | ||||
-rw-r--r-- | sound/soc/omap/osk5912.c | 4 | ||||
-rw-r--r-- | sound/soc/pxa/palm27x.c | 27 | ||||
-rw-r--r-- | sound/soc/pxa/pxa-ssp.c | 37 | ||||
-rw-r--r-- | sound/soc/s3c24xx/jive_wm8750.c | 12 | ||||
-rw-r--r-- | sound/soc/s3c24xx/s3c-i2s-v2.c | 21 | ||||
-rw-r--r-- | sound/soc/s3c24xx/s3c2412-i2s.c | 2 | ||||
-rw-r--r-- | sound/usb/usx2y/us122l.c | 12 | ||||
-rw-r--r-- | sound/usb/usx2y/usb_stream.c | 67 |
24 files changed, 296 insertions, 186 deletions
diff --git a/sound/aoa/codecs/onyx.c b/sound/aoa/codecs/onyx.c index 15500b9d2da0..84bb07d39a7f 100644 --- a/sound/aoa/codecs/onyx.c +++ b/sound/aoa/codecs/onyx.c | |||
@@ -47,7 +47,7 @@ MODULE_DESCRIPTION("pcm3052 (onyx) codec driver for snd-aoa"); | |||
47 | struct onyx { | 47 | struct onyx { |
48 | /* cache registers 65 to 80, they are write-only! */ | 48 | /* cache registers 65 to 80, they are write-only! */ |
49 | u8 cache[16]; | 49 | u8 cache[16]; |
50 | struct i2c_client i2c; | 50 | struct i2c_client *i2c; |
51 | struct aoa_codec codec; | 51 | struct aoa_codec codec; |
52 | u32 initialised:1, | 52 | u32 initialised:1, |
53 | spdif_locked:1, | 53 | spdif_locked:1, |
@@ -72,7 +72,7 @@ static int onyx_read_register(struct onyx *onyx, u8 reg, u8 *value) | |||
72 | *value = onyx->cache[reg-FIRSTREGISTER]; | 72 | *value = onyx->cache[reg-FIRSTREGISTER]; |
73 | return 0; | 73 | return 0; |
74 | } | 74 | } |
75 | v = i2c_smbus_read_byte_data(&onyx->i2c, reg); | 75 | v = i2c_smbus_read_byte_data(onyx->i2c, reg); |
76 | if (v < 0) | 76 | if (v < 0) |
77 | return -1; | 77 | return -1; |
78 | *value = (u8)v; | 78 | *value = (u8)v; |
@@ -84,7 +84,7 @@ static int onyx_write_register(struct onyx *onyx, u8 reg, u8 value) | |||
84 | { | 84 | { |
85 | int result; | 85 | int result; |
86 | 86 | ||
87 | result = i2c_smbus_write_byte_data(&onyx->i2c, reg, value); | 87 | result = i2c_smbus_write_byte_data(onyx->i2c, reg, value); |
88 | if (!result) | 88 | if (!result) |
89 | onyx->cache[reg-FIRSTREGISTER] = value; | 89 | onyx->cache[reg-FIRSTREGISTER] = value; |
90 | return result; | 90 | return result; |
@@ -996,12 +996,45 @@ static void onyx_exit_codec(struct aoa_codec *codec) | |||
996 | onyx->codec.soundbus_dev->detach_codec(onyx->codec.soundbus_dev, onyx); | 996 | onyx->codec.soundbus_dev->detach_codec(onyx->codec.soundbus_dev, onyx); |
997 | } | 997 | } |
998 | 998 | ||
999 | static struct i2c_driver onyx_driver; | ||
1000 | |||
1001 | static int onyx_create(struct i2c_adapter *adapter, | 999 | static int onyx_create(struct i2c_adapter *adapter, |
1002 | struct device_node *node, | 1000 | struct device_node *node, |
1003 | int addr) | 1001 | int addr) |
1004 | { | 1002 | { |
1003 | struct i2c_board_info info; | ||
1004 | struct i2c_client *client; | ||
1005 | |||
1006 | memset(&info, 0, sizeof(struct i2c_board_info)); | ||
1007 | strlcpy(info.type, "aoa_codec_onyx", I2C_NAME_SIZE); | ||
1008 | info.addr = addr; | ||
1009 | info.platform_data = node; | ||
1010 | client = i2c_new_device(adapter, &info); | ||
1011 | if (!client) | ||
1012 | return -ENODEV; | ||
1013 | |||
1014 | /* | ||
1015 | * We know the driver is already loaded, so the device should be | ||
1016 | * already bound. If not it means binding failed, which suggests | ||
1017 | * the device doesn't really exist and should be deleted. | ||
1018 | * Ideally this would be replaced by better checks _before_ | ||
1019 | * instantiating the device. | ||
1020 | */ | ||
1021 | if (!client->driver) { | ||
1022 | i2c_unregister_device(client); | ||
1023 | return -ENODEV; | ||
1024 | } | ||
1025 | |||
1026 | /* | ||
1027 | * Let i2c-core delete that device on driver removal. | ||
1028 | * This is safe because i2c-core holds the core_lock mutex for us. | ||
1029 | */ | ||
1030 | list_add_tail(&client->detected, &client->driver->clients); | ||
1031 | return 0; | ||
1032 | } | ||
1033 | |||
1034 | static int onyx_i2c_probe(struct i2c_client *client, | ||
1035 | const struct i2c_device_id *id) | ||
1036 | { | ||
1037 | struct device_node *node = client->dev.platform_data; | ||
1005 | struct onyx *onyx; | 1038 | struct onyx *onyx; |
1006 | u8 dummy; | 1039 | u8 dummy; |
1007 | 1040 | ||
@@ -1011,20 +1044,12 @@ static int onyx_create(struct i2c_adapter *adapter, | |||
1011 | return -ENOMEM; | 1044 | return -ENOMEM; |
1012 | 1045 | ||
1013 | mutex_init(&onyx->mutex); | 1046 | mutex_init(&onyx->mutex); |
1014 | onyx->i2c.driver = &onyx_driver; | 1047 | onyx->i2c = client; |
1015 | onyx->i2c.adapter = adapter; | 1048 | i2c_set_clientdata(client, onyx); |
1016 | onyx->i2c.addr = addr & 0x7f; | ||
1017 | strlcpy(onyx->i2c.name, "onyx audio codec", I2C_NAME_SIZE); | ||
1018 | |||
1019 | if (i2c_attach_client(&onyx->i2c)) { | ||
1020 | printk(KERN_ERR PFX "failed to attach to i2c\n"); | ||
1021 | goto fail; | ||
1022 | } | ||
1023 | 1049 | ||
1024 | /* we try to read from register ONYX_REG_CONTROL | 1050 | /* we try to read from register ONYX_REG_CONTROL |
1025 | * to check if the codec is present */ | 1051 | * to check if the codec is present */ |
1026 | if (onyx_read_register(onyx, ONYX_REG_CONTROL, &dummy) != 0) { | 1052 | if (onyx_read_register(onyx, ONYX_REG_CONTROL, &dummy) != 0) { |
1027 | i2c_detach_client(&onyx->i2c); | ||
1028 | printk(KERN_ERR PFX "failed to read control register\n"); | 1053 | printk(KERN_ERR PFX "failed to read control register\n"); |
1029 | goto fail; | 1054 | goto fail; |
1030 | } | 1055 | } |
@@ -1036,14 +1061,14 @@ static int onyx_create(struct i2c_adapter *adapter, | |||
1036 | onyx->codec.node = of_node_get(node); | 1061 | onyx->codec.node = of_node_get(node); |
1037 | 1062 | ||
1038 | if (aoa_codec_register(&onyx->codec)) { | 1063 | if (aoa_codec_register(&onyx->codec)) { |
1039 | i2c_detach_client(&onyx->i2c); | ||
1040 | goto fail; | 1064 | goto fail; |
1041 | } | 1065 | } |
1042 | printk(KERN_DEBUG PFX "created and attached onyx instance\n"); | 1066 | printk(KERN_DEBUG PFX "created and attached onyx instance\n"); |
1043 | return 0; | 1067 | return 0; |
1044 | fail: | 1068 | fail: |
1069 | i2c_set_clientdata(client, NULL); | ||
1045 | kfree(onyx); | 1070 | kfree(onyx); |
1046 | return -EINVAL; | 1071 | return -ENODEV; |
1047 | } | 1072 | } |
1048 | 1073 | ||
1049 | static int onyx_i2c_attach(struct i2c_adapter *adapter) | 1074 | static int onyx_i2c_attach(struct i2c_adapter *adapter) |
@@ -1080,28 +1105,33 @@ static int onyx_i2c_attach(struct i2c_adapter *adapter) | |||
1080 | return onyx_create(adapter, NULL, 0x47); | 1105 | return onyx_create(adapter, NULL, 0x47); |
1081 | } | 1106 | } |
1082 | 1107 | ||
1083 | static int onyx_i2c_detach(struct i2c_client *client) | 1108 | static int onyx_i2c_remove(struct i2c_client *client) |
1084 | { | 1109 | { |
1085 | struct onyx *onyx = container_of(client, struct onyx, i2c); | 1110 | struct onyx *onyx = i2c_get_clientdata(client); |
1086 | int err; | ||
1087 | 1111 | ||
1088 | if ((err = i2c_detach_client(client))) | ||
1089 | return err; | ||
1090 | aoa_codec_unregister(&onyx->codec); | 1112 | aoa_codec_unregister(&onyx->codec); |
1091 | of_node_put(onyx->codec.node); | 1113 | of_node_put(onyx->codec.node); |
1092 | if (onyx->codec_info) | 1114 | if (onyx->codec_info) |
1093 | kfree(onyx->codec_info); | 1115 | kfree(onyx->codec_info); |
1116 | i2c_set_clientdata(client, onyx); | ||
1094 | kfree(onyx); | 1117 | kfree(onyx); |
1095 | return 0; | 1118 | return 0; |
1096 | } | 1119 | } |
1097 | 1120 | ||
1121 | static const struct i2c_device_id onyx_i2c_id[] = { | ||
1122 | { "aoa_codec_onyx", 0 }, | ||
1123 | { } | ||
1124 | }; | ||
1125 | |||
1098 | static struct i2c_driver onyx_driver = { | 1126 | static struct i2c_driver onyx_driver = { |
1099 | .driver = { | 1127 | .driver = { |
1100 | .name = "aoa_codec_onyx", | 1128 | .name = "aoa_codec_onyx", |
1101 | .owner = THIS_MODULE, | 1129 | .owner = THIS_MODULE, |
1102 | }, | 1130 | }, |
1103 | .attach_adapter = onyx_i2c_attach, | 1131 | .attach_adapter = onyx_i2c_attach, |
1104 | .detach_client = onyx_i2c_detach, | 1132 | .probe = onyx_i2c_probe, |
1133 | .remove = onyx_i2c_remove, | ||
1134 | .id_table = onyx_i2c_id, | ||
1105 | }; | 1135 | }; |
1106 | 1136 | ||
1107 | static int __init onyx_init(void) | 1137 | static int __init onyx_init(void) |
diff --git a/sound/aoa/codecs/tas.c b/sound/aoa/codecs/tas.c index 008e0f85097d..f0ebc971c686 100644 --- a/sound/aoa/codecs/tas.c +++ b/sound/aoa/codecs/tas.c | |||
@@ -82,7 +82,7 @@ MODULE_DESCRIPTION("tas codec driver for snd-aoa"); | |||
82 | 82 | ||
83 | struct tas { | 83 | struct tas { |
84 | struct aoa_codec codec; | 84 | struct aoa_codec codec; |
85 | struct i2c_client i2c; | 85 | struct i2c_client *i2c; |
86 | u32 mute_l:1, mute_r:1 , | 86 | u32 mute_l:1, mute_r:1 , |
87 | controls_created:1 , | 87 | controls_created:1 , |
88 | drc_enabled:1, | 88 | drc_enabled:1, |
@@ -108,9 +108,9 @@ static struct tas *codec_to_tas(struct aoa_codec *codec) | |||
108 | static inline int tas_write_reg(struct tas *tas, u8 reg, u8 len, u8 *data) | 108 | static inline int tas_write_reg(struct tas *tas, u8 reg, u8 len, u8 *data) |
109 | { | 109 | { |
110 | if (len == 1) | 110 | if (len == 1) |
111 | return i2c_smbus_write_byte_data(&tas->i2c, reg, *data); | 111 | return i2c_smbus_write_byte_data(tas->i2c, reg, *data); |
112 | else | 112 | else |
113 | return i2c_smbus_write_i2c_block_data(&tas->i2c, reg, len, data); | 113 | return i2c_smbus_write_i2c_block_data(tas->i2c, reg, len, data); |
114 | } | 114 | } |
115 | 115 | ||
116 | static void tas3004_set_drc(struct tas *tas) | 116 | static void tas3004_set_drc(struct tas *tas) |
@@ -882,12 +882,34 @@ static void tas_exit_codec(struct aoa_codec *codec) | |||
882 | } | 882 | } |
883 | 883 | ||
884 | 884 | ||
885 | static struct i2c_driver tas_driver; | ||
886 | |||
887 | static int tas_create(struct i2c_adapter *adapter, | 885 | static int tas_create(struct i2c_adapter *adapter, |
888 | struct device_node *node, | 886 | struct device_node *node, |
889 | int addr) | 887 | int addr) |
890 | { | 888 | { |
889 | struct i2c_board_info info; | ||
890 | struct i2c_client *client; | ||
891 | |||
892 | memset(&info, 0, sizeof(struct i2c_board_info)); | ||
893 | strlcpy(info.type, "aoa_codec_tas", I2C_NAME_SIZE); | ||
894 | info.addr = addr; | ||
895 | info.platform_data = node; | ||
896 | |||
897 | client = i2c_new_device(adapter, &info); | ||
898 | if (!client) | ||
899 | return -ENODEV; | ||
900 | |||
901 | /* | ||
902 | * Let i2c-core delete that device on driver removal. | ||
903 | * This is safe because i2c-core holds the core_lock mutex for us. | ||
904 | */ | ||
905 | list_add_tail(&client->detected, &client->driver->clients); | ||
906 | return 0; | ||
907 | } | ||
908 | |||
909 | static int tas_i2c_probe(struct i2c_client *client, | ||
910 | const struct i2c_device_id *id) | ||
911 | { | ||
912 | struct device_node *node = client->dev.platform_data; | ||
891 | struct tas *tas; | 913 | struct tas *tas; |
892 | 914 | ||
893 | tas = kzalloc(sizeof(struct tas), GFP_KERNEL); | 915 | tas = kzalloc(sizeof(struct tas), GFP_KERNEL); |
@@ -896,17 +918,11 @@ static int tas_create(struct i2c_adapter *adapter, | |||
896 | return -ENOMEM; | 918 | return -ENOMEM; |
897 | 919 | ||
898 | mutex_init(&tas->mtx); | 920 | mutex_init(&tas->mtx); |
899 | tas->i2c.driver = &tas_driver; | 921 | tas->i2c = client; |
900 | tas->i2c.adapter = adapter; | 922 | i2c_set_clientdata(client, tas); |
901 | tas->i2c.addr = addr; | 923 | |
902 | /* seems that half is a saner default */ | 924 | /* seems that half is a saner default */ |
903 | tas->drc_range = TAS3004_DRC_MAX / 2; | 925 | tas->drc_range = TAS3004_DRC_MAX / 2; |
904 | strlcpy(tas->i2c.name, "tas audio codec", I2C_NAME_SIZE); | ||
905 | |||
906 | if (i2c_attach_client(&tas->i2c)) { | ||
907 | printk(KERN_ERR PFX "failed to attach to i2c\n"); | ||
908 | goto fail; | ||
909 | } | ||
910 | 926 | ||
911 | strlcpy(tas->codec.name, "tas", MAX_CODEC_NAME_LEN); | 927 | strlcpy(tas->codec.name, "tas", MAX_CODEC_NAME_LEN); |
912 | tas->codec.owner = THIS_MODULE; | 928 | tas->codec.owner = THIS_MODULE; |
@@ -915,14 +931,12 @@ static int tas_create(struct i2c_adapter *adapter, | |||
915 | tas->codec.node = of_node_get(node); | 931 | tas->codec.node = of_node_get(node); |
916 | 932 | ||
917 | if (aoa_codec_register(&tas->codec)) { | 933 | if (aoa_codec_register(&tas->codec)) { |
918 | goto detach; | 934 | goto fail; |
919 | } | 935 | } |
920 | printk(KERN_DEBUG | 936 | printk(KERN_DEBUG |
921 | "snd-aoa-codec-tas: tas found, addr 0x%02x on %s\n", | 937 | "snd-aoa-codec-tas: tas found, addr 0x%02x on %s\n", |
922 | addr, node->full_name); | 938 | (unsigned int)client->addr, node->full_name); |
923 | return 0; | 939 | return 0; |
924 | detach: | ||
925 | i2c_detach_client(&tas->i2c); | ||
926 | fail: | 940 | fail: |
927 | mutex_destroy(&tas->mtx); | 941 | mutex_destroy(&tas->mtx); |
928 | kfree(tas); | 942 | kfree(tas); |
@@ -970,14 +984,11 @@ static int tas_i2c_attach(struct i2c_adapter *adapter) | |||
970 | return -ENODEV; | 984 | return -ENODEV; |
971 | } | 985 | } |
972 | 986 | ||
973 | static int tas_i2c_detach(struct i2c_client *client) | 987 | static int tas_i2c_remove(struct i2c_client *client) |
974 | { | 988 | { |
975 | struct tas *tas = container_of(client, struct tas, i2c); | 989 | struct tas *tas = i2c_get_clientdata(client); |
976 | int err; | ||
977 | u8 tmp = TAS_ACR_ANALOG_PDOWN; | 990 | u8 tmp = TAS_ACR_ANALOG_PDOWN; |
978 | 991 | ||
979 | if ((err = i2c_detach_client(client))) | ||
980 | return err; | ||
981 | aoa_codec_unregister(&tas->codec); | 992 | aoa_codec_unregister(&tas->codec); |
982 | of_node_put(tas->codec.node); | 993 | of_node_put(tas->codec.node); |
983 | 994 | ||
@@ -989,13 +1000,20 @@ static int tas_i2c_detach(struct i2c_client *client) | |||
989 | return 0; | 1000 | return 0; |
990 | } | 1001 | } |
991 | 1002 | ||
1003 | static const struct i2c_device_id tas_i2c_id[] = { | ||
1004 | { "aoa_codec_tas", 0 }, | ||
1005 | { } | ||
1006 | }; | ||
1007 | |||
992 | static struct i2c_driver tas_driver = { | 1008 | static struct i2c_driver tas_driver = { |
993 | .driver = { | 1009 | .driver = { |
994 | .name = "aoa_codec_tas", | 1010 | .name = "aoa_codec_tas", |
995 | .owner = THIS_MODULE, | 1011 | .owner = THIS_MODULE, |
996 | }, | 1012 | }, |
997 | .attach_adapter = tas_i2c_attach, | 1013 | .attach_adapter = tas_i2c_attach, |
998 | .detach_client = tas_i2c_detach, | 1014 | .probe = tas_i2c_probe, |
1015 | .remove = tas_i2c_remove, | ||
1016 | .id_table = tas_i2c_id, | ||
999 | }; | 1017 | }; |
1000 | 1018 | ||
1001 | static int __init tas_init(void) | 1019 | static int __init tas_init(void) |
diff --git a/sound/arm/pxa2xx-ac97-lib.c b/sound/arm/pxa2xx-ac97-lib.c index 0afd1a8226fb..a2c12d105c9a 100644 --- a/sound/arm/pxa2xx-ac97-lib.c +++ b/sound/arm/pxa2xx-ac97-lib.c | |||
@@ -364,7 +364,7 @@ EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_resume); | |||
364 | int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev) | 364 | int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev) |
365 | { | 365 | { |
366 | int ret; | 366 | int ret; |
367 | struct pxa2xx_ac97_platform_data *pdata = dev->dev.platform_data; | 367 | pxa2xx_audio_ops_t *pdata = dev->dev.platform_data; |
368 | 368 | ||
369 | if (pdata) { | 369 | if (pdata) { |
370 | switch (pdata->reset_gpio) { | 370 | switch (pdata->reset_gpio) { |
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index 97ee127ac33d..78288dbfc17a 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c | |||
@@ -2122,7 +2122,7 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template, | |||
2122 | } | 2122 | } |
2123 | /* nothing should be in powerdown mode */ | 2123 | /* nothing should be in powerdown mode */ |
2124 | snd_ac97_write_cache(ac97, AC97_GENERAL_PURPOSE, 0); | 2124 | snd_ac97_write_cache(ac97, AC97_GENERAL_PURPOSE, 0); |
2125 | end_time = jiffies + msecs_to_jiffies(100); | 2125 | end_time = jiffies + msecs_to_jiffies(120); |
2126 | do { | 2126 | do { |
2127 | if ((snd_ac97_read(ac97, AC97_POWERDOWN) & 0x0f) == 0x0f) | 2127 | if ((snd_ac97_read(ac97, AC97_POWERDOWN) & 0x0f) == 0x0f) |
2128 | goto __ready_ok; | 2128 | goto __ready_ok; |
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c index 9ce8548c03e4..71515ddb4593 100644 --- a/sound/pci/atiixp.c +++ b/sound/pci/atiixp.c | |||
@@ -1393,6 +1393,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { | |||
1393 | .name = "HP nx6125", | 1393 | .name = "HP nx6125", |
1394 | .type = AC97_TUNE_MUTE_LED | 1394 | .type = AC97_TUNE_MUTE_LED |
1395 | }, | 1395 | }, |
1396 | { | ||
1397 | .subvendor = 0x103c, | ||
1398 | .subdevice = 0x3091, | ||
1399 | .name = "unknown HP", | ||
1400 | .type = AC97_TUNE_MUTE_LED | ||
1401 | }, | ||
1396 | { } /* terminator */ | 1402 | { } /* terminator */ |
1397 | }; | 1403 | }; |
1398 | 1404 | ||
diff --git a/sound/pci/emu10k1/io.c b/sound/pci/emu10k1/io.c index 4bfc31d1b281..c1a5aa15af8f 100644 --- a/sound/pci/emu10k1/io.c +++ b/sound/pci/emu10k1/io.c | |||
@@ -490,7 +490,7 @@ void snd_emu10k1_wait(struct snd_emu10k1 *emu, unsigned int wait) | |||
490 | if (newtime != curtime) | 490 | if (newtime != curtime) |
491 | break; | 491 | break; |
492 | } | 492 | } |
493 | if (count >= 16384) | 493 | if (count > 16384) |
494 | break; | 494 | break; |
495 | curtime = newtime; | 495 | curtime = newtime; |
496 | } | 496 | } |
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 5dced5b79387..173bebf9f51d 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c | |||
@@ -1854,6 +1854,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { | |||
1854 | }, | 1854 | }, |
1855 | { | 1855 | { |
1856 | .subvendor = 0x1028, | 1856 | .subvendor = 0x1028, |
1857 | .subdevice = 0x016a, | ||
1858 | .name = "Dell Inspiron 8600", /* STAC9750/51 */ | ||
1859 | .type = AC97_TUNE_HP_ONLY | ||
1860 | }, | ||
1861 | { | ||
1862 | .subvendor = 0x1028, | ||
1857 | .subdevice = 0x0186, | 1863 | .subdevice = 0x0186, |
1858 | .name = "Dell Latitude D810", /* cf. Malone #41015 */ | 1864 | .name = "Dell Latitude D810", /* cf. Malone #41015 */ |
1859 | .type = AC97_TUNE_HP_MUTE_LED | 1865 | .type = AC97_TUNE_HP_MUTE_LED |
@@ -1896,12 +1902,6 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { | |||
1896 | }, | 1902 | }, |
1897 | { | 1903 | { |
1898 | .subvendor = 0x103c, | 1904 | .subvendor = 0x103c, |
1899 | .subdevice = 0x0934, | ||
1900 | .name = "HP nx8220", | ||
1901 | .type = AC97_TUNE_MUTE_LED | ||
1902 | }, | ||
1903 | { | ||
1904 | .subvendor = 0x103c, | ||
1905 | .subdevice = 0x129d, | 1905 | .subdevice = 0x129d, |
1906 | .name = "HP xw8000", | 1906 | .name = "HP xw8000", |
1907 | .type = AC97_TUNE_HP_ONLY | 1907 | .type = AC97_TUNE_HP_ONLY |
@@ -2751,11 +2751,12 @@ static void __devinit intel8x0_measure_ac97_clock(struct intel8x0 *chip) | |||
2751 | if (pos == 0) { | 2751 | if (pos == 0) { |
2752 | snd_printk(KERN_ERR "intel8x0: measure - unreliable DMA position..\n"); | 2752 | snd_printk(KERN_ERR "intel8x0: measure - unreliable DMA position..\n"); |
2753 | __retry: | 2753 | __retry: |
2754 | if (attempt < 2) { | 2754 | if (attempt < 3) { |
2755 | msleep(300); | ||
2755 | attempt++; | 2756 | attempt++; |
2756 | goto __again; | 2757 | goto __again; |
2757 | } | 2758 | } |
2758 | return; | 2759 | goto __end; |
2759 | } | 2760 | } |
2760 | 2761 | ||
2761 | pos /= 4; | 2762 | pos /= 4; |
@@ -2782,6 +2783,7 @@ static void __devinit intel8x0_measure_ac97_clock(struct intel8x0 *chip) | |||
2782 | else if (pos < 47500 || pos > 48500) | 2783 | else if (pos < 47500 || pos > 48500) |
2783 | /* not 48000Hz, tuning the clock.. */ | 2784 | /* not 48000Hz, tuning the clock.. */ |
2784 | chip->ac97_bus->clock = (chip->ac97_bus->clock * 48000) / pos; | 2785 | chip->ac97_bus->clock = (chip->ac97_bus->clock * 48000) / pos; |
2786 | __end: | ||
2785 | printk(KERN_INFO "intel8x0: clocking to %d\n", chip->ac97_bus->clock); | 2787 | printk(KERN_INFO "intel8x0: clocking to %d\n", chip->ac97_bus->clock); |
2786 | snd_ac97_update_power(chip->ac97[0], AC97_PCM_FRONT_DAC_RATE, 0); | 2788 | snd_ac97_update_power(chip->ac97[0], AC97_PCM_FRONT_DAC_RATE, 0); |
2787 | } | 2789 | } |
diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c index 6ff99ed77516..a5afb2682e7f 100644 --- a/sound/ppc/keywest.c +++ b/sound/ppc/keywest.c | |||
@@ -33,26 +33,25 @@ | |||
33 | static struct pmac_keywest *keywest_ctx; | 33 | static struct pmac_keywest *keywest_ctx; |
34 | 34 | ||
35 | 35 | ||
36 | static int keywest_attach_adapter(struct i2c_adapter *adapter); | ||
37 | static int keywest_detach_client(struct i2c_client *client); | ||
38 | |||
39 | struct i2c_driver keywest_driver = { | ||
40 | .driver = { | ||
41 | .name = "PMac Keywest Audio", | ||
42 | }, | ||
43 | .attach_adapter = &keywest_attach_adapter, | ||
44 | .detach_client = &keywest_detach_client, | ||
45 | }; | ||
46 | |||
47 | |||
48 | #ifndef i2c_device_name | 36 | #ifndef i2c_device_name |
49 | #define i2c_device_name(x) ((x)->name) | 37 | #define i2c_device_name(x) ((x)->name) |
50 | #endif | 38 | #endif |
51 | 39 | ||
40 | static int keywest_probe(struct i2c_client *client, | ||
41 | const struct i2c_device_id *id) | ||
42 | { | ||
43 | i2c_set_clientdata(client, keywest_ctx); | ||
44 | return 0; | ||
45 | } | ||
46 | |||
47 | /* | ||
48 | * This is kind of a hack, best would be to turn powermac to fixed i2c | ||
49 | * bus numbers and declare the sound device as part of platform | ||
50 | * initialization | ||
51 | */ | ||
52 | static int keywest_attach_adapter(struct i2c_adapter *adapter) | 52 | static int keywest_attach_adapter(struct i2c_adapter *adapter) |
53 | { | 53 | { |
54 | int err; | 54 | struct i2c_board_info info; |
55 | struct i2c_client *new_client; | ||
56 | 55 | ||
57 | if (! keywest_ctx) | 56 | if (! keywest_ctx) |
58 | return -EINVAL; | 57 | return -EINVAL; |
@@ -60,46 +59,47 @@ static int keywest_attach_adapter(struct i2c_adapter *adapter) | |||
60 | if (strncmp(i2c_device_name(adapter), "mac-io", 6)) | 59 | if (strncmp(i2c_device_name(adapter), "mac-io", 6)) |
61 | return 0; /* ignored */ | 60 | return 0; /* ignored */ |
62 | 61 | ||
63 | new_client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); | 62 | memset(&info, 0, sizeof(struct i2c_board_info)); |
64 | if (! new_client) | 63 | strlcpy(info.type, "keywest", I2C_NAME_SIZE); |
65 | return -ENOMEM; | 64 | info.addr = keywest_ctx->addr; |
66 | 65 | keywest_ctx->client = i2c_new_device(adapter, &info); | |
67 | new_client->addr = keywest_ctx->addr; | ||
68 | i2c_set_clientdata(new_client, keywest_ctx); | ||
69 | new_client->adapter = adapter; | ||
70 | new_client->driver = &keywest_driver; | ||
71 | new_client->flags = 0; | ||
72 | |||
73 | strcpy(i2c_device_name(new_client), keywest_ctx->name); | ||
74 | keywest_ctx->client = new_client; | ||
75 | 66 | ||
76 | /* Tell the i2c layer a new client has arrived */ | 67 | /* |
77 | if (i2c_attach_client(new_client)) { | 68 | * Let i2c-core delete that device on driver removal. |
78 | snd_printk(KERN_ERR "tumbler: cannot attach i2c client\n"); | 69 | * This is safe because i2c-core holds the core_lock mutex for us. |
79 | err = -ENODEV; | 70 | */ |
80 | goto __err; | 71 | list_add_tail(&keywest_ctx->client->detected, |
81 | } | 72 | &keywest_ctx->client->driver->clients); |
82 | |||
83 | return 0; | 73 | return 0; |
84 | |||
85 | __err: | ||
86 | kfree(new_client); | ||
87 | keywest_ctx->client = NULL; | ||
88 | return err; | ||
89 | } | 74 | } |
90 | 75 | ||
91 | static int keywest_detach_client(struct i2c_client *client) | 76 | static int keywest_remove(struct i2c_client *client) |
92 | { | 77 | { |
78 | i2c_set_clientdata(client, NULL); | ||
93 | if (! keywest_ctx) | 79 | if (! keywest_ctx) |
94 | return 0; | 80 | return 0; |
95 | if (client == keywest_ctx->client) | 81 | if (client == keywest_ctx->client) |
96 | keywest_ctx->client = NULL; | 82 | keywest_ctx->client = NULL; |
97 | 83 | ||
98 | i2c_detach_client(client); | ||
99 | kfree(client); | ||
100 | return 0; | 84 | return 0; |
101 | } | 85 | } |
102 | 86 | ||
87 | |||
88 | static const struct i2c_device_id keywest_i2c_id[] = { | ||
89 | { "keywest", 0 }, | ||
90 | { } | ||
91 | }; | ||
92 | |||
93 | struct i2c_driver keywest_driver = { | ||
94 | .driver = { | ||
95 | .name = "PMac Keywest Audio", | ||
96 | }, | ||
97 | .attach_adapter = keywest_attach_adapter, | ||
98 | .probe = keywest_probe, | ||
99 | .remove = keywest_remove, | ||
100 | .id_table = keywest_i2c_id, | ||
101 | }; | ||
102 | |||
103 | /* exported */ | 103 | /* exported */ |
104 | void snd_pmac_keywest_cleanup(struct pmac_keywest *i2c) | 104 | void snd_pmac_keywest_cleanup(struct pmac_keywest *i2c) |
105 | { | 105 | { |
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index 030d2454725f..f2653803ede8 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile | |||
@@ -56,7 +56,6 @@ obj-$(CONFIG_SND_SOC_WM8900) += snd-soc-wm8900.o | |||
56 | obj-$(CONFIG_SND_SOC_WM8903) += snd-soc-wm8903.o | 56 | obj-$(CONFIG_SND_SOC_WM8903) += snd-soc-wm8903.o |
57 | obj-$(CONFIG_SND_SOC_WM8971) += snd-soc-wm8971.o | 57 | obj-$(CONFIG_SND_SOC_WM8971) += snd-soc-wm8971.o |
58 | obj-$(CONFIG_SND_SOC_WM8990) += snd-soc-wm8990.o | 58 | obj-$(CONFIG_SND_SOC_WM8990) += snd-soc-wm8990.o |
59 | obj-$(CONFIG_SND_SOC_WM8991) += snd-soc-wm8991.o | ||
60 | obj-$(CONFIG_SND_SOC_WM9705) += snd-soc-wm9705.o | 59 | obj-$(CONFIG_SND_SOC_WM9705) += snd-soc-wm9705.o |
61 | obj-$(CONFIG_SND_SOC_WM9712) += snd-soc-wm9712.o | 60 | obj-$(CONFIG_SND_SOC_WM9712) += snd-soc-wm9712.o |
62 | obj-$(CONFIG_SND_SOC_WM9713) += snd-soc-wm9713.o | 61 | obj-$(CONFIG_SND_SOC_WM9713) += snd-soc-wm9713.o |
diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c index 442ea6f160fc..9f6be3d31ac0 100644 --- a/sound/soc/codecs/wm8580.c +++ b/sound/soc/codecs/wm8580.c | |||
@@ -268,9 +268,11 @@ static const DECLARE_TLV_DB_SCALE(dac_tlv, -12750, 50, 1); | |||
268 | static int wm8580_out_vu(struct snd_kcontrol *kcontrol, | 268 | static int wm8580_out_vu(struct snd_kcontrol *kcontrol, |
269 | struct snd_ctl_elem_value *ucontrol) | 269 | struct snd_ctl_elem_value *ucontrol) |
270 | { | 270 | { |
271 | struct soc_mixer_control *mc = | ||
272 | (struct soc_mixer_control *)kcontrol->private_value; | ||
271 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 273 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
272 | int reg = kcontrol->private_value & 0xff; | 274 | unsigned int reg = mc->reg; |
273 | int reg2 = (kcontrol->private_value >> 24) & 0xff; | 275 | unsigned int reg2 = mc->rreg; |
274 | int ret; | 276 | int ret; |
275 | u16 val; | 277 | u16 val; |
276 | 278 | ||
@@ -292,15 +294,17 @@ static int wm8580_out_vu(struct snd_kcontrol *kcontrol, | |||
292 | return 0; | 294 | return 0; |
293 | } | 295 | } |
294 | 296 | ||
295 | #define SOC_WM8580_OUT_DOUBLE_R_TLV(xname, reg_left, reg_right, shift, max, invert, tlv_array) \ | 297 | #define SOC_WM8580_OUT_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, \ |
298 | xinvert, tlv_array) \ | ||
296 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ | 299 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ |
297 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ | 300 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ |
298 | SNDRV_CTL_ELEM_ACCESS_READWRITE, \ | 301 | SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
299 | .tlv.p = (tlv_array), \ | 302 | .tlv.p = (tlv_array), \ |
300 | .info = snd_soc_info_volsw_2r, \ | 303 | .info = snd_soc_info_volsw_2r, \ |
301 | .get = snd_soc_get_volsw_2r, .put = wm8580_out_vu, \ | 304 | .get = snd_soc_get_volsw_2r, .put = wm8580_out_vu, \ |
302 | .private_value = (reg_left) | ((shift) << 8) | \ | 305 | .private_value = (unsigned long)&(struct soc_mixer_control) \ |
303 | ((max) << 12) | ((invert) << 20) | ((reg_right) << 24) } | 306 | {.reg = reg_left, .rreg = reg_right, .shift = xshift, \ |
307 | .max = xmax, .invert = xinvert} } | ||
304 | 308 | ||
305 | static const struct snd_kcontrol_new wm8580_snd_controls[] = { | 309 | static const struct snd_kcontrol_new wm8580_snd_controls[] = { |
306 | SOC_WM8580_OUT_DOUBLE_R_TLV("DAC1 Playback Volume", | 310 | SOC_WM8580_OUT_DOUBLE_R_TLV("DAC1 Playback Volume", |
@@ -522,7 +526,7 @@ static int wm8580_set_dai_pll(struct snd_soc_dai *codec_dai, | |||
522 | reg = wm8580_read(codec, WM8580_PLLA4 + offset); | 526 | reg = wm8580_read(codec, WM8580_PLLA4 + offset); |
523 | reg &= ~0x3f; | 527 | reg &= ~0x3f; |
524 | reg |= pll_div.prescale | pll_div.postscale << 1 | | 528 | reg |= pll_div.prescale | pll_div.postscale << 1 | |
525 | pll_div.freqmode << 4; | 529 | pll_div.freqmode << 3; |
526 | 530 | ||
527 | wm8580_write(codec, WM8580_PLLA4 + offset, reg); | 531 | wm8580_write(codec, WM8580_PLLA4 + offset, reg); |
528 | 532 | ||
diff --git a/sound/soc/codecs/wm9705.c b/sound/soc/codecs/wm9705.c index 6e23a81dba78..c2d1a7a18fa3 100644 --- a/sound/soc/codecs/wm9705.c +++ b/sound/soc/codecs/wm9705.c | |||
@@ -318,7 +318,7 @@ static int wm9705_reset(struct snd_soc_codec *codec) | |||
318 | } | 318 | } |
319 | 319 | ||
320 | #ifdef CONFIG_PM | 320 | #ifdef CONFIG_PM |
321 | static int wm9705_soc_suspend(struct platform_device *pdev) | 321 | static int wm9705_soc_suspend(struct platform_device *pdev, pm_message_t msg) |
322 | { | 322 | { |
323 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 323 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
324 | struct snd_soc_codec *codec = socdev->card->codec; | 324 | struct snd_soc_codec *codec = socdev->card->codec; |
diff --git a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c index a6d1178ce128..91ef17992de5 100644 --- a/sound/soc/omap/n810.c +++ b/sound/soc/omap/n810.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2008 Nokia Corporation | 4 | * Copyright (C) 2008 Nokia Corporation |
5 | * | 5 | * |
6 | * Contact: Jarkko Nikula <jarkko.nikula@nokia.com> | 6 | * Contact: Jarkko Nikula <jhnikula@gmail.com> |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or | 8 | * This program is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU General Public License | 9 | * modify it under the terms of the GNU General Public License |
@@ -417,6 +417,6 @@ static void __exit n810_soc_exit(void) | |||
417 | module_init(n810_soc_init); | 417 | module_init(n810_soc_init); |
418 | module_exit(n810_soc_exit); | 418 | module_exit(n810_soc_exit); |
419 | 419 | ||
420 | MODULE_AUTHOR("Jarkko Nikula <jarkko.nikula@nokia.com>"); | 420 | MODULE_AUTHOR("Jarkko Nikula <jhnikula@gmail.com>"); |
421 | MODULE_DESCRIPTION("ALSA SoC Nokia N810"); | 421 | MODULE_DESCRIPTION("ALSA SoC Nokia N810"); |
422 | MODULE_LICENSE("GPL"); | 422 | MODULE_LICENSE("GPL"); |
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index 9c09b94f0cf8..912614283848 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c | |||
@@ -3,7 +3,8 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2008 Nokia Corporation | 4 | * Copyright (C) 2008 Nokia Corporation |
5 | * | 5 | * |
6 | * Contact: Jarkko Nikula <jarkko.nikula@nokia.com> | 6 | * Contact: Jarkko Nikula <jhnikula@gmail.com> |
7 | * Peter Ujfalusi <peter.ujfalusi@nokia.com> | ||
7 | * | 8 | * |
8 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU General Public License | 10 | * modify it under the terms of the GNU General Public License |
@@ -283,7 +284,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, | |||
283 | break; | 284 | break; |
284 | case SND_SOC_DAIFMT_DSP_B: | 285 | case SND_SOC_DAIFMT_DSP_B: |
285 | regs->srgr2 |= FPER(wlen * channels - 1); | 286 | regs->srgr2 |= FPER(wlen * channels - 1); |
286 | regs->srgr1 |= FWID(wlen * channels - 2); | 287 | regs->srgr1 |= FWID(0); |
287 | break; | 288 | break; |
288 | } | 289 | } |
289 | 290 | ||
@@ -302,6 +303,7 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
302 | { | 303 | { |
303 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); | 304 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); |
304 | struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; | 305 | struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; |
306 | unsigned int temp_fmt = fmt; | ||
305 | 307 | ||
306 | if (mcbsp_data->configured) | 308 | if (mcbsp_data->configured) |
307 | return 0; | 309 | return 0; |
@@ -328,6 +330,8 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
328 | /* 0-bit data delay */ | 330 | /* 0-bit data delay */ |
329 | regs->rcr2 |= RDATDLY(0); | 331 | regs->rcr2 |= RDATDLY(0); |
330 | regs->xcr2 |= XDATDLY(0); | 332 | regs->xcr2 |= XDATDLY(0); |
333 | /* Invert FS polarity configuration */ | ||
334 | temp_fmt ^= SND_SOC_DAIFMT_NB_IF; | ||
331 | break; | 335 | break; |
332 | default: | 336 | default: |
333 | /* Unsupported data format */ | 337 | /* Unsupported data format */ |
@@ -351,7 +355,7 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
351 | } | 355 | } |
352 | 356 | ||
353 | /* Set bit clock (CLKX/CLKR) and FS polarities */ | 357 | /* Set bit clock (CLKX/CLKR) and FS polarities */ |
354 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { | 358 | switch (temp_fmt & SND_SOC_DAIFMT_INV_MASK) { |
355 | case SND_SOC_DAIFMT_NB_NF: | 359 | case SND_SOC_DAIFMT_NB_NF: |
356 | /* | 360 | /* |
357 | * Normal BCLK + FS. | 361 | * Normal BCLK + FS. |
@@ -529,6 +533,6 @@ static void __exit snd_omap_mcbsp_exit(void) | |||
529 | } | 533 | } |
530 | module_exit(snd_omap_mcbsp_exit); | 534 | module_exit(snd_omap_mcbsp_exit); |
531 | 535 | ||
532 | MODULE_AUTHOR("Jarkko Nikula <jarkko.nikula@nokia.com>"); | 536 | MODULE_AUTHOR("Jarkko Nikula <jhnikula@gmail.com>"); |
533 | MODULE_DESCRIPTION("OMAP I2S SoC Interface"); | 537 | MODULE_DESCRIPTION("OMAP I2S SoC Interface"); |
534 | MODULE_LICENSE("GPL"); | 538 | MODULE_LICENSE("GPL"); |
diff --git a/sound/soc/omap/omap-mcbsp.h b/sound/soc/omap/omap-mcbsp.h index df7ad13ba73d..c8147aace813 100644 --- a/sound/soc/omap/omap-mcbsp.h +++ b/sound/soc/omap/omap-mcbsp.h | |||
@@ -3,7 +3,8 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2008 Nokia Corporation | 4 | * Copyright (C) 2008 Nokia Corporation |
5 | * | 5 | * |
6 | * Contact: Jarkko Nikula <jarkko.nikula@nokia.com> | 6 | * Contact: Jarkko Nikula <jhnikula@gmail.com> |
7 | * Peter Ujfalusi <peter.ujfalusi@nokia.com> | ||
7 | * | 8 | * |
8 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU General Public License | 10 | * modify it under the terms of the GNU General Public License |
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c index 1bdbb0427183..07cf7f46b584 100644 --- a/sound/soc/omap/omap-pcm.c +++ b/sound/soc/omap/omap-pcm.c | |||
@@ -3,7 +3,8 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2008 Nokia Corporation | 4 | * Copyright (C) 2008 Nokia Corporation |
5 | * | 5 | * |
6 | * Contact: Jarkko Nikula <jarkko.nikula@nokia.com> | 6 | * Contact: Jarkko Nikula <jhnikula@gmail.com> |
7 | * Peter Ujfalusi <peter.ujfalusi@nokia.com> | ||
7 | * | 8 | * |
8 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU General Public License | 10 | * modify it under the terms of the GNU General Public License |
@@ -367,6 +368,6 @@ static void __exit omap_soc_platform_exit(void) | |||
367 | } | 368 | } |
368 | module_exit(omap_soc_platform_exit); | 369 | module_exit(omap_soc_platform_exit); |
369 | 370 | ||
370 | MODULE_AUTHOR("Jarkko Nikula <jarkko.nikula@nokia.com>"); | 371 | MODULE_AUTHOR("Jarkko Nikula <jhnikula@gmail.com>"); |
371 | MODULE_DESCRIPTION("OMAP PCM DMA module"); | 372 | MODULE_DESCRIPTION("OMAP PCM DMA module"); |
372 | MODULE_LICENSE("GPL"); | 373 | MODULE_LICENSE("GPL"); |
diff --git a/sound/soc/omap/omap-pcm.h b/sound/soc/omap/omap-pcm.h index e4369bdfd77d..8d9d26916b05 100644 --- a/sound/soc/omap/omap-pcm.h +++ b/sound/soc/omap/omap-pcm.h | |||
@@ -3,7 +3,8 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2008 Nokia Corporation | 4 | * Copyright (C) 2008 Nokia Corporation |
5 | * | 5 | * |
6 | * Contact: Jarkko Nikula <jarkko.nikula@nokia.com> | 6 | * Contact: Jarkko Nikula <jhnikula@gmail.com> |
7 | * Peter Ujfalusi <peter.ujfalusi@nokia.com> | ||
7 | * | 8 | * |
8 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU General Public License | 10 | * modify it under the terms of the GNU General Public License |
diff --git a/sound/soc/omap/osk5912.c b/sound/soc/omap/osk5912.c index a952a4eb3361..a4e149b7f0eb 100644 --- a/sound/soc/omap/osk5912.c +++ b/sound/soc/omap/osk5912.c | |||
@@ -62,7 +62,7 @@ static int osk_hw_params(struct snd_pcm_substream *substream, | |||
62 | /* Set codec DAI configuration */ | 62 | /* Set codec DAI configuration */ |
63 | err = snd_soc_dai_set_fmt(codec_dai, | 63 | err = snd_soc_dai_set_fmt(codec_dai, |
64 | SND_SOC_DAIFMT_DSP_B | | 64 | SND_SOC_DAIFMT_DSP_B | |
65 | SND_SOC_DAIFMT_NB_IF | | 65 | SND_SOC_DAIFMT_NB_NF | |
66 | SND_SOC_DAIFMT_CBM_CFM); | 66 | SND_SOC_DAIFMT_CBM_CFM); |
67 | if (err < 0) { | 67 | if (err < 0) { |
68 | printk(KERN_ERR "can't set codec DAI configuration\n"); | 68 | printk(KERN_ERR "can't set codec DAI configuration\n"); |
@@ -72,7 +72,7 @@ static int osk_hw_params(struct snd_pcm_substream *substream, | |||
72 | /* Set cpu DAI configuration */ | 72 | /* Set cpu DAI configuration */ |
73 | err = snd_soc_dai_set_fmt(cpu_dai, | 73 | err = snd_soc_dai_set_fmt(cpu_dai, |
74 | SND_SOC_DAIFMT_DSP_B | | 74 | SND_SOC_DAIFMT_DSP_B | |
75 | SND_SOC_DAIFMT_NB_IF | | 75 | SND_SOC_DAIFMT_NB_NF | |
76 | SND_SOC_DAIFMT_CBM_CFM); | 76 | SND_SOC_DAIFMT_CBM_CFM); |
77 | if (err < 0) { | 77 | if (err < 0) { |
78 | printk(KERN_ERR "can't set cpu DAI configuration\n"); | 78 | printk(KERN_ERR "can't set cpu DAI configuration\n"); |
diff --git a/sound/soc/pxa/palm27x.c b/sound/soc/pxa/palm27x.c index 48a73f64500b..44fcc4e01e08 100644 --- a/sound/soc/pxa/palm27x.c +++ b/sound/soc/pxa/palm27x.c | |||
@@ -200,7 +200,7 @@ static struct snd_soc_device palm27x_snd_devdata = { | |||
200 | 200 | ||
201 | static struct platform_device *palm27x_snd_device; | 201 | static struct platform_device *palm27x_snd_device; |
202 | 202 | ||
203 | static int __init palm27x_asoc_init(void) | 203 | static int palm27x_asoc_probe(struct platform_device *pdev) |
204 | { | 204 | { |
205 | int ret; | 205 | int ret; |
206 | 206 | ||
@@ -208,6 +208,10 @@ static int __init palm27x_asoc_init(void) | |||
208 | machine_is_palmld())) | 208 | machine_is_palmld())) |
209 | return -ENODEV; | 209 | return -ENODEV; |
210 | 210 | ||
211 | if (pdev->dev.platform_data) | ||
212 | palm27x_ep_gpio = ((struct palm27x_asoc_info *) | ||
213 | (pdev->dev.platform_data))->jack_gpio; | ||
214 | |||
211 | ret = gpio_request(palm27x_ep_gpio, "Headphone Jack"); | 215 | ret = gpio_request(palm27x_ep_gpio, "Headphone Jack"); |
212 | if (ret) | 216 | if (ret) |
213 | return ret; | 217 | return ret; |
@@ -245,16 +249,31 @@ err_alloc: | |||
245 | return ret; | 249 | return ret; |
246 | } | 250 | } |
247 | 251 | ||
248 | static void __exit palm27x_asoc_exit(void) | 252 | static int __devexit palm27x_asoc_remove(struct platform_device *pdev) |
249 | { | 253 | { |
250 | free_irq(gpio_to_irq(palm27x_ep_gpio), NULL); | 254 | free_irq(gpio_to_irq(palm27x_ep_gpio), NULL); |
251 | gpio_free(palm27x_ep_gpio); | 255 | gpio_free(palm27x_ep_gpio); |
252 | platform_device_unregister(palm27x_snd_device); | 256 | platform_device_unregister(palm27x_snd_device); |
257 | return 0; | ||
253 | } | 258 | } |
254 | 259 | ||
255 | void __init palm27x_asoc_set_pdata(struct palm27x_asoc_info *data) | 260 | static struct platform_driver palm27x_wm9712_driver = { |
261 | .probe = palm27x_asoc_probe, | ||
262 | .remove = __devexit_p(palm27x_asoc_remove), | ||
263 | .driver = { | ||
264 | .name = "palm27x-asoc", | ||
265 | .owner = THIS_MODULE, | ||
266 | }, | ||
267 | }; | ||
268 | |||
269 | static int __init palm27x_asoc_init(void) | ||
270 | { | ||
271 | return platform_driver_register(&palm27x_wm9712_driver); | ||
272 | } | ||
273 | |||
274 | static void __exit palm27x_asoc_exit(void) | ||
256 | { | 275 | { |
257 | palm27x_ep_gpio = data->jack_gpio; | 276 | platform_driver_unregister(&palm27x_wm9712_driver); |
258 | } | 277 | } |
259 | 278 | ||
260 | module_init(palm27x_asoc_init); | 279 | module_init(palm27x_asoc_init); |
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c index 308a657928d2..286be31545df 100644 --- a/sound/soc/pxa/pxa-ssp.c +++ b/sound/soc/pxa/pxa-ssp.c | |||
@@ -280,12 +280,33 @@ static int pxa_ssp_resume(struct snd_soc_dai *cpu_dai) | |||
280 | * ssp_set_clkdiv - set SSP clock divider | 280 | * ssp_set_clkdiv - set SSP clock divider |
281 | * @div: serial clock rate divider | 281 | * @div: serial clock rate divider |
282 | */ | 282 | */ |
283 | static void ssp_set_scr(struct ssp_dev *dev, u32 div) | 283 | static void ssp_set_scr(struct ssp_device *ssp, u32 div) |
284 | { | 284 | { |
285 | struct ssp_device *ssp = dev->ssp; | 285 | u32 sscr0 = ssp_read_reg(ssp, SSCR0); |
286 | u32 sscr0 = ssp_read_reg(dev->ssp, SSCR0) & ~SSCR0_SCR; | 286 | |
287 | if (cpu_is_pxa25x() && ssp->type == PXA25x_SSP) { | ||
288 | sscr0 &= ~0x0000ff00; | ||
289 | sscr0 |= ((div - 2)/2) << 8; /* 2..512 */ | ||
290 | } else { | ||
291 | sscr0 &= ~0x000fff00; | ||
292 | sscr0 |= (div - 1) << 8; /* 1..4096 */ | ||
293 | } | ||
294 | ssp_write_reg(ssp, SSCR0, sscr0); | ||
295 | } | ||
296 | |||
297 | /** | ||
298 | * ssp_get_clkdiv - get SSP clock divider | ||
299 | */ | ||
300 | static u32 ssp_get_scr(struct ssp_device *ssp) | ||
301 | { | ||
302 | u32 sscr0 = ssp_read_reg(ssp, SSCR0); | ||
303 | u32 div; | ||
287 | 304 | ||
288 | ssp_write_reg(ssp, SSCR0, (sscr0 | SSCR0_SerClkDiv(div))); | 305 | if (cpu_is_pxa25x() && ssp->type == PXA25x_SSP) |
306 | div = ((sscr0 >> 8) & 0xff) * 2 + 2; | ||
307 | else | ||
308 | div = ((sscr0 >> 8) & 0xfff) + 1; | ||
309 | return div; | ||
289 | } | 310 | } |
290 | 311 | ||
291 | /* | 312 | /* |
@@ -326,7 +347,7 @@ static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai, | |||
326 | break; | 347 | break; |
327 | case PXA_SSP_CLK_AUDIO: | 348 | case PXA_SSP_CLK_AUDIO: |
328 | priv->sysclk = 0; | 349 | priv->sysclk = 0; |
329 | ssp_set_scr(&priv->dev, 1); | 350 | ssp_set_scr(ssp, 1); |
330 | sscr0 |= SSCR0_ACS; | 351 | sscr0 |= SSCR0_ACS; |
331 | break; | 352 | break; |
332 | default: | 353 | default: |
@@ -387,7 +408,7 @@ static int pxa_ssp_set_dai_clkdiv(struct snd_soc_dai *cpu_dai, | |||
387 | ssp_write_reg(ssp, SSACD, val); | 408 | ssp_write_reg(ssp, SSACD, val); |
388 | break; | 409 | break; |
389 | case PXA_SSP_DIV_SCR: | 410 | case PXA_SSP_DIV_SCR: |
390 | ssp_set_scr(&priv->dev, div); | 411 | ssp_set_scr(ssp, div); |
391 | break; | 412 | break; |
392 | default: | 413 | default: |
393 | return -ENODEV; | 414 | return -ENODEV; |
@@ -674,8 +695,7 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream, | |||
674 | case SND_SOC_DAIFMT_I2S: | 695 | case SND_SOC_DAIFMT_I2S: |
675 | sspsp = ssp_read_reg(ssp, SSPSP); | 696 | sspsp = ssp_read_reg(ssp, SSPSP); |
676 | 697 | ||
677 | if (((sscr0 & SSCR0_SCR) == SSCR0_SerClkDiv(4)) && | 698 | if ((ssp_get_scr(ssp) == 4) && (width == 16)) { |
678 | (width == 16)) { | ||
679 | /* This is a special case where the bitclk is 64fs | 699 | /* This is a special case where the bitclk is 64fs |
680 | * and we're not dealing with 2*32 bits of audio | 700 | * and we're not dealing with 2*32 bits of audio |
681 | * samples. | 701 | * samples. |
@@ -806,6 +826,7 @@ static int pxa_ssp_probe(struct platform_device *pdev, | |||
806 | goto err_priv; | 826 | goto err_priv; |
807 | } | 827 | } |
808 | 828 | ||
829 | priv->dai_fmt = (unsigned int) -1; | ||
809 | dai->private_data = priv; | 830 | dai->private_data = priv; |
810 | 831 | ||
811 | return 0; | 832 | return 0; |
diff --git a/sound/soc/s3c24xx/jive_wm8750.c b/sound/soc/s3c24xx/jive_wm8750.c index 32063790d95b..93e6c87b7399 100644 --- a/sound/soc/s3c24xx/jive_wm8750.c +++ b/sound/soc/s3c24xx/jive_wm8750.c | |||
@@ -69,8 +69,8 @@ static int jive_hw_params(struct snd_pcm_substream *substream, | |||
69 | break; | 69 | break; |
70 | } | 70 | } |
71 | 71 | ||
72 | s3c_i2sv2_calc_rate(&div, NULL, params_rate(params), | 72 | s3c_i2sv2_iis_calc_rate(&div, NULL, params_rate(params), |
73 | s3c2412_get_iisclk()); | 73 | s3c2412_get_iisclk()); |
74 | 74 | ||
75 | /* set codec DAI configuration */ | 75 | /* set codec DAI configuration */ |
76 | ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | | 76 | ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | |
@@ -145,8 +145,9 @@ static struct snd_soc_dai_link jive_dai = { | |||
145 | }; | 145 | }; |
146 | 146 | ||
147 | /* jive audio machine driver */ | 147 | /* jive audio machine driver */ |
148 | static struct snd_soc_machine snd_soc_machine_jive = { | 148 | static struct snd_soc_card snd_soc_machine_jive = { |
149 | .name = "Jive", | 149 | .name = "Jive", |
150 | .platform = &s3c24xx_soc_platform, | ||
150 | .dai_link = &jive_dai, | 151 | .dai_link = &jive_dai, |
151 | .num_links = 1, | 152 | .num_links = 1, |
152 | }; | 153 | }; |
@@ -157,9 +158,8 @@ static struct wm8750_setup_data jive_wm8750_setup = { | |||
157 | 158 | ||
158 | /* jive audio subsystem */ | 159 | /* jive audio subsystem */ |
159 | static struct snd_soc_device jive_snd_devdata = { | 160 | static struct snd_soc_device jive_snd_devdata = { |
160 | .machine = &snd_soc_machine_jive, | 161 | .card = &snd_soc_machine_jive, |
161 | .platform = &s3c24xx_soc_platform, | 162 | .codec_dev = &soc_codec_dev_wm8750, |
162 | .codec_dev = &soc_codec_dev_wm8750_spi, | ||
163 | .codec_data = &jive_wm8750_setup, | 163 | .codec_data = &jive_wm8750_setup, |
164 | }; | 164 | }; |
165 | 165 | ||
diff --git a/sound/soc/s3c24xx/s3c-i2s-v2.c b/sound/soc/s3c24xx/s3c-i2s-v2.c index 295a4c910262..ab680aac3fcb 100644 --- a/sound/soc/s3c24xx/s3c-i2s-v2.c +++ b/sound/soc/s3c24xx/s3c-i2s-v2.c | |||
@@ -473,9 +473,9 @@ static int s3c2412_i2s_set_clkdiv(struct snd_soc_dai *cpu_dai, | |||
473 | /* default table of all avaialable root fs divisors */ | 473 | /* default table of all avaialable root fs divisors */ |
474 | static unsigned int iis_fs_tab[] = { 256, 512, 384, 768 }; | 474 | static unsigned int iis_fs_tab[] = { 256, 512, 384, 768 }; |
475 | 475 | ||
476 | int s3c2412_iis_calc_rate(struct s3c_i2sv2_rate_calc *info, | 476 | int s3c_i2sv2_iis_calc_rate(struct s3c_i2sv2_rate_calc *info, |
477 | unsigned int *fstab, | 477 | unsigned int *fstab, |
478 | unsigned int rate, struct clk *clk) | 478 | unsigned int rate, struct clk *clk) |
479 | { | 479 | { |
480 | unsigned long clkrate = clk_get_rate(clk); | 480 | unsigned long clkrate = clk_get_rate(clk); |
481 | unsigned int div; | 481 | unsigned int div; |
@@ -531,7 +531,7 @@ int s3c2412_iis_calc_rate(struct s3c_i2sv2_rate_calc *info, | |||
531 | 531 | ||
532 | return 0; | 532 | return 0; |
533 | } | 533 | } |
534 | EXPORT_SYMBOL_GPL(s3c2412_iis_calc_rate); | 534 | EXPORT_SYMBOL_GPL(s3c_i2sv2_iis_calc_rate); |
535 | 535 | ||
536 | int s3c_i2sv2_probe(struct platform_device *pdev, | 536 | int s3c_i2sv2_probe(struct platform_device *pdev, |
537 | struct snd_soc_dai *dai, | 537 | struct snd_soc_dai *dai, |
@@ -624,15 +624,18 @@ static int s3c2412_i2s_resume(struct snd_soc_dai *dai) | |||
624 | 624 | ||
625 | int s3c_i2sv2_register_dai(struct snd_soc_dai *dai) | 625 | int s3c_i2sv2_register_dai(struct snd_soc_dai *dai) |
626 | { | 626 | { |
627 | dai->ops.trigger = s3c2412_i2s_trigger; | 627 | struct snd_soc_dai_ops *ops = dai->ops; |
628 | dai->ops.hw_params = s3c2412_i2s_hw_params; | 628 | |
629 | dai->ops.set_fmt = s3c2412_i2s_set_fmt; | 629 | ops->trigger = s3c2412_i2s_trigger; |
630 | dai->ops.set_clkdiv = s3c2412_i2s_set_clkdiv; | 630 | ops->hw_params = s3c2412_i2s_hw_params; |
631 | ops->set_fmt = s3c2412_i2s_set_fmt; | ||
632 | ops->set_clkdiv = s3c2412_i2s_set_clkdiv; | ||
631 | 633 | ||
632 | dai->suspend = s3c2412_i2s_suspend; | 634 | dai->suspend = s3c2412_i2s_suspend; |
633 | dai->resume = s3c2412_i2s_resume; | 635 | dai->resume = s3c2412_i2s_resume; |
634 | 636 | ||
635 | return snd_soc_register_dai(dai); | 637 | return snd_soc_register_dai(dai); |
636 | } | 638 | } |
637 | |||
638 | EXPORT_SYMBOL_GPL(s3c_i2sv2_register_dai); | 639 | EXPORT_SYMBOL_GPL(s3c_i2sv2_register_dai); |
640 | |||
641 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/s3c24xx/s3c2412-i2s.c b/sound/soc/s3c24xx/s3c2412-i2s.c index 1ca3cdaa8213..b7e0b3f0bfc8 100644 --- a/sound/soc/s3c24xx/s3c2412-i2s.c +++ b/sound/soc/s3c24xx/s3c2412-i2s.c | |||
@@ -33,8 +33,8 @@ | |||
33 | 33 | ||
34 | #include <plat/regs-s3c2412-iis.h> | 34 | #include <plat/regs-s3c2412-iis.h> |
35 | 35 | ||
36 | #include <plat/regs-gpio.h> | ||
37 | #include <plat/audio.h> | 36 | #include <plat/audio.h> |
37 | #include <mach/regs-gpio.h> | ||
38 | #include <mach/dma.h> | 38 | #include <mach/dma.h> |
39 | 39 | ||
40 | #include "s3c24xx-pcm.h" | 40 | #include "s3c24xx-pcm.h" |
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c index 012ff1f6f8af..a5aae9d67f31 100644 --- a/sound/usb/usx2y/us122l.c +++ b/sound/usb/usx2y/us122l.c | |||
@@ -474,6 +474,14 @@ static bool us122l_create_card(struct snd_card *card) | |||
474 | return true; | 474 | return true; |
475 | } | 475 | } |
476 | 476 | ||
477 | static void snd_us122l_free(struct snd_card *card) | ||
478 | { | ||
479 | struct us122l *us122l = US122L(card); | ||
480 | int index = us122l->chip.index; | ||
481 | if (index >= 0 && index < SNDRV_CARDS) | ||
482 | snd_us122l_card_used[index] = 0; | ||
483 | } | ||
484 | |||
477 | static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp) | 485 | static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp) |
478 | { | 486 | { |
479 | int dev; | 487 | int dev; |
@@ -490,7 +498,7 @@ static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp) | |||
490 | if (err < 0) | 498 | if (err < 0) |
491 | return err; | 499 | return err; |
492 | snd_us122l_card_used[US122L(card)->chip.index = dev] = 1; | 500 | snd_us122l_card_used[US122L(card)->chip.index = dev] = 1; |
493 | 501 | card->private_free = snd_us122l_free; | |
494 | US122L(card)->chip.dev = device; | 502 | US122L(card)->chip.dev = device; |
495 | US122L(card)->chip.card = card; | 503 | US122L(card)->chip.card = card; |
496 | mutex_init(&US122L(card)->mutex); | 504 | mutex_init(&US122L(card)->mutex); |
@@ -584,7 +592,7 @@ static void snd_us122l_disconnect(struct usb_interface *intf) | |||
584 | } | 592 | } |
585 | 593 | ||
586 | usb_put_intf(intf); | 594 | usb_put_intf(intf); |
587 | usb_put_dev(US122L(card)->chip.dev); | 595 | usb_put_dev(us122l->chip.dev); |
588 | 596 | ||
589 | while (atomic_read(&us122l->mmap_count)) | 597 | while (atomic_read(&us122l->mmap_count)) |
590 | msleep(500); | 598 | msleep(500); |
diff --git a/sound/usb/usx2y/usb_stream.c b/sound/usb/usx2y/usb_stream.c index 24393dafcb6e..12ae0340adc0 100644 --- a/sound/usb/usx2y/usb_stream.c +++ b/sound/usb/usx2y/usb_stream.c | |||
@@ -33,32 +33,26 @@ static unsigned usb_stream_next_packet_size(struct usb_stream_kernel *sk) | |||
33 | static void playback_prep_freqn(struct usb_stream_kernel *sk, struct urb *urb) | 33 | static void playback_prep_freqn(struct usb_stream_kernel *sk, struct urb *urb) |
34 | { | 34 | { |
35 | struct usb_stream *s = sk->s; | 35 | struct usb_stream *s = sk->s; |
36 | unsigned l = 0; | 36 | int pack, lb = 0; |
37 | int pack; | 37 | |
38 | 38 | for (pack = 0; pack < sk->n_o_ps; pack++) { | |
39 | urb->iso_frame_desc[0].offset = 0; | 39 | int l = usb_stream_next_packet_size(sk); |
40 | urb->iso_frame_desc[0].length = usb_stream_next_packet_size(sk); | 40 | if (s->idle_outsize + lb + l > s->period_size) |
41 | sk->out_phase = sk->out_phase_peeked; | ||
42 | urb->transfer_buffer_length = urb->iso_frame_desc[0].length; | ||
43 | |||
44 | for (pack = 1; pack < sk->n_o_ps; pack++) { | ||
45 | l = usb_stream_next_packet_size(sk); | ||
46 | if (s->idle_outsize + urb->transfer_buffer_length + l > | ||
47 | s->period_size) | ||
48 | goto check; | 41 | goto check; |
49 | 42 | ||
50 | sk->out_phase = sk->out_phase_peeked; | 43 | sk->out_phase = sk->out_phase_peeked; |
51 | urb->iso_frame_desc[pack].offset = urb->transfer_buffer_length; | 44 | urb->iso_frame_desc[pack].offset = lb; |
52 | urb->iso_frame_desc[pack].length = l; | 45 | urb->iso_frame_desc[pack].length = l; |
53 | urb->transfer_buffer_length += l; | 46 | lb += l; |
54 | } | 47 | } |
55 | snd_printdd(KERN_DEBUG "%i\n", urb->transfer_buffer_length); | 48 | snd_printdd(KERN_DEBUG "%i\n", lb); |
56 | 49 | ||
57 | check: | 50 | check: |
58 | urb->number_of_packets = pack; | 51 | urb->number_of_packets = pack; |
59 | s->idle_outsize += urb->transfer_buffer_length - s->period_size; | 52 | urb->transfer_buffer_length = lb; |
53 | s->idle_outsize += lb - s->period_size; | ||
60 | snd_printdd(KERN_DEBUG "idle=%i ul=%i ps=%i\n", s->idle_outsize, | 54 | snd_printdd(KERN_DEBUG "idle=%i ul=%i ps=%i\n", s->idle_outsize, |
61 | urb->transfer_buffer_length, s->period_size); | 55 | lb, s->period_size); |
62 | } | 56 | } |
63 | 57 | ||
64 | static void init_pipe_urbs(struct usb_stream_kernel *sk, unsigned use_packsize, | 58 | static void init_pipe_urbs(struct usb_stream_kernel *sk, unsigned use_packsize, |
@@ -282,21 +276,20 @@ static int usb_stream_prepare_playback(struct usb_stream_kernel *sk, | |||
282 | struct usb_stream *s = sk->s; | 276 | struct usb_stream *s = sk->s; |
283 | struct urb *io; | 277 | struct urb *io; |
284 | struct usb_iso_packet_descriptor *id, *od; | 278 | struct usb_iso_packet_descriptor *id, *od; |
285 | int p, l = 0; | 279 | int p = 0, lb = 0, l = 0; |
286 | 280 | ||
287 | io = sk->idle_outurb; | 281 | io = sk->idle_outurb; |
288 | od = io->iso_frame_desc; | 282 | od = io->iso_frame_desc; |
289 | io->transfer_buffer_length = 0; | ||
290 | 283 | ||
291 | for (p = 0; s->sync_packet < 0; ++p, ++s->sync_packet) { | 284 | for (; s->sync_packet < 0; ++p, ++s->sync_packet) { |
292 | struct urb *ii = sk->completed_inurb; | 285 | struct urb *ii = sk->completed_inurb; |
293 | id = ii->iso_frame_desc + | 286 | id = ii->iso_frame_desc + |
294 | ii->number_of_packets + s->sync_packet; | 287 | ii->number_of_packets + s->sync_packet; |
295 | l = id->actual_length; | 288 | l = id->actual_length; |
296 | 289 | ||
297 | od[p].length = l; | 290 | od[p].length = l; |
298 | od[p].offset = io->transfer_buffer_length; | 291 | od[p].offset = lb; |
299 | io->transfer_buffer_length += l; | 292 | lb += l; |
300 | } | 293 | } |
301 | 294 | ||
302 | for (; | 295 | for (; |
@@ -304,38 +297,38 @@ static int usb_stream_prepare_playback(struct usb_stream_kernel *sk, | |||
304 | ++p, ++s->sync_packet) { | 297 | ++p, ++s->sync_packet) { |
305 | l = inurb->iso_frame_desc[s->sync_packet].actual_length; | 298 | l = inurb->iso_frame_desc[s->sync_packet].actual_length; |
306 | 299 | ||
307 | if (s->idle_outsize + io->transfer_buffer_length + l > | 300 | if (s->idle_outsize + lb + l > s->period_size) |
308 | s->period_size) | ||
309 | goto check_ok; | 301 | goto check_ok; |
310 | 302 | ||
311 | od[p].length = l; | 303 | od[p].length = l; |
312 | od[p].offset = io->transfer_buffer_length; | 304 | od[p].offset = lb; |
313 | io->transfer_buffer_length += l; | 305 | lb += l; |
314 | } | 306 | } |
315 | 307 | ||
316 | check_ok: | 308 | check_ok: |
317 | s->sync_packet -= inurb->number_of_packets; | 309 | s->sync_packet -= inurb->number_of_packets; |
318 | if (s->sync_packet < -2 || s->sync_packet > 0) { | 310 | if (unlikely(s->sync_packet < -2 || s->sync_packet > 0)) { |
319 | snd_printk(KERN_WARNING "invalid sync_packet = %i;" | 311 | snd_printk(KERN_WARNING "invalid sync_packet = %i;" |
320 | " p=%i nop=%i %i %x %x %x > %x\n", | 312 | " p=%i nop=%i %i %x %x %x > %x\n", |
321 | s->sync_packet, p, inurb->number_of_packets, | 313 | s->sync_packet, p, inurb->number_of_packets, |
322 | s->idle_outsize + io->transfer_buffer_length + l, | 314 | s->idle_outsize + lb + l, |
323 | s->idle_outsize, io->transfer_buffer_length, l, | 315 | s->idle_outsize, lb, l, |
324 | s->period_size); | 316 | s->period_size); |
325 | return -1; | 317 | return -1; |
326 | } | 318 | } |
327 | if (io->transfer_buffer_length % s->cfg.frame_size) { | 319 | if (unlikely(lb % s->cfg.frame_size)) { |
328 | snd_printk(KERN_WARNING"invalid outsize = %i\n", | 320 | snd_printk(KERN_WARNING"invalid outsize = %i\n", |
329 | io->transfer_buffer_length); | 321 | lb); |
330 | return -1; | 322 | return -1; |
331 | } | 323 | } |
332 | s->idle_outsize += io->transfer_buffer_length - s->period_size; | 324 | s->idle_outsize += lb - s->period_size; |
333 | io->number_of_packets = p; | 325 | io->number_of_packets = p; |
334 | if (s->idle_outsize > 0) { | 326 | io->transfer_buffer_length = lb; |
335 | snd_printk(KERN_WARNING "idle=%i\n", s->idle_outsize); | 327 | if (s->idle_outsize <= 0) |
336 | return -1; | 328 | return 0; |
337 | } | 329 | |
338 | return 0; | 330 | snd_printk(KERN_WARNING "idle=%i\n", s->idle_outsize); |
331 | return -1; | ||
339 | } | 332 | } |
340 | 333 | ||
341 | static void prepare_inurb(int number_of_packets, struct urb *iu) | 334 | static void prepare_inurb(int number_of_packets, struct urb *iu) |