lkml.org 
[lkml]   [2015]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [alsa-devel] [PATCH v3 1/2] extcon: arizona: Add support for select accessory detect mode when headphone detection
    On Wed, Apr 22, 2015 at 08:23:20PM +0900, Inha Song wrote:
    > This patch add support for select accessory detect mode to HPDETL or HPDETR.
    > Arizona provides a headphone detection circuit on the HPDETL and HPDETR pins
    > to measure the impedance of an external load connected to the headphone.
    >
    > Depending on board design, headphone detect pins can change to HPDETR or HPDETL.
    >
    > Signed-off-by: Inha Song <ideal.song@samsung.com>
    > ---
    >
    > +static int arizona_extcon_of_get_pdata(struct arizona *arizona)
    > +{
    > + struct arizona_pdata *pdata = &arizona->pdata;
    > + unsigned int val;

    I would rather this is "unsigned int val =
    ARIZONA_ACCDET_MODE_HPL;".

    > +
    > + of_property_read_u32(arizona->dev->of_node, "wlf,hpdet-channel", &val);

    Because this won't fill val if the DT entry isn't present.

    > + switch (val) {

    Which means we hit this with val uninitialised.

    > + case ARIZONA_ACCDET_MODE_HPL:
    > + case ARIZONA_ACCDET_MODE_HPR:

    So we may select either channel at random.

    > + pdata->hpdet_channel = val;
    > + break;
    > + default:
    > + dev_err(arizona->dev,
    > + "Wrong wlf,hpdet-channel DT value %d\n", val);

    Or most likely just print an error but the DT being missing
    shouldn't really be an error it is an optional entry.

    > + pdata->hpdet_channel = ARIZONA_ACCDET_MODE_HPL;
    > + }
    > +
    > + return 0;
    > +}

    Thanks,
    Charles


    \
     
     \ /
      Last update: 2015-04-25 15:21    [W:3.075 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site