public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* need soem help realter to I2C client
@ 2008-09-19  6:33 kalhan trisal
       [not found] ` <697640.78220.qm-4UY5Ii0Ri9vS1Wi2ZBor9F5cfvJIxWXgQQ4Iyu8u01E@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: kalhan trisal @ 2008-09-19  6:33 UTC (permalink / raw)
  To: i2c-GZX6beZjE8VD60Wz+7aTrA

Hello, 
   I have platform which has 5 hw devices and I want single driver to control all the devices. I donot need probe as I know the devices are present and I know all the slave address. The interface for read write is using sysfs and I am planning to put it under hwmon. These all devices are separate chips.

   Can I do this please let me know.


 struct foo_data { 
    struct i2c_client client_data[5]; 
   }; 

int foo_detect_client(struct i2c_adapter *adapter, int address,  
                         unsigned short flags, int kind) 
{ 
     int err = 0; 
     int i; 
     int addrtemp[]= {0x42,0x45,0x46,0x47,0x48};
     struct i2c_client *new_client; 
     struct foo_data *data; 
     const char *client_name = "";
     
      For(i=0;i<5;i++)
      {
           new_client = &data->client_data[i];
           new_client->addr = addrtemp[i]; 
           new_client->data = data; //lets consider it is same 
           new_client->adapter = adapter; 
           new_client->driver = &foo_driver; 
           new_client->flags = 0; 
     
           strcpy(new_client->name,client_name); 
          /* Tell the i2c layer a new client has arrived */ 
          if ((err = i2c_attach_client(new_client))) 
      }
}

Thanks
Kalhan 

--- On Thu, 18/9/08, Rudolf Marek <r.marek-/xGekIyIa4Ap1Coe8Ar9gA@public.gmane.org> wrote:

> From: Rudolf Marek <r.marek-/xGekIyIa4Ap1Coe8Ar9gA@public.gmane.org>
> Subject: Re: need soem help realter to I2C
> To: kalhantrisal-/E1597aS9LQAvxtiuMwx3w@public.gmane.org
> Date: Thursday, 18 September, 2008, 8:01 PM
> Hello,
> 
> I'm very busy those days, but I think you will get the
> answer on I2C mailing 
> list. You dont need to be subscribed. But please be more
> specic what do you mean 
> by adapter, the sw entity in i2c subsys or real adapter?
> Are you writing your 
> own driver? Please explain there what you want to do more
> globaly.
> 
> Please mail your question there, I can reply later,
> 
> Here is the mail i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
> 
> Rudolf


      Unlimited freedom, unlimited storage. Get it now, on http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: need soem help realter to I2C client
       [not found] ` <697640.78220.qm-4UY5Ii0Ri9vS1Wi2ZBor9F5cfvJIxWXgQQ4Iyu8u01E@public.gmane.org>
@ 2008-09-19 12:42   ` Jean Delvare
       [not found]     ` <20080919144231.780fb37a-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Jean Delvare @ 2008-09-19 12:42 UTC (permalink / raw)
  To: kalhan trisal; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA

Hi Kalhan,

On Fri, 19 Sep 2008 12:03:56 +0530 (IST), kalhan trisal wrote:
> Hello, 
>    I have platform which has 5 hw devices and I want single driver
> to control all the devices.

Bad idea. This will make your code non-reusable, meaning that nobody
will be interested in it.

> I donot need probe as I know the devices are present and I know all
> the slave address. The interface for read write is using sysfs and
> I am planning to put it under hwmon. These all devices are separate
> chips.
> 
>    Can I do this please let me know.
> 
> 
>  struct foo_data { 
>     struct i2c_client client_data[5]; 
>    }; 
> 
> int foo_detect_client(struct i2c_adapter *adapter, int address,  
>                          unsigned short flags, int kind) 

This interface is deprecated, so no new driver will be allowed to use
it. Please use the (new) standard .probe() method instead.

> { 
>      int err = 0; 
>      int i; 
>      int addrtemp[]= {0x42,0x45,0x46,0x47,0x48};
>      struct i2c_client *new_client; 
>      struct foo_data *data; 
>      const char *client_name = "";
>      
>       For(i=0;i<5;i++)
>       {

You will have to fix your coding style as well.

>            new_client = &data->client_data[i];
>            new_client->addr = addrtemp[i]; 
>            new_client->data = data; //lets consider it is same 
>            new_client->adapter = adapter; 
>            new_client->driver = &foo_driver; 
>            new_client->flags = 0; 
>      
>            strcpy(new_client->name,client_name); 
>           /* Tell the i2c layer a new client has arrived */ 
>           if ((err = i2c_attach_client(new_client))) 
>       }
> }

-- 
Jean Delvare

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 12+ messages in thread

* tvp5150 new style i2c driver
       [not found]     ` <20080919144231.780fb37a-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
@ 2008-09-19 13:04       ` Luca Santini
       [not found]         ` <48D3A36D.1090001-wNesuFfO2Ajz1n+OaKNE4w@public.gmane.org>
  2008-09-19 15:04       ` Luca Santini
  2008-09-19 15:27       ` Luca Santini
  2 siblings, 1 reply; 12+ messages in thread
From: Luca Santini @ 2008-09-19 13:04 UTC (permalink / raw)
  To: Jean Delvare; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA

Hi Jean,
i need to interface with a TI tvp5150, wired via i2c on my custom board.

i'm on kernel 2.6.27git and i found there's a driver for the codec... but i get the 'SMBus not supported' error when i try to enable it. So old style coding...
I was trying to convert it to new-style when i found on the ML Archive you had some similar problem....

do you have some pre-coded patch for me? 


After i made it work, how to communicate with it?



thanks,

Luca Santini


_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: tvp5150 new style i2c driver
       [not found]         ` <48D3A36D.1090001-wNesuFfO2Ajz1n+OaKNE4w@public.gmane.org>
@ 2008-09-19 13:23           ` Jean Delvare
  0 siblings, 0 replies; 12+ messages in thread
From: Jean Delvare @ 2008-09-19 13:23 UTC (permalink / raw)
  To: Luca Santini; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA

Hi Luca,

On Fri, 19 Sep 2008 15:04:45 +0200, Luca Santini wrote:
> Hi Jean,
> i need to interface with a TI tvp5150, wired via i2c on my custom board.

This is unrelated with the problem that was discussed in this thread.
Please start new threads for new topics.

Thanks,
-- 
Jean Delvare

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 12+ messages in thread

* tvp5150 new style i2c driver
       [not found]     ` <20080919144231.780fb37a-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
  2008-09-19 13:04       ` tvp5150 new style i2c driver Luca Santini
@ 2008-09-19 15:04       ` Luca Santini
       [not found]         ` <48D3BF65.1020201-wNesuFfO2Ajz1n+OaKNE4w@public.gmane.org>
  2008-09-19 15:27       ` Luca Santini
  2 siblings, 1 reply; 12+ messages in thread
From: Luca Santini @ 2008-09-19 15:04 UTC (permalink / raw)
  To: i2c-GZX6beZjE8VD60Wz+7aTrA

Hi,
i need to interface with a TI tvp5150 (video codec), wired via i2c on my custom board.

i'm on kernel 2.6.27git and i found there's a driver for the codec... but i get the 'SMBus not supported' error when i try to enable it. So old style coding...
I was trying to convert it to new-style when i found on the ML Archive someone had some similar problem....

do somebody have some pre-coded patch for me? 


After i made it work, how to communicate with it?



thanks,
Luca Santini


p.s. i have no idea how previous post fallen into the wrong thread !

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: tvp5150 new style i2c driver
       [not found]         ` <48D3BF65.1020201-wNesuFfO2Ajz1n+OaKNE4w@public.gmane.org>
@ 2008-09-19 15:25           ` Jean Delvare
  0 siblings, 0 replies; 12+ messages in thread
From: Jean Delvare @ 2008-09-19 15:25 UTC (permalink / raw)
  To: Luca Santini; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA

On Fri, 19 Sep 2008 17:04:05 +0200, Luca Santini wrote:
> p.s. i have no idea how previous post fallen into the wrong thread !

Actually you just did it again. Presumably, you're using "Reply"
instead of "Compose" (or "New", whatever your e-mail client calls it.)
When you do that, threading clients (such as the list archive) mix
unrelated topics in the same discussion thread and that makes things
difficult to follow and find if you look for them later.

-- 
Jean Delvare

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 12+ messages in thread

* tvp5150 new style i2c driver
       [not found]     ` <20080919144231.780fb37a-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
  2008-09-19 13:04       ` tvp5150 new style i2c driver Luca Santini
  2008-09-19 15:04       ` Luca Santini
@ 2008-09-19 15:27       ` Luca Santini
  2 siblings, 0 replies; 12+ messages in thread
From: Luca Santini @ 2008-09-19 15:27 UTC (permalink / raw)
  To: i2c-GZX6beZjE8VD60Wz+7aTrA

Hi,
i need to interface with a TI tvp5150 (video codec), wired via i2c on my custom board.

i'm on kernel 2.6.27git and i found there's a driver for the codec... but i get the 'SMBus not supported' error when i try to enable it. So old style coding...
I was trying to convert it to new-style when i found on the ML Archive someone had some similar problem....

do somebody have some pre-coded patch for me? 


After i made it work, how to communicate with it?



thanks,
Luca Santini


p.s. i have no idea how previous post fallen into the wrong thread !


_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 12+ messages in thread

* tvp5150 new style i2c driver
@ 2008-09-19 15:30 Luca Santini
       [not found] ` <48D3C5A3.3080802-wNesuFfO2Ajz1n+OaKNE4w@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Luca Santini @ 2008-09-19 15:30 UTC (permalink / raw)
  To: i2c-GZX6beZjE8VD60Wz+7aTrA

Hi,
i need to interface with a TI tvp5150 (video codec), wired via i2c on my custom board.

i'm on kernel 2.6.27git and i found there's a driver for the codec... but i get the 'SMBus not supported' error when i try to enable it. So old style coding...
I was trying to convert it to new-style when i found on the ML Archive someone had some similar problem....

do somebody have some pre-coded patch for me? 


After i made it work, how to communicate with it?



thanks,
Luca Santini


p.s. i have no idea how previous post fallen into the wrong thread !

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: tvp5150 new style i2c driver
       [not found] ` <48D3C5A3.3080802-wNesuFfO2Ajz1n+OaKNE4w@public.gmane.org>
@ 2008-09-19 20:26   ` Jean Delvare
       [not found]     ` <48D41902.9020804@spesonline.com>
  0 siblings, 1 reply; 12+ messages in thread
From: Jean Delvare @ 2008-09-19 20:26 UTC (permalink / raw)
  To: Luca Santini; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA

Hi Luca,

On Fri, 19 Sep 2008 17:30:43 +0200, Luca Santini wrote:
> i need to interface with a TI tvp5150 (video codec), wired via
> i2c on my custom board.

Which board is that? In particular, which i2c bus drivers are you using?

> i'm on kernel 2.6.27git and i found there's a driver for the
> codec... but i get the 'SMBus not supported' error when i try
> to enable it.

I can't find the error message "SMBus not supported" anywhere in the
kernel tree, what is the exact error message?

> So old style coding...

New-style i2c drivers don't have much to do with what the underlying i2c
bus driver supports. Legacy vs. new-style is about how the devices are
created.

> I was trying to convert it to new-style when i found on the ML
> Archive someone had some similar problem....
>
> do somebody have some pre-coded patch for me?

Which mailing list archive? I can't remember any post related to the
tvp5150 driver before yours on the i2c list.
 
> After i made it work, how to communicate with it?

Not a question for this mailing list. Better ask the v4l people.

-- 
Jean Delvare

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: tvp5150 new style i2c driver
       [not found]       ` <48D41902.9020804-wNesuFfO2Ajz1n+OaKNE4w@public.gmane.org>
@ 2008-09-20  8:16         ` Jean Delvare
       [not found]           ` <20080920101623.791ed72f-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Jean Delvare @ 2008-09-20  8:16 UTC (permalink / raw)
  To: Luca Santini; +Cc: Linux I2C

Hi Luca,

Please keep the i2c list Cc'd.

On Fri, 19 Sep 2008 23:26:26 +0200, Luca Santini wrote:
> My board is a custom board based on a Renesas SH4 cpu (sh7760). 
> This uP has 2 i2c channels where i have a tvp5150 video codec, a
> wm8731 audio codec , a realtime clock and a renesas h8  connected
> to; so my i2c bus is drivers/i2c/busses/i2c-sh7760.c .
> 
> my goal - regarding tvp5150 - is to initialize it and set it's
> input (to composite, for the moment).
> The digital video output is 'directly' (there's only a mux
> controlled by H8 beetween) connected to GPU (fujitsu lime).
> (...)
> "SMBus Quick command not supported, " in drivers/i2c/i2c-core.c
> sorry for previous imprecision.

Indeed, the i2c-sh7760 driver doesn't support the SMBus Quick command.
This means that devices on that bus can't be probed. You can still use
legacy i2c drivers on that bus; all you have to do is load them with
the "force" parameter:

modprobe tvp5150 force=0,0x5c

(Adjust for the actual bus number and device address on your system.)

Admittedly, with a new-style i2c driver you would no longer have to do
that. That being said, that's only a small part of your problem. The
other part is that you need some glue code to register a video device
through which you can control your TVP5150 chip.

> (...)
> http://lists.lm-sensors.org/pipermail/i2c/2007-June/001462.html

Ah, right. Well, did you try contacting Jorge Luis Zapata Muga about
this? If someone did some work on the tvp5150 driver, that would be
him. I plan to convert all i2c drivers in the kernel tree to new-style
drivers eventually, but I have no plan to work on the tvp5150 driver in
a near future.

> so my interface will be something like /dev/video ?

Yes.

> I'll be able to change i.e. sources by this?

I do not understand your question, sorry.

-- 
Jean Delvare

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: tvp5150 new style i2c driver
       [not found]           ` <20080920101623.791ed72f-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
@ 2008-09-20  9:10             ` Luca Santini
       [not found]               ` <48D4BDF9.8050003-wNesuFfO2Ajz1n+OaKNE4w@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Luca Santini @ 2008-09-20  9:10 UTC (permalink / raw)
  To: Jean Delvare, i2c-GZX6beZjE8VD60Wz+7aTrA



Jean Delvare wrote:
> Hi Luca,
> 
> Please keep the i2c list Cc'd.
> 
> On Fri, 19 Sep 2008 23:26:26 +0200, Luca Santini wrote:
>> My board is a custom board based on a Renesas SH4 cpu (sh7760). 
>> This uP has 2 i2c channels where i have a tvp5150 video codec, a
>> wm8731 audio codec , a realtime clock and a renesas h8  connected
>> to; so my i2c bus is drivers/i2c/busses/i2c-sh7760.c .
>>
>> my goal - regarding tvp5150 - is to initialize it and set it's
>> input (to composite, for the moment).
>> The digital video output is 'directly' (there's only a mux
>> controlled by H8 beetween) connected to GPU (fujitsu lime).
>> (...)
>> "SMBus Quick command not supported, " in drivers/i2c/i2c-core.c
>> sorry for previous imprecision.
> 
> Indeed, the i2c-sh7760 driver doesn't support the SMBus Quick command.
> This means that devices on that bus can't be probed. You can still use
> legacy i2c drivers on that bus; all you have to do is load them with
> the "force" parameter:
> 
> modprobe tvp5150 force=0,0x5c
> 
> (Adjust for the actual bus number and device address on your system.)
> 

Ok, it's helpful.

> Admittedly, with a new-style i2c driver you would no longer have to do
> that. That being said, that's only a small part of your problem. The
> other part is that you need some glue code to register a video device
> through which you can control your TVP5150 chip.
> 

Oh... ok. Some example? glue code beetween the codec and...? can i bypass v4l ?

>> (...)
>> http://lists.lm-sensors.org/pipermail/i2c/2007-June/001462.html
> 
> Ah, right. Well, did you try contacting Jorge Luis Zapata Muga about
> this? If someone did some work on the tvp5150 driver, that would be
> him. 

I'll try, thanks.


I plan to convert all i2c drivers in the kernel tree to new-style
> drivers eventually, but I have no plan to work on the tvp5150 driver in
> a near future.
> 
>> so my interface will be something like /dev/video ?
> 
> Yes.
> 
>> I'll be able to change i.e. sources by this?
> 
> I do not understand your question, sorry.
> 

My short-term goal is only initialize the codec and set the input source to composite ('sources' was in this sense.).
I think  - as a quick and dirty solution - i'll copy the init code from the kernel driver and do this in userspace using /dev/i2c-X interface. But that's very ugly... ...but on the other hand i don't need (and i don't know how to use) a full v4l interface...

cheers,

Luca






_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: tvp5150 new style i2c driver
       [not found]               ` <48D4BDF9.8050003-wNesuFfO2Ajz1n+OaKNE4w@public.gmane.org>
@ 2008-09-20  9:36                 ` Jean Delvare
  0 siblings, 0 replies; 12+ messages in thread
From: Jean Delvare @ 2008-09-20  9:36 UTC (permalink / raw)
  To: Luca Santini; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA

On Sat, 20 Sep 2008 11:10:17 +0200, Luca Santini wrote:
> Oh... ok. Some example? glue code beetween the codec and...?

I am not aware of an example (of embedded platform with a video decoder
chip on a generic I2C bus) in the kernel at this point. But it
shouldn't be too different from regular v4l code. The only difference
being that the I2C bus code will be in a separate module, so you need
to get a reference to the i2c_adapter your chip is on. Presumably you
know the bus numbers in advance so you should be able to use
i2c_get_adapter() for that.

> can i bypass v4l ?

You can certainly bypass v4l if you want. It might make sense if you
can't afford the overhead. But on the other hand, implementing the
standard v4l interface has the huge benefit that you can then use all
the standard tools, and I doubt the overhead is that much.

> (...)
> My short-term goal is only initialize the codec and set the input
> source to composite ('sources' was in this sense.).
> I think  - as a quick and dirty solution - i'll copy the init code
> from the kernel driver and do this in userspace using /dev/i2c-X
> interface. But that's very ugly... ...but on the other hand i
> don't need (and i don't know how to use) a full v4l interface...

Using i2c-dev should work fine, even though I agree it's not
particularly elegant.

-- 
Jean Delvare

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2008-09-20  9:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-19  6:33 need soem help realter to I2C client kalhan trisal
     [not found] ` <697640.78220.qm-4UY5Ii0Ri9vS1Wi2ZBor9F5cfvJIxWXgQQ4Iyu8u01E@public.gmane.org>
2008-09-19 12:42   ` Jean Delvare
     [not found]     ` <20080919144231.780fb37a-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-09-19 13:04       ` tvp5150 new style i2c driver Luca Santini
     [not found]         ` <48D3A36D.1090001-wNesuFfO2Ajz1n+OaKNE4w@public.gmane.org>
2008-09-19 13:23           ` Jean Delvare
2008-09-19 15:04       ` Luca Santini
     [not found]         ` <48D3BF65.1020201-wNesuFfO2Ajz1n+OaKNE4w@public.gmane.org>
2008-09-19 15:25           ` Jean Delvare
2008-09-19 15:27       ` Luca Santini
  -- strict thread matches above, loose matches on Subject: below --
2008-09-19 15:30 Luca Santini
     [not found] ` <48D3C5A3.3080802-wNesuFfO2Ajz1n+OaKNE4w@public.gmane.org>
2008-09-19 20:26   ` Jean Delvare
     [not found]     ` <48D41902.9020804@spesonline.com>
     [not found]       ` <48D41902.9020804-wNesuFfO2Ajz1n+OaKNE4w@public.gmane.org>
2008-09-20  8:16         ` Jean Delvare
     [not found]           ` <20080920101623.791ed72f-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-09-20  9:10             ` Luca Santini
     [not found]               ` <48D4BDF9.8050003-wNesuFfO2Ajz1n+OaKNE4w@public.gmane.org>
2008-09-20  9:36                 ` Jean Delvare

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox