22 Jul, 2020

1 commit

  • Rationale:
    Reduces attack surface on kernel devs opening the links for MITM
    as HTTPS traffic is much harder to manipulate.

    Deterministic algorithm:
    For each file:
    If not .svg:
    For each line:
    If doesn't contain `\bxmlns\b`:
    For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`:
    If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`:
    If both the HTTP and HTTPS versions
    return 200 OK and serve the same content:
    Replace HTTP with HTTPS.

    Signed-off-by: Alexander A. Klimov
    Acked-by: Rob Herring
    Link: https://lore.kernel.org/r/20200719200623.61524-1-grandmaster@al2klimov.de
    Signed-off-by: Mark Brown

    Alexander A. Klimov
     

26 Jun, 2020

2 commits

  • Until now the aforementioned return value has been ignored.
    Previous and current calls to tps65217_reg_read() return
    instantly when the value is not 0, so let's do that.

    Fixes the following W=1 warning:

    drivers/regulator/tps65217-regulator.c: In function ‘tps65217_regulator_probe’:
    drivers/regulator/tps65217-regulator.c:227:9: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
    227 | int i, ret;
    | ^~~

    Signed-off-by: Lee Jones
    Cc: Russ Dill
    Cc: Keerthy
    Cc: AnilKumar Ch
    Cc: linux-omap@vger.kernel.org
    Link: https://lore.kernel.org/r/20200626065738.93412-7-lee.jones@linaro.org
    Signed-off-by: Mark Brown

    Lee Jones
     
  • 'rid' is declared as unsigned int, so there is little point checking for < 0 is always false [-Wtype-limits]
    127 | if (rid < TPS65217_DCDC_1 || rid > TPS65217_LDO_4)
    | ^
    drivers/regulator/tps65217-regulator.c: In function ‘tps65217_pmic_set_suspend_disable’:
    drivers/regulator/tps65217-regulator.c:140:10: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
    140 | if (rid < TPS65217_DCDC_1 || rid > TPS65217_LDO_4)
    | ^

    Signed-off-by: Lee Jones
    Cc: Russ Dill
    Cc: Keerthy
    Cc: AnilKumar Ch
    Cc: linux-omap@vger.kernel.org
    Link: https://lore.kernel.org/r/20200626065738.93412-6-lee.jones@linaro.org
    Signed-off-by: Mark Brown

    Lee Jones
     

09 May, 2020

1 commit

  • Change the regulator helpers to use common linear_ranges code.

    Signed-off-by: Matti Vaittinen
    Reviewed-by: Mark Brown
    Acked-by: Charles Keepax
    Acked-by: Adam Thomson
    Link: https://lore.kernel.org/r/64f01d5e381b8631a271616b7790f9d5640974fb.1588944082.git.matti.vaittinen@fi.rohmeurope.com
    Signed-off-by: Mark Brown

    Matti Vaittinen
     

06 May, 2019

1 commit


26 Mar, 2019

1 commit


25 Mar, 2019

1 commit


21 Mar, 2019

1 commit

  • The original code separates the selector 25-52 into 2 ranges on purpose
    because DCDC1/DCDC3 only support up to 1.8V/1.5V in the old code.
    Both DCDC1 and DCDC3 support up to 3.3V since commit b4c2e158a1e1
    ("regulator: tps65217: Allow DCDC1 and DCDC3 up to 3.3V"), so merge
    25-30 and 31-52 ranges to one range.

    Signed-off-by: Axel Lin
    Signed-off-by: Mark Brown

    Axel Lin
     

30 Jul, 2018

1 commit


13 Jun, 2018

1 commit

  • The devm_kzalloc() function has a 2-factor argument form, devm_kcalloc().
    This patch replaces cases of:

    devm_kzalloc(handle, a * b, gfp)

    with:
    devm_kcalloc(handle, a * b, gfp)

    as well as handling cases of:

    devm_kzalloc(handle, a * b * c, gfp)

    with:

    devm_kzalloc(handle, array3_size(a, b, c), gfp)

    as it's slightly less ugly than:

    devm_kcalloc(handle, array_size(a, b), c, gfp)

    This does, however, attempt to ignore constant size factors like:

    devm_kzalloc(handle, 4 * 1024, gfp)

    though any constants defined via macros get caught up in the conversion.

    Any factors with a sizeof() of "unsigned char", "char", and "u8" were
    dropped, since they're redundant.

    Some manual whitespace fixes were needed in this patch, as Coccinelle
    really liked to write "=devm_kcalloc..." instead of "= devm_kcalloc...".

    The Coccinelle script used for this was:

    // Fix redundant parens around sizeof().
    @@
    expression HANDLE;
    type TYPE;
    expression THING, E;
    @@

    (
    devm_kzalloc(HANDLE,
    - (sizeof(TYPE)) * E
    + sizeof(TYPE) * E
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (sizeof(THING)) * E
    + sizeof(THING) * E
    , ...)
    )

    // Drop single-byte sizes and redundant parens.
    @@
    expression HANDLE;
    expression COUNT;
    typedef u8;
    typedef __u8;
    @@

    (
    devm_kzalloc(HANDLE,
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(unsigned char) * COUNT
    + COUNT
    , ...)
    )

    // 2-factor product with sizeof(type/expression) and identifier or constant.
    @@
    expression HANDLE;
    type TYPE;
    expression THING;
    identifier COUNT_ID;
    constant COUNT_CONST;
    @@

    (
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * (COUNT_ID)
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * COUNT_ID
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * (COUNT_CONST)
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * COUNT_CONST
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * (COUNT_ID)
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * COUNT_ID
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * (COUNT_CONST)
    + COUNT_CONST, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * COUNT_CONST
    + COUNT_CONST, sizeof(THING)
    , ...)
    )

    // 2-factor product, only identifiers.
    @@
    expression HANDLE;
    identifier SIZE, COUNT;
    @@

    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - SIZE * COUNT
    + COUNT, SIZE
    , ...)

    // 3-factor product with 1 sizeof(type) or sizeof(expression), with
    // redundant parens removed.
    @@
    expression HANDLE;
    expression THING;
    identifier STRIDE, COUNT;
    type TYPE;
    @@

    (
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    )

    // 3-factor product with 2 sizeof(variable), with redundant parens removed.
    @@
    expression HANDLE;
    expression THING1, THING2;
    identifier COUNT;
    type TYPE1, TYPE2;
    @@

    (
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    )

    // 3-factor product, only identifiers, with redundant parens removed.
    @@
    expression HANDLE;
    identifier STRIDE, SIZE, COUNT;
    @@

    (
    devm_kzalloc(HANDLE,
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    )

    // Any remaining multi-factor products, first at least 3-factor products,
    // when they're not all constants...
    @@
    expression HANDLE;
    expression E1, E2, E3;
    constant C1, C2, C3;
    @@

    (
    devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
    |
    devm_kzalloc(HANDLE,
    - (E1) * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (E1) * (E2) * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (E1) * (E2) * (E3)
    + array3_size(E1, E2, E3)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - E1 * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    )

    // And then all remaining 2 factors products when they're not all constants,
    // keeping sizeof() as the second factor argument.
    @@
    expression HANDLE;
    expression THING, E1, E2;
    type TYPE;
    constant C1, C2, C3;
    @@

    (
    devm_kzalloc(HANDLE, sizeof(THING) * C2, ...)
    |
    devm_kzalloc(HANDLE, sizeof(TYPE) * C2, ...)
    |
    devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
    |
    devm_kzalloc(HANDLE, C1 * C2, ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * (E2)
    + E2, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * E2
    + E2, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * (E2)
    + E2, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * E2
    + E2, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - (E1) * E2
    + E1, E2
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - (E1) * (E2)
    + E1, E2
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - E1 * E2
    + E1, E2
    , ...)
    )

    Signed-off-by: Kees Cook

    Kees Cook
     

13 Oct, 2017

1 commit

  • Currently the driver boots only via device tree hence add a
    dependency on CONFIG_OF. This leaves with a bunch of unused code
    so clean that up. This patch also makes use of probe_new function
    in place of the probe function so as to avoid passing i2c_device_id.

    Signed-off-by: Keerthy
    Reviewed-by: Javier Martinez Canillas
    Signed-off-by: Lee Jones

    Keerthy
     

24 Jan, 2017

1 commit


28 Jun, 2016

1 commit

  • The TPS65217 has a pre-defined power-up / power-down sequence which in
    a typical application does not need to be changed. However, it is possible
    to define custom sequences under I2C control. The power-up sequence is
    defined by strobes and delay times. Each output rail is assigned to a
    strobe to determine the order in which the rails are enabled.

    Every regulator of tps65217 PMIC has sequence registers and every
    regulator has a default strobe value and gets disabled when a particular
    power down sequence occurs.

    To keep a regulator on during suspend we write value 0 to strobe so
    that the regulator is out of all sequencers and is not impacted by any
    power down sequence. Hence saving the default strobe value during probe
    so that when we want to regulator to be enabled during suspend we write 0
    to strobe and when we want it to get disabled during suspend we write
    the default saved strobe value.

    This allows platform data to specify which power rails should be on or off
    during RTC only suspend. This is necessary to keep DDR state while in RTC
    only suspend.

    Signed-off-by: Russ Dill
    [Enhanced commit log and added dynamic allocation for strobes]
    Signed-off-by: Keerthy
    Signed-off-by: Mark Brown

    Russ Dill
     

10 Sep, 2014

2 commits


06 Sep, 2014

1 commit


24 Jun, 2014

1 commit

  • rdev_get_id() returns an int. Convert rid to type int to avoid the
    following warnings:

    drivers/regulator/tps65217-regulator.c:73:10: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
    drivers/regulator/tps65217-regulator.c:87:10: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]

    Signed-off-by: Sachin Kamat
    Signed-off-by: Mark Brown

    Sachin Kamat
     

19 Apr, 2014

1 commit


18 Apr, 2014

1 commit


03 Mar, 2014

1 commit


15 Feb, 2014

1 commit


24 Oct, 2013

1 commit


11 Oct, 2013

2 commits


17 Sep, 2013

1 commit


30 Aug, 2013

1 commit

  • Below is the equation in original code:

    tps65217_uv1_ranges:
    0 ... 24: uV = vsel * 25000 + 900000;
    25 ... 52: uV = (vsel - 24) * 50000 + 1500000;
    = (vsel - 25) * 50000 + 1550000;
    53 ... 55: uV = (vsel - 52) * 100000 + 2900000;
    = (vsel - 53) * 100000 + 3000000;
    56 ... 62: uV = 3300000;

    tps65217_uv2_ranges:
    0 ... 8: uV = vsel * 50000 + 1500000;
    9 ... 13: uV = (vsel - 8) * 100000 + 1900000;
    = (vsel - 9) * 100000 + 2000000;
    14 ... 31: uV = (vsel - 13) * 50000 + 2400000;
    = (vsel - 14) * 50000 + 2450000;

    The voltage tables are composed of linear ranges.
    This patch converts this driver to use multiple linear ranges APIs.

    In original code, voltage range for DCDC1 is 900000 ~ 1800000 and voltage range
    for DCDC3 is 900000 ~ 1500000. This patch separates the range 25~52 in
    tps65217_uv1_ranges table to two linear ranges: 25~30 and 31~52.
    This change makes it possible to reuse the same linear_ranges table for DCDCx.

    Signed-off-by: Axel Lin
    Signed-off-by: Mark Brown

    Axel Lin
     

12 May, 2013

1 commit


24 Jan, 2013

1 commit

  • The dev parameter is the device requestiong the data.
    In this case it should be &pdev->dev rather than pdev->dev.parent.

    The dev parameter is used to call devm_kzalloc in of_get_regulator_init_data(),
    which means this fixes a memory leak because the memory is allocated every time
    probe() is called, thus it should be freed when this driver is unloaded.

    Signed-off-by: Axel Lin
    Signed-off-by: Mark Brown

    Axel Lin
     

20 Nov, 2012

3 commits


22 Aug, 2012

1 commit

  • Regulator platform data handling was mistakenly added to MFD
    driver. So we will see build errors if we compile MFD drivers
    without CONFIG_REGULATOR. This patch moves regulator platform
    data handling from TPS65217 MFD driver to regulator driver.

    This makes MFD driver independent of REGULATOR framework so
    build error is fixed if CONFIG_REGULATOR is not set.

    drivers/built-in.o: In function `tps65217_probe':
    tps65217.c:(.devinit.text+0x13e37): undefined reference
    to `of_regulator_match'

    This patch also fix allocation size of tps65217 platform data.
    Current implementation allocates a struct tps65217_board for each
    regulator specified in the device tree. But the structure itself
    provides array of regulators so one instance of it is sufficient.

    Signed-off-by: AnilKumar Ch

    AnilKumar Ch
     

13 Jul, 2012

1 commit


04 Jul, 2012

1 commit

  • It is ok to request voltage with min_uV < tps->info[rid]->min_uV and
    max_uV > tps->info[rid]->max_uV.

    The equation we used in uv_to_vsel() does not allow
    min_uV < tps->info[rid]->min_uV, otherwise it returns negative selector.
    So we need to set min_uV = tps->info[rid]->min_uV if
    min_uV < tps->info[rid]->min_uV.

    Signed-off-by: Axel Lin
    Acked-by: AnilKumar Ch
    Signed-off-by: Mark Brown

    Axel Lin
     

03 Jul, 2012

1 commit


02 Jul, 2012

1 commit


14 Jun, 2012

1 commit

  • This patch converts .is_enabled and .get_voltage_sel to
    regulator_is_enabled_regmap and regulator_get_voltage_sel_regmap.

    For .enable, .disable, and .set_voltage_sel, the write protect level is either
    1 or 2. So we cannot use regulator_[enable|disable|set_voltage_sel]_regmap.

    Now we store the enable reg/mask and vsel reg/mask in regulator_desc,
    so we can remove enable_mask, set_vout_reg, and set_vout_mask from
    struct tps_info.

    Signed-off-by: Axel Lin
    Signed-off-by: Mark Brown

    Axel Lin
     

18 May, 2012

1 commit


09 Apr, 2012

1 commit

  • Rather than adding new arguments to regulator_register() every time we
    want to add a new bit of dynamic information at runtime change the function
    to take these via a struct. By doing this we avoid needing to do further
    changes like the recent addition of device tree support which required each
    regulator driver to be updated to take an additional parameter.

    The regulator_desc which should (mostly) be static data is still passed
    separately as most drivers are able to configure this statically at build
    time.

    Signed-off-by: Mark Brown

    Mark Brown
     

06 Apr, 2012

1 commit