Skip to contentSkip to conversation

I2C block read fixed size to 32

DISCUSSION Andre Fisser 2 participants 5 messages May 19, 2005

lore
Share & tools
lore
#0 lore raw

Hi,

are there plans to remove the fixed size of i2c block reads? I use the I2C driver to communicate through the printer port with a kind of Philips dongle to a custom microprocessor circuit. The fixed block size is wasting bus-bandwidth which is a problem for me.
I'm planning to remove this limitation myself if there's nobody already working on it. Maybe you guys have some advice for me how it can be best done?

Best regards,
Andre

Andr? Fisser

Imtech ICT Technical Systems
Flight Forum 800,
5657 DV Eindhoven

Telephone +31 (0)40 8484444

Fax       +31 (0)40 8484440 
Email     [email protected]  
www       www.imtech.nl 

Imtech ICT is een full service ICT-dienstverlener die op een no-nonsense manier bijdraagt aan het succes van haar klanten. Imtech ICT biedt hoogwaardige dienstverlening op het gebied van projectmanagement, advies, technische automatisering, informatisering en communicatietechnologie, en is onderdeel van het beursgenoteerde Imtech.

#1 lore raw

good question.

you want to make the size bigger or smaller?
I'll assume you are using a bit-banging (i2c-algo-bit) adatper here...

It's true, if you use the call i2c_smbus_read_i2c_block_data(),
the size is fixed at 32. This is enforced in these functions and in i2c_smbus_xfer_emulated().

You can avoid this limitation by making a direct call to i2c_transfer(), you should be able to find some drivers in the kernel that use i2c_transfer() as an example.

If you have a proposal on a clean way to set the size on calls to i2c_smbus_read_i2c_block_data()
we'll be happy to discuss it with you.

mds

Quoted 33 lines · Andre Fisser

Hi,

are there plans to remove the fixed size of i2c block reads? I use the I2C driver to communicate through the printer port with a kind of Philips dongle to a custom microprocessor circuit. The fixed block size is wasting bus-bandwidth which is a problem for me.
I'm planning to remove this limitation myself if there's nobody already working on it. Maybe you guys have some advice for me how it can be best done?

Best regards,
Andre

Andr? Fisser

Imtech ICT Technical Systems
Flight Forum 800,
5657 DV Eindhoven

Telephone +31 (0)40 8484444

Fax       +31 (0)40 8484440 
Email     [email protected]  
www       www.imtech.nl 

Imtech ICT is een full service ICT-dienstverlener die op een no-nonsense manier bijdraagt aan het succes van haar klanten. Imtech ICT biedt hoogwaardige dienstverlening op het gebied van projectmanagement, advies, technische automatisering, informatisering en communicatietechnologie, en is onderdeel van het beursgenoteerde Imtech.

#2 lore raw
In reply to Andre Fisser
Quoted 5 lines

Mark Studebaker wrote:

good question.

you want to make the size bigger or smaller?

I need it to be smaller, but a maximum size of 32 is o.k. for me.

Quoted 1 line

I'll assume you are using a bit-banging (i2c-algo-bit) adatper here...

Yes.

Quoted 9 lines

It's true, if you use the call i2c_smbus_read_i2c_block_data(),
the size is fixed at 32. This is enforced in these functions and in i2c_smbus_xfer_emulated().

You can avoid this limitation by making a direct call to i2c_transfer(), you should be able to find some drivers in the kernel that use i2c_transfer()
as an example.

I think that is too low level, I need to call that function from user-space; I don't want to make a special driver-module for my device.

Quoted 3 lines

If you have a proposal on a clean way to set the size on calls to i2c_smbus_read_i2c_block_data()
we'll be happy to discuss it with you.

I have a solution that works for me.
The changes I made are quite small. I changed the i2c_smbus_read_i2c_block_data function and added a length parameter. I think this is the right thing to do because only the I2C master knows how many byte to transfer. Then I pass the length in the i2c_smbus_data union in block[0] down to all driver sub-functions, as it is done in the _write_ functions. This allows me to adjust the block-size between 1..32, that's good enough for me.
Of course this is a change in the API and will probably break some existing clients. I don't have any, so no problem for me ;-) I don't know if this is acceptable for a future version of the i2c driver. And there is still a max. size of 32 bytes for the transfer, but changing that would require to allocate the buffer dynamically. I think that's not worth the effort required.

Groetjes,
Andre

Quoted 40 lines
Quoted 3 lines · Andre Fisser

Hi,

are there plans to remove the fixed size of i2c block

reads? I use the

Quoted 3 lines

I2C driver to communicate through the printer port with a kind of Philips dongle to a custom microprocessor circuit. The fixed block size is wasting bus-bandwidth which is a problem for me.

I'm planning

Quoted 1 line

to remove this limitation myself if there's nobody already

working on

Quoted 12 lines

it. Maybe you guys have some advice for me how it can be best done?

Best regards,
Andre

Andr? Fisser

Imtech ICT Technical Systems
Flight Forum 800,
5657 DV Eindhoven

Quoted 7 lines

Telephone +31 (0)40 8484444

Fax       +31 (0)40 8484440 
Email     [email protected]  
www       www.imtech.nl 

Imtech ICT is een full service ICT-dienstverlener die op een no-nonsense manier bijdraagt aan het succes van haar

klanten. Imtech

Quoted 2 lines

ICT biedt hoogwaardige dienstverlening op het gebied van projectmanagement, advies, technische automatisering,

informatisering

Quoted 5 lines

en communicatietechnologie, en is onderdeel van het beursgenoteerde Imtech.

#3 lore raw
In reply to Andre Fisser

so you are using the userspace i2c_smbus_read_i2c_block_data() call from i2c-dev.h, not the kernel one from i2c-core.c, correct?

Quoted 108 lines · Andre Fisser
Quoted 5 lines

Mark Studebaker wrote:

good question.

you want to make the size bigger or smaller?

I need it to be smaller, but a maximum size of 32 is o.k. for me.

Quoted 1 line

I'll assume you are using a bit-banging (i2c-algo-bit) adatper here...

Yes.

Quoted 9 lines

It's true, if you use the call i2c_smbus_read_i2c_block_data(),
the size is fixed at 32. This is enforced in these functions and in i2c_smbus_xfer_emulated().

You can avoid this limitation by making a direct call to i2c_transfer(), you should be able to find some drivers in the kernel that use i2c_transfer()
as an example.

I think that is too low level, I need to call that function from user-space; I don't want to make a special driver-module for my device.

Quoted 3 lines

If you have a proposal on a clean way to set the size on calls to i2c_smbus_read_i2c_block_data()
we'll be happy to discuss it with you.

I have a solution that works for me.
The changes I made are quite small. I changed the i2c_smbus_read_i2c_block_data function and added a length parameter. I think this is the right thing to do because only the I2C master knows how many byte to transfer. Then I pass the length in the i2c_smbus_data union in block[0] down to all driver sub-functions, as it is done in the _write_ functions. This allows me to adjust the block-size between 1..32, that's good enough for me.
Of course this is a change in the API and will probably break some existing clients. I don't have any, so no problem for me ;-) I don't know if this is acceptable for a future version of the i2c driver. And there is still a max. size of 32 bytes for the transfer, but changing that would require to allocate the buffer dynamically. I think that's not worth the effort required.

Groetjes,
Andre

Quoted 51 lines
Quoted 3 lines · Andre Fisser

Hi,

are there plans to remove the fixed size of i2c block

reads? I use the

Quoted 3 lines

I2C driver to communicate through the printer port with a kind of Philips dongle to a custom microprocessor circuit. The fixed block size is wasting bus-bandwidth which is a problem for me.

I'm planning

Quoted 1 line

to remove this limitation myself if there's nobody already

working on

Quoted 12 lines

it. Maybe you guys have some advice for me how it can be best done?

Best regards,
Andre

Andr? Fisser

Imtech ICT Technical Systems
Flight Forum 800,
5657 DV Eindhoven

Quoted 7 lines

Telephone +31 (0)40 8484444

Fax       +31 (0)40 8484440 
Email     [email protected]  
www       www.imtech.nl 

Imtech ICT is een full service ICT-dienstverlener die op een no-nonsense manier bijdraagt aan het succes van haar

klanten. Imtech

Quoted 2 lines

ICT biedt hoogwaardige dienstverlening op het gebied van projectmanagement, advies, technische automatisering,

informatisering

Quoted 5 lines

en communicatietechnologie, en is onderdeel van het beursgenoteerde Imtech.

#4 lore raw
In reply to Andre Fisser

Yes, I use the inline functions from i2c-dev.h.

Quoted 124 lines · Mark Studebaker

so you are using the userspace i2c_smbus_read_i2c_block_data() call from i2c-dev.h, not the kernel one from i2c-core.c, correct?

Quoted 11 lines · Andre Fisser
Quoted 5 lines

Mark Studebaker wrote:

good question.

you want to make the size bigger or smaller?

I need it to be smaller, but a maximum size of 32 is o.k. for me.

Quoted 1 line

I'll assume you are using a bit-banging (i2c-algo-bit)

adatper here...

Quoted 20 lines

Yes.

Quoted 8 lines

It's true, if you use the call i2c_smbus_read_i2c_block_data(), the size is fixed at 32. This is enforced in these functions and in i2c_smbus_xfer_emulated().

You can avoid this limitation by making a direct call to i2c_transfer(), you should be able to find some drivers in the kernel that use i2c_transfer()
as an example.

I think that is too low level, I need to call that function from user-space; I don't want to make a special driver-module for my device.

Quoted 8 lines
Quoted 3 lines

If you have a proposal on a clean way to set the size on calls to i2c_smbus_read_i2c_block_data()
we'll be happy to discuss it with you.

I have a solution that works for me.
The changes I made are quite small. I changed the i2c_smbus_read_i2c_block_data function and added a length

parameter. I think

Quoted 1 line

this is the right thing to do because only the I2C master

knows how many

Quoted 1 line

byte to transfer. Then I pass the length in the

i2c_smbus_data union in

Quoted 1 line

block[0] down to all driver sub-functions, as it is done in

the _write_

Quoted 1 line

functions. This allows me to adjust the block-size between

1..32, that's

Quoted 2 lines

good enough for me.
Of course this is a change in the API and will probably

break some existing

Quoted 1 line

clients. I don't have any, so no problem for me ;-) I don't

know if this is

Quoted 1 line

acceptable for a future version of the i2c driver. And

there is still a max.

Quoted 1 line

size of 32 bytes for the transfer, but changing that would

require to

Quoted 60 lines

allocate the buffer dynamically. I think that's not worth the effort required.

Groetjes,
Andre

Quoted 51 lines
Quoted 3 lines · Andre Fisser

Hi,

are there plans to remove the fixed size of i2c block

reads? I use the

Quoted 3 lines

I2C driver to communicate through the printer port with a kind of Philips dongle to a custom microprocessor circuit. The fixed block size is wasting bus-bandwidth which is a problem for me.

I'm planning

Quoted 1 line

to remove this limitation myself if there's nobody already

working on

Quoted 12 lines

it. Maybe you guys have some advice for me how it can be best done?

Best regards,
Andre

Andr? Fisser

Imtech ICT Technical Systems
Flight Forum 800,
5657 DV Eindhoven

Quoted 7 lines

Telephone +31 (0)40 8484444

Fax       +31 (0)40 8484440 
Email     [email protected]  
www       www.imtech.nl 

Imtech ICT is een full service ICT-dienstverlener die op een no-nonsense manier bijdraagt aan het succes van haar

klanten. Imtech

Quoted 2 lines

ICT biedt hoogwaardige dienstverlening op het gebied van projectmanagement, advies, technische automatisering,

informatisering

Quoted 5 lines

en communicatietechnologie, en is onderdeel van het beursgenoteerde Imtech.