1. 25 9月, 2013 2 次提交
    • T
      NFC Digital: Implement driver commands mechanism · 59ee2361
      Thierry Escande 提交于
      This implements the mechanism used to send commands to the driver in
      initiator mode through in_send_cmd().
      
      Commands are serialized and sent to the driver by using a work item
      on the system workqueue. Responses are handled asynchronously by
      another work item. Once the digital stack receives the response through
      the command_complete callback, the next command is sent to the driver.
      
      This also implements the polling mechanism. It's handled by a work item
      cycling on all supported protocols. The start poll command for a given
      protocol is sent to the driver using the mechanism described above.
      The process continues until a peer is discovered or stop_poll is
      called. This patch implements the poll function for NFC-A that sends a
      SENS_REQ command and waits for the SENS_RES response.
      Signed-off-by: NThierry Escande <thierry.escande@linux.intel.com>
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      59ee2361
    • T
      NFC: Digital Protocol stack implementation · 4b10884e
      Thierry Escande 提交于
      This is the initial commit of the NFC Digital Protocol stack
      implementation.
      
      It offers an interface for devices that don't have an embedded NFC
      Digital protocol stack. The driver instantiates the digital stack by
      calling nfc_digital_allocate_device(). Within the nfc_digital_ops
      structure, the driver specifies a set of function pointers for driver
      operations. These functions must be implemented by the driver and are:
      
      in_configure_hw:
      Hardware configuration for RF technology and communication framing in
      initiator mode. This is a synchronous function.
      
      in_send_cmd:
      Initiator mode data exchange using RF technology and framing previously
      set with in_configure_hw. The peer response is returned through
      callback cb. If an io error occurs or the peer didn't reply within the
      specified timeout (ms), the error code is passed back through the resp
      pointer. This is an asynchronous function.
      
      tg_configure_hw:
      Hardware configuration for RF technology and communication framing in
      target mode. This is a synchronous function.
      
      tg_send_cmd:
      Target mode data exchange using RF technology and framing previously
      set with tg_configure_hw. The peer next command is returned through
      callback cb. If an io error occurs or the peer didn't reply within the
      specified timeout (ms), the error code is passed back through the resp
      pointer. This is an asynchronous function.
      
      tg_listen:
      Put the device in listen mode waiting for data from the peer device.
      This is an asynchronous function.
      
      tg_listen_mdaa:
      If supported, put the device in automatic listen mode with mode
      detection and automatic anti-collision. In this mode, the device
      automatically detects the RF technology and executes the
      anti-collision detection using the command responses specified in
      mdaa_params. The mdaa_params structure contains SENS_RES, NFCID1, and
      SEL_RES for 106A RF tech. NFCID2 and system code (sc) for 212F and
      424F. The driver returns the NFC-DEP ATR_REQ command through cb. The
      digital stack deducts the RF tech by analyzing the SoD of the frame
      containing the ATR_REQ command. This is an asynchronous function.
      
      switch_rf:
      Turns device radio on or off. The stack does not call explicitly
      switch_rf to turn the radio on. A call to in|tg_configure_hw must turn
      the device radio on.
      
      abort_cmd:
      Discard the last sent command.
      
      Then the driver registers itself against the digital stack by using
      nfc_digital_register_device() which in turn registers the digital stack
      against the NFC core layer. The digital stack implements common NFC
      operations like dev_up(), dev_down(), start_poll(), stop_poll(), etc.
      
      This patch is only a skeleton and NFC operations are just stubs.
      Signed-off-by: NThierry Escande <thierry.escande@linux.intel.com>
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      4b10884e