diff options
-rw-r--r-- | sound/soc/fsl/mpc8610_hpcd.c | 13 | ||||
-rw-r--r-- | sound/soc/fsl/p1022_ds.c | 13 |
2 files changed, 16 insertions, 10 deletions
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c index ae49f1c78c6d..0ea4a5a96e06 100644 --- a/sound/soc/fsl/mpc8610_hpcd.c +++ b/sound/soc/fsl/mpc8610_hpcd.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
15 | #include <linux/of_device.h> | 15 | #include <linux/of_device.h> |
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | #include <linux/of_i2c.h> | ||
17 | #include <sound/soc.h> | 18 | #include <sound/soc.h> |
18 | #include <asm/fsl_guts.h> | 19 | #include <asm/fsl_guts.h> |
19 | 20 | ||
@@ -249,8 +250,9 @@ static int get_parent_cell_index(struct device_node *np) | |||
249 | static int codec_node_dev_name(struct device_node *np, char *buf, size_t len) | 250 | static int codec_node_dev_name(struct device_node *np, char *buf, size_t len) |
250 | { | 251 | { |
251 | const u32 *iprop; | 252 | const u32 *iprop; |
252 | int bus, addr; | 253 | int addr; |
253 | char temp[DAI_NAME_SIZE]; | 254 | char temp[DAI_NAME_SIZE]; |
255 | struct i2c_client *i2c; | ||
254 | 256 | ||
255 | of_modalias_node(np, temp, DAI_NAME_SIZE); | 257 | of_modalias_node(np, temp, DAI_NAME_SIZE); |
256 | 258 | ||
@@ -260,11 +262,12 @@ static int codec_node_dev_name(struct device_node *np, char *buf, size_t len) | |||
260 | 262 | ||
261 | addr = be32_to_cpup(iprop); | 263 | addr = be32_to_cpup(iprop); |
262 | 264 | ||
263 | bus = get_parent_cell_index(np); | 265 | /* We need the adapter number */ |
264 | if (bus < 0) | 266 | i2c = of_find_i2c_device_by_node(np); |
265 | return bus; | 267 | if (!i2c) |
268 | return -ENODEV; | ||
266 | 269 | ||
267 | snprintf(buf, len, "%s-codec.%u-%04x", temp, bus, addr); | 270 | snprintf(buf, len, "%s-codec.%u-%04x", temp, i2c->adapter->nr, addr); |
268 | 271 | ||
269 | return 0; | 272 | return 0; |
270 | } | 273 | } |
diff --git a/sound/soc/fsl/p1022_ds.c b/sound/soc/fsl/p1022_ds.c index 309162652287..a5d4e80a9cf4 100644 --- a/sound/soc/fsl/p1022_ds.c +++ b/sound/soc/fsl/p1022_ds.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
15 | #include <linux/of_device.h> | 15 | #include <linux/of_device.h> |
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | #include <linux/of_i2c.h> | ||
17 | #include <sound/soc.h> | 18 | #include <sound/soc.h> |
18 | #include <asm/fsl_guts.h> | 19 | #include <asm/fsl_guts.h> |
19 | 20 | ||
@@ -252,8 +253,9 @@ static int get_parent_cell_index(struct device_node *np) | |||
252 | static int codec_node_dev_name(struct device_node *np, char *buf, size_t len) | 253 | static int codec_node_dev_name(struct device_node *np, char *buf, size_t len) |
253 | { | 254 | { |
254 | const u32 *iprop; | 255 | const u32 *iprop; |
255 | int bus, addr; | 256 | int addr; |
256 | char temp[DAI_NAME_SIZE]; | 257 | char temp[DAI_NAME_SIZE]; |
258 | struct i2c_client *i2c; | ||
257 | 259 | ||
258 | of_modalias_node(np, temp, DAI_NAME_SIZE); | 260 | of_modalias_node(np, temp, DAI_NAME_SIZE); |
259 | 261 | ||
@@ -263,11 +265,12 @@ static int codec_node_dev_name(struct device_node *np, char *buf, size_t len) | |||
263 | 265 | ||
264 | addr = be32_to_cpup(iprop); | 266 | addr = be32_to_cpup(iprop); |
265 | 267 | ||
266 | bus = get_parent_cell_index(np); | 268 | /* We need the adapter number */ |
267 | if (bus < 0) | 269 | i2c = of_find_i2c_device_by_node(np); |
268 | return bus; | 270 | if (!i2c) |
271 | return -ENODEV; | ||
269 | 272 | ||
270 | snprintf(buf, len, "%s.%u-%04x", temp, bus, addr); | 273 | snprintf(buf, len, "%s.%u-%04x", temp, i2c->adapter->nr, addr); |
271 | 274 | ||
272 | return 0; | 275 | return 0; |
273 | } | 276 | } |