All of lore.kernel.org
 help / color / mirror / Atom feed
* Regulator question regarding I2C devices
@ 2011-01-28 22:24 Peter Barada
  2011-01-29 17:34 ` Matthias Kaehlcke
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Barada @ 2011-01-28 22:24 UTC (permalink / raw)
  To: linux-omap, Peter Barada

I have a tsc2004 touch controller on I2C3 that is powered by vaux1, and since its probed I have to turn the power on before it can be probed.  I've created:

static struct regulator_consumer_supply dm3730logic_vaux1_supply = {
    .supply            = "vaux1",
};

/* VAUX1 for touch chip */
static struct regulator_init_data dm3730logic_vaux1 = {
    .constraints = {
        .min_uV        = 3000000,
        .max_uV        = 3000000,
        .apply_uV    = true,
        .valid_modes_mask    = REGULATOR_MODE_NORMAL
                    | REGULATOR_MODE_STANDBY,
        .valid_ops_mask        = REGULATOR_CHANGE_MODE
                    | REGULATOR_CHANGE_STATUS,
    },
    .num_consumer_supplies    = 1,
    .consumer_supplies    = &dm3730logic_vaux1_supply,
};

and listed it in the twldata initializer
    .vaux1        = &dm3730logic_vaux1,

But it never gets enabled...  How can I tell the kernel to turn the regulator on?

If I try to call regulator_get() right before the call to omap_register_i2c_bus for I2C3, regulator_get returns a NULL due to regulator_map_list being empty.  If I look in sys/class/regulator I see VAUX1 listed (as regulator.4), but there are no users.

Any suggestions on how I can turn on vaux1 so the tsc2004 touch controller is visible to by the I2C system?

Thanks in advance!

-- 
Peter Barada
peter.barada@logicpd.com


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

* Re: Regulator question regarding I2C devices
  2011-01-28 22:24 Regulator question regarding I2C devices Peter Barada
@ 2011-01-29 17:34 ` Matthias Kaehlcke
  2011-01-29 19:58   ` Peter Barada
  0 siblings, 1 reply; 3+ messages in thread
From: Matthias Kaehlcke @ 2011-01-29 17:34 UTC (permalink / raw)
  To: Peter Barada; +Cc: linux-omap

Hi Peter,

El Fri, Jan 28, 2011 at 05:24:01PM -0500 Peter Barada ha dit:

> I have a tsc2004 touch controller on I2C3 that is powered by vaux1,
> and since its probed I have to turn the power on before it can be
> probed.
>
> I've created:
> 
> static struct regulator_consumer_supply dm3730logic_vaux1_supply = {
>     .supply            = "vaux1",
> };
> 
> /* VAUX1 for touch chip */
> static struct regulator_init_data dm3730logic_vaux1 = {
>     .constraints = {
>         .min_uV        = 3000000,
>         .max_uV        = 3000000,
>         .apply_uV    = true,
>         .valid_modes_mask    = REGULATOR_MODE_NORMAL
>                     | REGULATOR_MODE_STANDBY,
>         .valid_ops_mask        = REGULATOR_CHANGE_MODE
>                     | REGULATOR_CHANGE_STATUS,
>     },
>     .num_consumer_supplies    = 1,
>     .consumer_supplies    = &dm3730logic_vaux1_supply,
> };
> 
> and listed it in the twldata initializer
>     .vaux1        = &dm3730logic_vaux1,
> 
> But it never gets enabled...  How can I tell the kernel to turn the regulator on?
> 
> If I try to call regulator_get() right before the call to omap_register_i2c_bus for I2C3, regulator_get returns a NULL due to regulator_map_list being empty.  If I look in sys/class/regulator I see VAUX1 listed (as regulator.4), but there are no users.
> 
> Any suggestions on how I can turn on vaux1 so the tsc2004 touch
> controller is visible to by the I2C system?

I guess the problem is that the regulators aren't initialized when you
call regulator_get() before the i2c bus registration

I think the right thing is to do the regulator handling inside the
tsc2004 driver

The ADS7846 touchscreen driver (drivers/input/touchscreen/ads7846.c)
in combination with the TimLL Devkit8000 board
(arch/arm/mach-omap2/board-devkit8000.c) can serve you as a reference

Best regards

-- 
Matthias Kaehlcke
Embedded Linux Developer
Amsterdam

              You can't separate peace from freedom because no
               one can be at peace unless he has his freedom
                              (Malcolm X)
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-

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

* Re: Regulator question regarding I2C devices
  2011-01-29 17:34 ` Matthias Kaehlcke
@ 2011-01-29 19:58   ` Peter Barada
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Barada @ 2011-01-29 19:58 UTC (permalink / raw)
  To: Matthias Kaehlcke; +Cc: Peter Barada, linux-omap

On 01/29/2011 12:34 PM, Matthias Kaehlcke wrote:
> Hi Peter,
>
> El Fri, Jan 28, 2011 at 05:24:01PM -0500 Peter Barada ha dit:
>
>> I have a tsc2004 touch controller on I2C3 that is powered by vaux1,
>> and since its probed I have to turn the power on before it can be
>> probed.
>>
>> I've created:
>>
>> static struct regulator_consumer_supply dm3730logic_vaux1_supply = {
>>     .supply            = "vaux1",
>> };
>>
>> /* VAUX1 for touch chip */
>> static struct regulator_init_data dm3730logic_vaux1 = {
>>     .constraints = {
>>         .min_uV        = 3000000,
>>         .max_uV        = 3000000,
>>         .apply_uV    = true,
>>         .valid_modes_mask    = REGULATOR_MODE_NORMAL
>>                     | REGULATOR_MODE_STANDBY,
>>         .valid_ops_mask        = REGULATOR_CHANGE_MODE
>>                     | REGULATOR_CHANGE_STATUS,
>>     },
>>     .num_consumer_supplies    = 1,
>>     .consumer_supplies    = &dm3730logic_vaux1_supply,
>> };
>>
>> and listed it in the twldata initializer
>>     .vaux1        = &dm3730logic_vaux1,
>>
>> But it never gets enabled...  How can I tell the kernel to turn the regulator on?
>>
>> If I try to call regulator_get() right before the call to omap_register_i2c_bus for I2C3, regulator_get returns a NULL due to regulator_map_list being empty.  If I look in sys/class/regulator I see VAUX1 listed (as regulator.4), but there are no users.
>>
>> Any suggestions on how I can turn on vaux1 so the tsc2004 touch
>> controller is visible to by the I2C system?
> I guess the problem is that the regulators aren't initialized when you
> call regulator_get() before the i2c bus registration
>
> I think the right thing is to do the regulator handling inside the
> tsc2004 driver
>
> The ADS7846 touchscreen driver (drivers/input/touchscreen/ads7846.c)
> in combination with the TimLL Devkit8000 board
> (arch/arm/mach-omap2/board-devkit8000.c) can serve you as a reference
Thanks; figured it out late last night and have it working.  I added two more hooks to the tsc2004.c driver, "pre_init_platform_hw" and "post_exit_platform_hw" that each take the pdata pointer as well as the regulator.  Then in my board file I get/enable the regulator in the pre_init hook, and disable/put the regulator in the post_exit hook....
> Best regards
>


-- 
Peter Barada
peter.barada@gmail.com


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

end of thread, other threads:[~2011-01-29 19:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-28 22:24 Regulator question regarding I2C devices Peter Barada
2011-01-29 17:34 ` Matthias Kaehlcke
2011-01-29 19:58   ` Peter Barada

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.