Skip to contentSkip to conversation

i2c_board_info use

DISCUSSION Luca Santini 2 participants 5 messages Jul 30, 2008 – Jul 31, 2008 SuperH

lore
Share & tools
lore
#0 lore raw

Hi,
i'm trying to register (with i2c_board_info()) a wm8731 i2c codec to solve "SMBus Quick command not supported" problem...

but i have no luck... where i'm wrong?

this is the i2c initialization in my board setup.c code:

<---------------------------

static struct platform_device *edosk7760_devices[] __initdata = {
	&sh7760_i2c0_dev,
	&sh7760_i2c1_dev,
	&smc91x_dev,
};
static struct i2c_board_info __initdata edosk7760_i2c_devices0[] = {
	{
		I2C_BOARD_INFO("WM8731 I2C Codec", 0x1a), //channel 0
		.irq = 62,
	},

	{
		I2C_BOARD_INFO("rtc-clk", 0x68), //channel 0
		.irq = 62,
	},
};

static struct i2c_board_info __initdata edosk7760_i2c_devices1[] = {

  	{
		I2C_BOARD_INFO("h8", 0x66), //channel 1
		.irq = 63,
	},
};
static int __init init_edosk7760_devices(void){
	int ret = -1;

	
	/* Setup smc91c96 Ethernet card: */


	i2c_register_board_info(0, edosk7760_i2c_devices0,
				ARRAY_SIZE(edosk7760_i2c_devices0));
				
	i2c_register_board_info(1, edosk7760_i2c_devices1,
				ARRAY_SIZE(edosk7760_i2c_devices1));
				
	SpesPrint("SPES init_edosk7760 - i2c_register_board_info done \n");


	ret = platform_add_devices(edosk7760_devices, 
ARRAY_SIZE(edosk7760_devices));
	SpesPrint("SPES init_edosk7760 - platform_add_devices done \n");


	return ret;
}

__initcall(init_edosk7760_devices);

<---------------------------

and this the i2c-related dmesg output:

<---------------------------

[    2.842880] i2c /dev entries driver
[    2.842995] device class 'i2c-dev': registering
[    2.843650] bus: 'i2c': add driver dev_driver
[    2.844475] i2c-core: driver [dev_driver] registered
[    2.844550] bus: 'platform': add driver sh7760-i2c
[    2.844671] bus: 'platform': driver_probe_device: matched device 
sh7760-i2c.0 with driver sh7760-i2c
[    2.844743] bus: 'platform': really_probe: probing driver sh7760-i2c 
with device sh7760-i2c.0
[    2.845174] device: 'i2c-0': device_add
[    2.846009] i2c-adapter i2c-0: adapter [SH7760 I2C at fe140000] 
registered
[    2.846100] device: '0-001a': device_add
[    2.846207] bus: 'i2c': add device 0-001a
[    2.846366] i2c 0-001a: uevent
[    2.846940] i2c-adapter i2c-0: client [WM8731 I2C Codec] registered 
with bus id 0-001a
[    2.847038] device: '0-0068': device_add
[    2.847190] bus: 'i2c': add device 0-0068
[    2.847351] i2c 0-0068: uevent
[    2.847927] i2c-adapter i2c-0: client [rtc-clk] registered with bus 
id 0-0068
[    2.848024] device: 'i2c-0': device_add
[    2.848810] i2c-dev: adapter [SH7760 I2C at fe140000] registered as 
minor 0
[    2.848894] sh7760-i2c sh7760-i2c.0: 400 kHz mmio fe140000 irq 62
[    2.849313] driver: 'sh7760-i2c.0': driver_bound: bound to device 
'sh7760-i2c'
[    2.849378] bus: 'platform': really_probe: bound device sh7760-i2c.0 
to driver sh7760-i2c
[    2.849457] bus: 'platform': driver_probe_device: matched device 
sh7760-i2c.1 with driver sh7760-i2c
[    2.849525] bus: 'platform': really_probe: probing driver sh7760-i2c 
with device sh7760-i2c.1
[    2.849884] device: 'i2c-1': device_add
[    2.850961] i2c-adapter i2c-1: adapter [SH7760 I2C at fe150000] 
registered
[    2.851053] device: '1-0066': device_add
[    2.851291] bus: 'i2c': add device 1-0066
[    2.851551] i2c 1-0066: uevent
[    2.852194] i2c-adapter i2c-1: client [h8] registered with bus id 1-0066
[    2.852294] device: 'i2c-1': device_add
[    2.853076] i2c-dev: adapter [SH7760 I2C at fe150000] registered as 
minor 1
[    2.853160] sh7760-i2c sh7760-i2c.1: 400 kHz mmio fe150000 irq 63
[    2.855361] driver: 'sh7760-i2c.1': driver_bound: bound to device 
'sh7760-i2c'
[    2.855427] bus: 'platform': really_probe: bound device sh7760-i2c.1 
to driver sh7760-i2c
[    2.856486] device class 'sound': registering
[    2.857292] Advanced Linux Sound Architecture Driver Version 1.0.16.
[    2.861832] device: 'timer': device_add
[    2.862706] ASoC version 0.13.2
[    2.864971] bus: 'platform': add driver soc-audio
[    2.865750] EDOSK7760 I2S Audio support
[    2.868712] Registering platform device 'soc-audio'. Parent at platform
[    2.868773] device: 'soc-audio': device_add
[    2.868888] bus: 'platform': add device soc-audio
[    2.869629] bus: 'platform': driver_probe_device: matched device 
soc-audio with driver soc-audio
[    2.869710] bus: 'platform': really_probe: probing driver soc-audio 
with device soc-audio
[    2.869825] wm8731: WM8731 Audio Codec 0.13
[    2.872922] bus: 'i2c': add driver WM8731 I2C Codec
[    2.873699] i2c-core: driver [WM8731 I2C Codec] registered
[    2.874887] i2c-adapter i2c-0: SMBus Quick command not supported, 
can't probe for chips
[    2.885000] i2c-adapter i2c-1: SMBus Quick command not supported, 
can't probe for chips
[    2.893040] driver: 'soc-audio': driver_bound: bound to device 
'soc-audio'
[    2.893112] bus: 'platform': really_probe: bound device soc-audio to 
driver soc-audio
[    2.893194] ALSA device list:
[    2.895952]   No soundcards found.

<---------------------------

#1 lore raw

can you suggest a new-style driver for inspiration?

thanks

Quoted 15 lines · Manuel Lauss
Quoted 5 lines · Luca Santini

Hi,
i'm trying to register (with i2c_board_info()) a wm8731 i2c codec to solve "SMBus Quick command not supported" problem...

but i have no luck... where i'm wrong?

The Problem is with the wm8731.c codec driver: it still isn't converted from old-style I2C probing (attach_adapter / detach_client) to new-style (probe/remove). Old-style still requires a working SMBus quick implementation
in the i2c bus driver.

So in short, you need to improve the wm8731.c codec.

#2 lore raw
In reply to Luca Santini
Quoted 2 lines · Luca Santini

can you suggest a new-style driver for inspiration?

This might help. I wrote an AD1939 driver a year ago which went into the ASoC tree with old-style I2C probe code.

Here's the version with old-style probing:
http://opensource.wolfsonmicro.com/cgi-bin/gitweb.cgi?p=linux-2.6-asoc.git;a=blob;f=sound/soc/codecs/ad1939.c;hîe858acddcb5a414a52f862204a6a2c4d519239;hbfbaddfbb16309c37f02341425b13046af3f215

And here's a version with new-style probing.
http://mlau.at/files/ad1939.c

You should be able to use the differences in the i2c probe of the 2 versions as a template for wm8731 conversion.

(I once had a patch to i2c-sh7760.c which implemented SMBus quick
in a crude, non-i2c-maintainer-compatible way, let me see if I can dig it up again...)

Good luck!
Manuel Lauss

#3 lore raw
In reply to Luca Santini

Thanks Manuel.
I'm trying the conversion.
A last (i hope for you) question: i cross-compiled alsa-lib and alsa-utils but i don't know how to configure alsa without alsaconf and alsamixer (no lspci, no lsmod, no ncurses avaiable)

Quoted 30 lines · Manuel Lauss
Quoted 2 lines · Luca Santini

can you suggest a new-style driver for inspiration?

This might help. I wrote an AD1939 driver a year ago which went into the ASoC tree with old-style I2C probe code.

Here's the version with old-style probing:
http://opensource.wolfsonmicro.com/cgi-bin/gitweb.cgi?p=linux-2.6-asoc.git;a=blob;f=sound/soc/codecs/ad1939.c;hîe858acddcb5a414a52f862204a6a2c4d519239;hbfbaddfbb16309c37f02341425b13046af3f215

And here's a version with new-style probing.
http://mlau.at/files/ad1939.c

You should be able to use the differences in the i2c probe of the 2 versions as a template for wm8731 conversion.

(I once had a patch to i2c-sh7760.c which implemented SMBus quick
in a crude, non-i2c-maintainer-compatible way, let me see if I can dig it up again...)

Good luck!
Manuel Lauss

Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw
In reply to Luca Santini
Quoted 5 lines · Luca Santini

Thanks Manuel.
I'm trying the conversion.
A last (i hope for you) question: i cross-compiled alsa-lib and alsa-utils but i don't know how to configure alsa without alsaconf and alsamixer (no lspci, no lsmod, no ncurses avaiable)

As far as I know, you just need to install alsa-lib correctly on the target (make sure you have a /usr/share/alsa/alsa.conf file).

Manuel Lauss