diff options
Diffstat (limited to 'sound/aoa/codecs')
| -rw-r--r-- | sound/aoa/codecs/Kconfig | 8 | ||||
| -rw-r--r-- | sound/aoa/codecs/onyx.c | 97 | ||||
| -rw-r--r-- | sound/aoa/codecs/tas.c | 95 | ||||
| -rw-r--r-- | sound/aoa/codecs/toonie.c | 2 | 
4 files changed, 13 insertions, 189 deletions
diff --git a/sound/aoa/codecs/Kconfig b/sound/aoa/codecs/Kconfig index 808eb11ebac..0c68e32834c 100644 --- a/sound/aoa/codecs/Kconfig +++ b/sound/aoa/codecs/Kconfig @@ -7,14 +7,6 @@ config SND_AOA_ONYX  	codec chip found in the latest Apple machines  	(most of those with digital audio output). -#config SND_AOA_TOPAZ -#	tristate "support Topaz chips" -#	---help--- -#	This option enables support for the Topaz (CS84xx) -#	codec chips found in the latest Apple machines, -#	these chips do the digital input and output on -#	some PowerMacs. -  config SND_AOA_TAS  	tristate "support TAS chips"  	select I2C diff --git a/sound/aoa/codecs/onyx.c b/sound/aoa/codecs/onyx.c index 91852e49910..401107b85d3 100644 --- a/sound/aoa/codecs/onyx.c +++ b/sound/aoa/codecs/onyx.c @@ -241,7 +241,7 @@ static struct snd_kcontrol_new inputgain_control = {  static int onyx_snd_capture_source_info(struct snd_kcontrol *kcontrol,  	struct snd_ctl_elem_info *uinfo)  { -	static char *texts[] = { "Line-In", "Microphone" }; +	static const char * const texts[] = { "Line-In", "Microphone" };  	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;  	uinfo->count = 1; @@ -889,7 +889,7 @@ static int onyx_init_codec(struct aoa_codec *codec)  		return -ENODEV;  	} -	if (aoa_snd_device_new(SNDRV_DEV_LOWLEVEL, onyx, &ops)) { +	if (aoa_snd_device_new(SNDRV_DEV_CODEC, onyx, &ops)) {  		printk(KERN_ERR PFX "failed to create onyx snd device!\n");  		return -ENODEV;  	} @@ -997,45 +997,10 @@ static void onyx_exit_codec(struct aoa_codec *codec)  	onyx->codec.soundbus_dev->detach_codec(onyx->codec.soundbus_dev, onyx);  } -static int onyx_create(struct i2c_adapter *adapter, -		       struct device_node *node, -		       int addr) -{ -	struct i2c_board_info info; -	struct i2c_client *client; - -	memset(&info, 0, sizeof(struct i2c_board_info)); -	strlcpy(info.type, "aoa_codec_onyx", I2C_NAME_SIZE); -	info.addr = addr; -	info.platform_data = node; -	client = i2c_new_device(adapter, &info); -	if (!client) -		return -ENODEV; - -	/* -	 * We know the driver is already loaded, so the device should be -	 * already bound. If not it means binding failed, which suggests -	 * the device doesn't really exist and should be deleted. -	 * Ideally this would be replaced by better checks _before_ -	 * instantiating the device. -	 */ -	if (!client->driver) { -		i2c_unregister_device(client); -		return -ENODEV; -	} - -	/* -	 * Let i2c-core delete that device on driver removal. -	 * This is safe because i2c-core holds the core_lock mutex for us. -	 */ -	list_add_tail(&client->detected, &client->driver->clients); -	return 0; -} -  static int onyx_i2c_probe(struct i2c_client *client,  			  const struct i2c_device_id *id)  { -	struct device_node *node = client->dev.platform_data; +	struct device_node *node = client->dev.of_node;  	struct onyx *onyx;  	u8 dummy; @@ -1067,83 +1032,35 @@ static int onyx_i2c_probe(struct i2c_client *client,  	printk(KERN_DEBUG PFX "created and attached onyx instance\n");  	return 0;   fail: -	i2c_set_clientdata(client, NULL);  	kfree(onyx);  	return -ENODEV;  } -static int onyx_i2c_attach(struct i2c_adapter *adapter) -{ -	struct device_node *busnode, *dev = NULL; -	struct pmac_i2c_bus *bus; - -	bus = pmac_i2c_adapter_to_bus(adapter); -	if (bus == NULL) -		return -ENODEV; -	busnode = pmac_i2c_get_bus_node(bus); - -	while ((dev = of_get_next_child(busnode, dev)) != NULL) { -		if (of_device_is_compatible(dev, "pcm3052")) { -			const u32 *addr; -			printk(KERN_DEBUG PFX "found pcm3052\n"); -			addr = of_get_property(dev, "reg", NULL); -			if (!addr) -				return -ENODEV; -			return onyx_create(adapter, dev, (*addr)>>1); -		} -	} - -	/* if that didn't work, try desperate mode for older -	 * machines that have stuff missing from the device tree */ - -	if (!of_device_is_compatible(busnode, "k2-i2c")) -		return -ENODEV; - -	printk(KERN_DEBUG PFX "found k2-i2c, checking if onyx chip is on it\n"); -	/* probe both possible addresses for the onyx chip */ -	if (onyx_create(adapter, NULL, 0x46) == 0) -		return 0; -	return onyx_create(adapter, NULL, 0x47); -} -  static int onyx_i2c_remove(struct i2c_client *client)  {  	struct onyx *onyx = i2c_get_clientdata(client);  	aoa_codec_unregister(&onyx->codec);  	of_node_put(onyx->codec.node); -	if (onyx->codec_info) -		kfree(onyx->codec_info); -	i2c_set_clientdata(client, onyx); +	kfree(onyx->codec_info);  	kfree(onyx);  	return 0;  }  static const struct i2c_device_id onyx_i2c_id[] = { -	{ "aoa_codec_onyx", 0 }, +	{ "MAC,pcm3052", 0 },  	{ }  }; +MODULE_DEVICE_TABLE(i2c,onyx_i2c_id);  static struct i2c_driver onyx_driver = {  	.driver = {  		.name = "aoa_codec_onyx",  		.owner = THIS_MODULE,  	}, -	.attach_adapter = onyx_i2c_attach,  	.probe = onyx_i2c_probe,  	.remove = onyx_i2c_remove,  	.id_table = onyx_i2c_id,  }; -static int __init onyx_init(void) -{ -	return i2c_add_driver(&onyx_driver); -} - -static void __exit onyx_exit(void) -{ -	i2c_del_driver(&onyx_driver); -} - -module_init(onyx_init); -module_exit(onyx_exit); +module_i2c_driver(onyx_driver); diff --git a/sound/aoa/codecs/tas.c b/sound/aoa/codecs/tas.c index fd2188c3df2..cf3c6303b7e 100644 --- a/sound/aoa/codecs/tas.c +++ b/sound/aoa/codecs/tas.c @@ -826,7 +826,7 @@ static int tas_init_codec(struct aoa_codec *codec)  		return -ENODEV;  	} -	if (aoa_snd_device_new(SNDRV_DEV_LOWLEVEL, tas, &ops)) { +	if (aoa_snd_device_new(SNDRV_DEV_CODEC, tas, &ops)) {  		printk(KERN_ERR PFX "failed to create tas snd device!\n");  		return -ENODEV;  	} @@ -883,43 +883,10 @@ static void tas_exit_codec(struct aoa_codec *codec)  } -static int tas_create(struct i2c_adapter *adapter, -		       struct device_node *node, -		       int addr) -{ -	struct i2c_board_info info; -	struct i2c_client *client; - -	memset(&info, 0, sizeof(struct i2c_board_info)); -	strlcpy(info.type, "aoa_codec_tas", I2C_NAME_SIZE); -	info.addr = addr; -	info.platform_data = node; - -	client = i2c_new_device(adapter, &info); -	if (!client) -		return -ENODEV; -	/* -	 * We know the driver is already loaded, so the device should be -	 * already bound. If not it means binding failed, and then there -	 * is no point in keeping the device instantiated. -	 */ -	if (!client->driver) { -		i2c_unregister_device(client); -		return -ENODEV; -	} - -	/* -	 * Let i2c-core delete that device on driver removal. -	 * This is safe because i2c-core holds the core_lock mutex for us. -	 */ -	list_add_tail(&client->detected, &client->driver->clients); -	return 0; -} -  static int tas_i2c_probe(struct i2c_client *client,  			 const struct i2c_device_id *id)  { -	struct device_node *node = client->dev.platform_data; +	struct device_node *node = client->dev.of_node;  	struct tas *tas;  	tas = kzalloc(sizeof(struct tas), GFP_KERNEL); @@ -953,47 +920,6 @@ static int tas_i2c_probe(struct i2c_client *client,  	return -EINVAL;  } -static int tas_i2c_attach(struct i2c_adapter *adapter) -{ -	struct device_node *busnode, *dev = NULL; -	struct pmac_i2c_bus *bus; - -	bus = pmac_i2c_adapter_to_bus(adapter); -	if (bus == NULL) -		return -ENODEV; -	busnode = pmac_i2c_get_bus_node(bus); - -	while ((dev = of_get_next_child(busnode, dev)) != NULL) { -		if (of_device_is_compatible(dev, "tas3004")) { -			const u32 *addr; -			printk(KERN_DEBUG PFX "found tas3004\n"); -			addr = of_get_property(dev, "reg", NULL); -			if (!addr) -				continue; -			return tas_create(adapter, dev, ((*addr) >> 1) & 0x7f); -		} -		/* older machines have no 'codec' node with a 'compatible' -		 * property that says 'tas3004', they just have a 'deq' -		 * node without any such property... */ -		if (strcmp(dev->name, "deq") == 0) { -			const u32 *_addr; -			u32 addr; -			printk(KERN_DEBUG PFX "found 'deq' node\n"); -			_addr = of_get_property(dev, "i2c-address", NULL); -			if (!_addr) -				continue; -			addr = ((*_addr) >> 1) & 0x7f; -			/* now, if the address doesn't match any of the two -			 * that a tas3004 can have, we cannot handle this. -			 * I doubt it ever happens but hey. */ -			if (addr != 0x34 && addr != 0x35) -				continue; -			return tas_create(adapter, dev, addr); -		} -	} -	return -ENODEV; -} -  static int tas_i2c_remove(struct i2c_client *client)  {  	struct tas *tas = i2c_get_clientdata(client); @@ -1011,30 +937,19 @@ static int tas_i2c_remove(struct i2c_client *client)  }  static const struct i2c_device_id tas_i2c_id[] = { -	{ "aoa_codec_tas", 0 }, +	{ "MAC,tas3004", 0 },  	{ }  }; +MODULE_DEVICE_TABLE(i2c,tas_i2c_id);  static struct i2c_driver tas_driver = {  	.driver = {  		.name = "aoa_codec_tas",  		.owner = THIS_MODULE,  	}, -	.attach_adapter = tas_i2c_attach,  	.probe = tas_i2c_probe,  	.remove = tas_i2c_remove,  	.id_table = tas_i2c_id,  }; -static int __init tas_init(void) -{ -	return i2c_add_driver(&tas_driver); -} - -static void __exit tas_exit(void) -{ -	i2c_del_driver(&tas_driver); -} - -module_init(tas_init); -module_exit(tas_exit); +module_i2c_driver(tas_driver); diff --git a/sound/aoa/codecs/toonie.c b/sound/aoa/codecs/toonie.c index 69d2cb601f2..7e8c3417cd8 100644 --- a/sound/aoa/codecs/toonie.c +++ b/sound/aoa/codecs/toonie.c @@ -92,7 +92,7 @@ static int toonie_init_codec(struct aoa_codec *codec)  	if (toonie->codec.connected != 1)  		return -ENOTCONN; -	if (aoa_snd_device_new(SNDRV_DEV_LOWLEVEL, toonie, &ops)) { +	if (aoa_snd_device_new(SNDRV_DEV_CODEC, toonie, &ops)) {  		printk(KERN_ERR PFX "failed to create toonie snd device!\n");  		return -ENODEV;  	}  | 
