Commit 80b52490 authored by Tim Blechmann's avatar Tim Blechmann Committed by Takashi Iwai

ALSA: lx6464es - include mac address in device name

each device has a unique mac address, which can be used to distinguish
multiple devices in the same machine. we therefore include the full mac
address in the device shortname and the last 6 bytes in the device id.
Signed-off-by: default avatarTim Blechmann <tim@klingt.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 14705799
...@@ -762,7 +762,6 @@ static int lx_set_granularity(struct lx6464es *chip, u32 gran) ...@@ -762,7 +762,6 @@ static int lx_set_granularity(struct lx6464es *chip, u32 gran)
static int __devinit lx_init_dsp(struct lx6464es *chip) static int __devinit lx_init_dsp(struct lx6464es *chip)
{ {
int err; int err;
u8 mac_address[6];
int i; int i;
snd_printdd("->lx_init_dsp\n"); snd_printdd("->lx_init_dsp\n");
...@@ -787,11 +786,11 @@ static int __devinit lx_init_dsp(struct lx6464es *chip) ...@@ -787,11 +786,11 @@ static int __devinit lx_init_dsp(struct lx6464es *chip)
/** \todo the mac address should be ready by not, but it isn't, /** \todo the mac address should be ready by not, but it isn't,
* so we wait for it */ * so we wait for it */
for (i = 0; i != 1000; ++i) { for (i = 0; i != 1000; ++i) {
err = lx_dsp_get_mac(chip, mac_address); err = lx_dsp_get_mac(chip);
if (err) if (err)
return err; return err;
if (mac_address[0] || mac_address[1] || mac_address[2] || if (chip->mac_address[0] || chip->mac_address[1] || chip->mac_address[2] ||
mac_address[3] || mac_address[4] || mac_address[5]) chip->mac_address[3] || chip->mac_address[4] || chip->mac_address[5])
goto mac_ready; goto mac_ready;
msleep(1); msleep(1);
} }
...@@ -800,8 +799,8 @@ static int __devinit lx_init_dsp(struct lx6464es *chip) ...@@ -800,8 +799,8 @@ static int __devinit lx_init_dsp(struct lx6464es *chip)
mac_ready: mac_ready:
snd_printd(LXP "mac address ready read after: %dms\n", i); snd_printd(LXP "mac address ready read after: %dms\n", i);
snd_printk(LXP "mac address: %02X.%02X.%02X.%02X.%02X.%02X\n", snd_printk(LXP "mac address: %02X.%02X.%02X.%02X.%02X.%02X\n",
mac_address[0], mac_address[1], mac_address[2], chip->mac_address[0], chip->mac_address[1], chip->mac_address[2],
mac_address[3], mac_address[4], mac_address[5]); chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]);
err = lx_init_get_version_features(chip); err = lx_init_get_version_features(chip);
if (err) if (err)
...@@ -1108,8 +1107,14 @@ static int __devinit snd_lx6464es_probe(struct pci_dev *pci, ...@@ -1108,8 +1107,14 @@ static int __devinit snd_lx6464es_probe(struct pci_dev *pci,
goto out_free; goto out_free;
} }
strcpy(card->driver, "lx6464es"); strcpy(card->driver, "LX6464ES");
strcpy(card->shortname, "Digigram LX6464ES"); sprintf(card->id, "LX6464ES_%02X%02X%02X",
chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]);
sprintf(card->shortname, "LX6464ES %02X.%02X.%02X.%02X.%02X.%02X",
chip->mac_address[0], chip->mac_address[1], chip->mac_address[2],
chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]);
sprintf(card->longname, "%s at 0x%lx, 0x%p, irq %i", sprintf(card->longname, "%s at 0x%lx, 0x%p, irq %i",
card->shortname, chip->port_plx, card->shortname, chip->port_plx,
chip->port_dsp_bar, chip->irq); chip->port_dsp_bar, chip->irq);
......
...@@ -69,6 +69,8 @@ struct lx6464es { ...@@ -69,6 +69,8 @@ struct lx6464es {
struct pci_dev *pci; struct pci_dev *pci;
int irq; int irq;
u8 mac_address[6];
spinlock_t lock; /* interrupt spinlock */ spinlock_t lock; /* interrupt spinlock */
struct mutex setup_mutex; /* mutex used in hw_params, open struct mutex setup_mutex; /* mutex used in hw_params, open
* and close */ * and close */
......
...@@ -424,7 +424,7 @@ int lx_dsp_get_clock_frequency(struct lx6464es *chip, u32 *rfreq) ...@@ -424,7 +424,7 @@ int lx_dsp_get_clock_frequency(struct lx6464es *chip, u32 *rfreq)
return ret; return ret;
} }
int lx_dsp_get_mac(struct lx6464es *chip, u8 *mac_address) int lx_dsp_get_mac(struct lx6464es *chip)
{ {
u32 macmsb, maclsb; u32 macmsb, maclsb;
...@@ -432,12 +432,12 @@ int lx_dsp_get_mac(struct lx6464es *chip, u8 *mac_address) ...@@ -432,12 +432,12 @@ int lx_dsp_get_mac(struct lx6464es *chip, u8 *mac_address)
maclsb = lx_dsp_reg_read(chip, eReg_ADMACESLSB) & 0x00FFFFFF; maclsb = lx_dsp_reg_read(chip, eReg_ADMACESLSB) & 0x00FFFFFF;
/* todo: endianess handling */ /* todo: endianess handling */
mac_address[5] = ((u8 *)(&maclsb))[0]; chip->mac_address[5] = ((u8 *)(&maclsb))[0];
mac_address[4] = ((u8 *)(&maclsb))[1]; chip->mac_address[4] = ((u8 *)(&maclsb))[1];
mac_address[3] = ((u8 *)(&maclsb))[2]; chip->mac_address[3] = ((u8 *)(&maclsb))[2];
mac_address[2] = ((u8 *)(&macmsb))[0]; chip->mac_address[2] = ((u8 *)(&macmsb))[0];
mac_address[1] = ((u8 *)(&macmsb))[1]; chip->mac_address[1] = ((u8 *)(&macmsb))[1];
mac_address[0] = ((u8 *)(&macmsb))[2]; chip->mac_address[0] = ((u8 *)(&macmsb))[2];
return 0; return 0;
} }
......
...@@ -116,7 +116,7 @@ int __devinit lx_dsp_get_version(struct lx6464es *chip, u32 *rdsp_version); ...@@ -116,7 +116,7 @@ int __devinit lx_dsp_get_version(struct lx6464es *chip, u32 *rdsp_version);
int lx_dsp_get_clock_frequency(struct lx6464es *chip, u32 *rfreq); int lx_dsp_get_clock_frequency(struct lx6464es *chip, u32 *rfreq);
int lx_dsp_set_granularity(struct lx6464es *chip, u32 gran); int lx_dsp_set_granularity(struct lx6464es *chip, u32 gran);
int lx_dsp_read_async_events(struct lx6464es *chip, u32 *data); int lx_dsp_read_async_events(struct lx6464es *chip, u32 *data);
int lx_dsp_get_mac(struct lx6464es *chip, u8 *mac_address); int lx_dsp_get_mac(struct lx6464es *chip);
/* low-level pipe handling */ /* low-level pipe handling */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment