• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/sound/aoa/codecs/

Lines Matching defs:onyx

27  *	 this means you can only have one onyx on a system. This
39 MODULE_DESCRIPTION("pcm3052 (onyx) codec driver for snd-aoa");
41 #include "onyx.h"
46 #define PFX "snd-aoa-codec-onyx: "
48 struct onyx {
65 #define codec_to_onyx(c) container_of(c, struct onyx, codec)
68 static int onyx_read_register(struct onyx *onyx, u8 reg, u8 *value)
73 *value = onyx->cache[reg-FIRSTREGISTER];
76 v = i2c_smbus_read_byte_data(onyx->i2c, reg);
80 onyx->cache[ONYX_REG_CONTROL-FIRSTREGISTER] = *value;
84 static int onyx_write_register(struct onyx *onyx, u8 reg, u8 value)
88 result = i2c_smbus_write_byte_data(onyx->i2c, reg, value);
90 onyx->cache[reg-FIRSTREGISTER] = value;
122 struct onyx *onyx = snd_kcontrol_chip(kcontrol);
125 mutex_lock(&onyx->mutex);
126 onyx_read_register(onyx, ONYX_REG_DAC_ATTEN_LEFT, &l);
127 onyx_read_register(onyx, ONYX_REG_DAC_ATTEN_RIGHT, &r);
128 mutex_unlock(&onyx->mutex);
139 struct onyx *onyx = snd_kcontrol_chip(kcontrol);
149 mutex_lock(&onyx->mutex);
150 onyx_read_register(onyx, ONYX_REG_DAC_ATTEN_LEFT, &l);
151 onyx_read_register(onyx, ONYX_REG_DAC_ATTEN_RIGHT, &r);
155 mutex_unlock(&onyx->mutex);
159 onyx_write_register(onyx, ONYX_REG_DAC_ATTEN_LEFT,
162 onyx_write_register(onyx, ONYX_REG_DAC_ATTEN_RIGHT,
165 mutex_unlock(&onyx->mutex);
198 struct onyx *onyx = snd_kcontrol_chip(kcontrol);
201 mutex_lock(&onyx->mutex);
202 onyx_read_register(onyx, ONYX_REG_ADC_CONTROL, &ig);
203 mutex_unlock(&onyx->mutex);
214 struct onyx *onyx = snd_kcontrol_chip(kcontrol);
220 mutex_lock(&onyx->mutex);
221 onyx_read_register(onyx, ONYX_REG_ADC_CONTROL, &v);
226 onyx_write_register(onyx, ONYX_REG_ADC_CONTROL, n);
227 mutex_unlock(&onyx->mutex);
258 struct onyx *onyx = snd_kcontrol_chip(kcontrol);
261 mutex_lock(&onyx->mutex);
262 onyx_read_register(onyx, ONYX_REG_ADC_CONTROL, &v);
263 mutex_unlock(&onyx->mutex);
270 static void onyx_set_capture_source(struct onyx *onyx, int mic)
274 mutex_lock(&onyx->mutex);
275 onyx_read_register(onyx, ONYX_REG_ADC_CONTROL, &v);
279 onyx_write_register(onyx, ONYX_REG_ADC_CONTROL, v);
280 mutex_unlock(&onyx->mutex);
318 struct onyx *onyx = snd_kcontrol_chip(kcontrol);
321 mutex_lock(&onyx->mutex);
322 onyx_read_register(onyx, ONYX_REG_DAC_CONTROL, &c);
323 mutex_unlock(&onyx->mutex);
334 struct onyx *onyx = snd_kcontrol_chip(kcontrol);
338 mutex_lock(&onyx->mutex);
339 if (onyx->analog_locked)
342 onyx_read_register(onyx, ONYX_REG_DAC_CONTROL, &v);
349 err = onyx_write_register(onyx, ONYX_REG_DAC_CONTROL, c);
352 mutex_unlock(&onyx->mutex);
375 struct onyx *onyx = snd_kcontrol_chip(kcontrol);
382 mutex_lock(&onyx->mutex);
383 onyx_read_register(onyx, address, &c);
384 mutex_unlock(&onyx->mutex);
394 struct onyx *onyx = snd_kcontrol_chip(kcontrol);
403 mutex_lock(&onyx->mutex);
404 if (spdiflock && onyx->spdif_locked) {
409 onyx_read_register(onyx, address, &v);
414 err = onyx_write_register(onyx, address, c);
417 mutex_unlock(&onyx->mutex);
496 struct onyx *onyx = snd_kcontrol_chip(kcontrol);
499 mutex_lock(&onyx->mutex);
500 onyx_read_register(onyx, ONYX_REG_DIG_INFO1, &v);
503 onyx_read_register(onyx, ONYX_REG_DIG_INFO2, &v);
506 onyx_read_register(onyx, ONYX_REG_DIG_INFO3, &v);
509 onyx_read_register(onyx, ONYX_REG_DIG_INFO4, &v);
511 mutex_unlock(&onyx->mutex);
519 struct onyx *onyx = snd_kcontrol_chip(kcontrol);
522 mutex_lock(&onyx->mutex);
523 onyx_read_register(onyx, ONYX_REG_DIG_INFO1, &v);
525 onyx_write_register(onyx, ONYX_REG_DIG_INFO1, v);
528 onyx_write_register(onyx, ONYX_REG_DIG_INFO2, v);
530 onyx_read_register(onyx, ONYX_REG_DIG_INFO3, &v);
532 onyx_write_register(onyx, ONYX_REG_DIG_INFO3, v);
534 onyx_read_register(onyx, ONYX_REG_DIG_INFO4, &v);
536 onyx_write_register(onyx, ONYX_REG_DIG_INFO4, v);
537 mutex_unlock(&onyx->mutex);
585 static int onyx_register_init(struct onyx *onyx)
591 if (!onyx->initialised) {
593 if (onyx_read_register(onyx, ONYX_REG_CONTROL, &val))
600 regs[i] = onyx->cache[register_map[i]-FIRSTREGISTER];
604 if (onyx_write_register(onyx, register_map[i], regs[i]))
607 onyx->initialised = 1;
679 struct onyx *onyx = cii->codec_data;
682 mutex_lock(&onyx->mutex);
683 onyx_read_register(onyx, ONYX_REG_DIG_INFO4, &v);
685 onyx_read_register(onyx, ONYX_REG_DAC_CONTROL, &v);
689 mutex_unlock(&onyx->mutex);
704 struct onyx *onyx = cii->codec_data;
707 mutex_lock(&onyx->mutex);
712 onyx_read_register(onyx, ONYX_REG_DAC_CONTROL, &v);
713 if (onyx_write_register(onyx,
717 onyx->analog_locked = 1;
733 if (onyx_write_register(onyx,
737 onyx->spdif_locked = 1;
743 mutex_unlock(&onyx->mutex);
751 struct onyx *onyx = cii->codec_data;
753 mutex_lock(&onyx->mutex);
754 onyx->open_count++;
755 mutex_unlock(&onyx->mutex);
763 struct onyx *onyx = cii->codec_data;
765 mutex_lock(&onyx->mutex);
766 onyx->open_count--;
767 if (!onyx->open_count)
768 onyx->spdif_locked = onyx->analog_locked = 0;
769 mutex_unlock(&onyx->mutex);
777 struct onyx *onyx = cii->codec_data;
779 mutex_lock(&onyx->mutex);
783 onyx->codec.gpio->methods->all_amps_off(onyx->codec.gpio);
786 onyx->codec.gpio->methods->all_amps_restore(onyx->codec.gpio);
791 mutex_unlock(&onyx->mutex);
800 struct onyx *onyx = cii->codec_data;
804 mutex_lock(&onyx->mutex);
805 if (onyx_read_register(onyx, ONYX_REG_CONTROL, &v))
807 onyx_write_register(onyx, ONYX_REG_CONTROL, v | ONYX_ADPSV | ONYX_DAPSV);
811 mutex_unlock(&onyx->mutex);
818 struct onyx *onyx = cii->codec_data;
822 mutex_lock(&onyx->mutex);
825 onyx->codec.gpio->methods->set_hw_reset(onyx->codec.gpio, 0);
827 onyx->codec.gpio->methods->set_hw_reset(onyx->codec.gpio, 1);
829 onyx->codec.gpio->methods->set_hw_reset(onyx->codec.gpio, 0);
833 if (onyx_read_register(onyx, ONYX_REG_CONTROL, &v))
835 onyx_write_register(onyx, ONYX_REG_CONTROL, v & ~(ONYX_ADPSV | ONYX_DAPSV));
838 onyx_register_init(onyx);
841 mutex_unlock(&onyx->mutex);
866 struct onyx *onyx = codec_to_onyx(codec);
872 if (!onyx->codec.gpio || !onyx->codec.gpio->methods) {
877 onyx->codec.gpio->methods->set_hw_reset(onyx->codec.gpio, 0);
879 onyx->codec.gpio->methods->set_hw_reset(onyx->codec.gpio, 1);
881 onyx->codec.gpio->methods->set_hw_reset(onyx->codec.gpio, 0);
884 if (onyx_register_init(onyx)) {
885 printk(KERN_ERR PFX "failed to initialise onyx registers\n");
889 if (aoa_snd_device_new(SNDRV_DEV_LOWLEVEL, onyx, &ops)) {
890 printk(KERN_ERR PFX "failed to create onyx snd device!\n");
895 if ((onyx->codec.connected & 0xF) == 0)
899 if ((onyx->codec.connected & 0xC) == 0) {
900 if (!onyx->codec_info)
901 onyx->codec_info = kmalloc(sizeof(struct codec_info), GFP_KERNEL);
902 if (!onyx->codec_info)
904 ci = onyx->codec_info;
910 if ((onyx->codec.connected & 3) == 0) {
911 if (!onyx->codec_info)
912 onyx->codec_info = kmalloc(sizeof(struct codec_info), GFP_KERNEL);
913 if (!onyx->codec_info)
915 ci = onyx->codec_info;
922 if (onyx->codec.soundbus_dev->attach_codec(onyx->codec.soundbus_dev,
924 ci, onyx)) {
925 printk(KERN_ERR PFX "error creating onyx pcm\n");
930 ctl = snd_ctl_new1(&n, onyx); \
933 onyx->codec.soundbus_dev->pcm->device; \
940 if (onyx->codec.soundbus_dev->pcm) {
943 if ((onyx->codec.connected & 0xC) == 0xC)
945 else if (onyx->codec.connected & 4)
946 onyx_set_capture_source(onyx, 0);
948 onyx_set_capture_source(onyx, 1);
949 if (onyx->codec.connected & 0xC)
954 if (onyx->codec.connected & 1) {
963 if (onyx->codec.connected & 2) {
967 if ((onyx->codec.connected & 3) == 3)
970 if ((onyx->codec.connected & 3) == 2) {
971 onyx_read_register(onyx, ONYX_REG_DIG_INFO4, &v);
973 onyx_write_register(onyx, ONYX_REG_DIG_INFO4, v);
977 printk(KERN_INFO PFX "attached to onyx codec via i2c\n");
981 onyx->codec.soundbus_dev->detach_codec(onyx->codec.soundbus_dev, onyx);
982 snd_device_free(aoa_get_card(), onyx);
988 struct onyx *onyx = codec_to_onyx(codec);
990 if (!onyx->codec.soundbus_dev) {
994 onyx->codec.soundbus_dev->detach_codec(onyx->codec.soundbus_dev, onyx);
1036 struct onyx *onyx;
1039 onyx = kzalloc(sizeof(struct onyx), GFP_KERNEL);
1041 if (!onyx)
1044 mutex_init(&onyx->mutex);
1045 onyx->i2c = client;
1046 i2c_set_clientdata(client, onyx);
1050 if (onyx_read_register(onyx, ONYX_REG_CONTROL, &dummy) != 0) {
1055 strlcpy(onyx->codec.name, "onyx", MAX_CODEC_NAME_LEN);
1056 onyx->codec.owner = THIS_MODULE;
1057 onyx->codec.init = onyx_init_codec;
1058 onyx->codec.exit = onyx_exit_codec;
1059 onyx->codec.node = of_node_get(node);
1061 if (aoa_codec_register(&onyx->codec)) {
1064 printk(KERN_DEBUG PFX "created and attached onyx instance\n");
1068 kfree(onyx);
1099 printk(KERN_DEBUG PFX "found k2-i2c, checking if onyx chip is on it\n");
1100 /* probe both possible addresses for the onyx chip */
1108 struct onyx *onyx = i2c_get_clientdata(client);
1110 aoa_codec_unregister(&onyx->codec);
1111 of_node_put(onyx->codec.node);
1112 if (onyx->codec_info)
1113 kfree(onyx->codec_info);
1114 i2c_set_clientdata(client, onyx);
1115 kfree(onyx);