lkml.org 
[lkml]   [2021]   [Aug]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [BUG] mmc_regulator_set_ocr can't cope with regulator-fixed
    From
    Date
    Hi,
    Resending my reply as my Mail client settings prevented delivery

    On 05/08/21 6:38 pm, Mark Brown wrote:
    > On Thu, Aug 05, 2021 at 08:58:58AM -0400, Peter Geis wrote:
    >> On Thu, Aug 5, 2021 at 8:47 AM Mark Brown <broonie@kernel.org> wrote:
    >
    >>> One thing to watch out for with this approach is if there's things that
    >>> really need a specific voltage to be set then you'll have to stop those
    >>> things happening if you've got a voltage regulator that can't deliver a
    >>> voltage in the required range. I don't know if this affects MMC or not,
    >>> if it's just a case of being less efficient it's not such an issue.
    >
    >> Yeah, but if this is a fixed regulator and it's a problem, then the
    >> hardware is screwed anyways.
    >
    > Well, the fact that the voltage is being changed at runtime indicates
    > that we're changing something from whatever was in the fixed setup - it
    > can sometimes be that we don't have access to some higher performance or
    > lower power features for example. That's not ideal but works perfectly
    > safely.
    >
    Suggested approach of checking "mmc->ocr_avail" might work.

    But, IMO mmc core should check if the voltage can be changed or not

    before trying to do regulator_set_voltage() in mmc_regulator_set_ocr().

    Wouldn't that be better and solve this issue for other hosts as well.

    Something like below in mmc_regulator_set_ocr ():

    + result = regulator_check_voltage_constraints(supply,
    + min_uV, max_uV);
    + if(!result) {
    + result = regulator_set_voltage(supply, min_uV,
    max_uV);
    + if (result != -EINVAL && !mmc->regulator_enabled) {
    + result = regulator_enable(supply);
    + if (!result)
    + mmc->regulator_enabled = true;
    + }

    We could wrap the existing check_voltage function

    +/* Check voltage constraints helper function */
    +int regulator_check_voltage_constraints(struct regulator *regulator,
    + int min_uV, int max_uV)
    +{
    + return regulator_check_voltage(regulator->rdev, &min_uV, &max_uV);
    +}
    +EXPORT_SYMBOL_GPL(regulator_check_voltage_constraints);

    I hope this makes sense.

    Regards,
    RK

    \
     
     \ /
      Last update: 2021-08-06 10:15    [W:3.184 / U:0.252 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site