> -----Original Message-----
> From: Mark Brown [mailto:broo...@kernel.org] 
> Sent: Tuesday, May 28, 2013 6:04 PM
> To: yi zhang
> Cc: Liam Girdwood; Chao Xie; jett.z...@marvell.com; 
> linux-kernel@vger.kernel.org; Yi Zhang
> Subject: Re: [PATCH] regulator: 88pm800: add regulator driver
> 
> On Tue, May 28, 2013 at 10:32:09AM +0800, yi zhang wrote:
>
>> HI, Brown:

>> In western culture it's either "Hi Mark" or "Hi Mr Brown" (though the latter 
>> is pretty formal so not used much for things like mailing lists).
>
>>           Sorry I'm a little confused:
>>           You mean I should use a function for example 
>> "create_buck_table()" to create the BUCK voltage table?
>>            such as:
>>            void create_buck_table()
>>            {
>>                    if (voltage < 1587500) {
>>                              /* initialize the BUCK_table */
>>                    } else
>>                              /* initialize the BUCK_table */
>>            }
>
> No, I mean you shouldn't be using a table at all but have mapping and list 
> functions which just do the calculation required to generate the tables 
> directly.  This saves scanning through the table as direct calcuation is 
> possible.

Hi, Mark
Thanks for your review.
Because structure regulator_desc only accepts the voltage table as constant.
struct regulator_desc {
        ...
        const unsigned int *volt_table;
        ...
};
If we want to make use of the volt_table, and the help functions 
regulator_map_voltage_iterate and regulator_list_voltage_table, we have to 
initialize the tables as what we do now.
So what you mean that we can maintain the structure describes the voltage 
information in out private structure
struct 88pm800_regulator_desc {
  struct regulator_desc desc
  ...
  struct 88pm800_regulator_vol_table vol_table;
};
The struct 88pm800_regulator_vol_table can be used to define the details of the 
LDOes like start_vol/end_vol/step.
Then we need define our own map_voltage and list_voltage functions, and based 
on the struct 88pm800_regulator_vol_table to calculate the correct voltage.
Is above solution what you mean?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to