• Hans de Goede's avatar
    media: atomisp: Add v4l2_get_acpi_sensor_info() helper · d1229eb0
    Hans de Goede authored
    ACPI nodes describing sensors on atomisp devices implement a
    "79234640-9e10-4fea-a5c1-b5aa8b19756f" Device Specific Method (DSM)
    to get info about the GPIOs.
    
    Using this method is necessary to figure out which ACPI GPIO resource
    is "reset" and which one is "powerdown" and this is also necessary to
    figure out the correct polarity of the pins.
    
    One example where this is necessary is the GC0310 sensor. The current
    GC0310 code hardcodes reset as being active-low and power-down as being
    active-high. This works on a number of devices such as the mpman
    converter 9. But it is wrong for the Chuwi Vi8 CWI501 where the powerdown
    pin is active-low.
    
    Rather then adding DMI quirks for this, add a helper for this,
    which can be shared between sensor-drivers. This new helper optionally
    also returns a string identifying the exact sensor-module used, which
    might be useful if any module specific behvior is necessary in the sensor
    driver.
    
    This uses the DSM directly on the sensor device's ACPI node. This is
    different from later Intel hardware (IPU3 / IPU6) which has a separate
    INT3472 node (with its own driver) with this info.
    
    Since there is no separate ACPI node to which we can bind to register GPIO
    lookups, this unfortunately means that all sensor drivers which may be used
    on BYT or CHT hw need to call this new helper.
    
    Note for now this function is being added to atomisp_gmin_platform.c,
    but once things are ready to move atomisp over to using generic sensor
    drivers this will need to become a generic v4l2 sensor helper. but this
    will require upstream discussion first.
    Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
    Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
    d1229eb0
atomisp_gmin_platform.c 43.5 KB