• Ricardo Ribalda's avatar
    media: uvcvideo: Implement UVC_EXT_GPIO_UNIT · 2886477f
    Ricardo Ribalda authored
    Some devices can implement a physical switch to disable the input of the
    camera on demand. Think of it like an elegant privacy sticker.
    
    The system can read the status of the privacy switch via a GPIO.
    
    It is important to know the status of the switch, e.g. to notify the
    user when the camera will produce black frames and a videochat
    application is used.
    
    In some systems, the GPIO is connected to the main SoC instead of the
    camera controller, with the connection reported by the system firmware
    (ACPI or DT). In that case, the UVC device isn't aware of the GPIO. We
    need to implement a virtual entity to handle the GPIO fully on the
    driver side.
    
    For example, for ACPI-based systems, the GPIO is reported in the USB
    device object:
    
      Scope (\_SB.PCI0.XHCI.RHUB.HS07)
      {
    
    	  /.../
    
        Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
        {
            GpioIo (Exclusive, PullDefault, 0x0000, 0x0000, IoRestrictionOutputOnly,
                "\\_SB.PCI0.GPIO", 0x00, ResourceConsumer, ,
                )
                {   // Pin list
                    0x0064
                }
        })
        Name (_DSD, Package (0x02)  // _DSD: Device-Specific Data
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301") /* Device Properties for _DSD */,
            Package (0x01)
            {
                Package (0x02)
                {
                    "privacy-gpio",
                    Package (0x04)
                    {
                        \_SB.PCI0.XHCI.RHUB.HS07,
                        Zero,
                        Zero,
                        One
                    }
                }
            }
        })
      }
    Signed-off-by: default avatarRicardo Ribalda <ribalda@chromium.org>
    Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
    2886477f
uvc_ctrl.c 59.9 KB