HID: hid-sensor-hub: Processing for duplicate physical ids
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Fri, 31 Jan 2014 20:04:10 +0000 (12:04 -0800)
committerJiri Kosina <jkosina@suse.cz>
Mon, 17 Feb 2014 16:12:47 +0000 (17:12 +0100)
commitca2ed12f163bf430a425ec725ef76df5254b9f45
tree06fbeca9113d06fccb6bebad133e460facacee38
parent1a214ae5d1a66ead18c5e8c3a8d03b969b0ee647
HID: hid-sensor-hub: Processing for duplicate physical ids

In HID sensor hub, HID physical ids are used to represent different sensors.
For example physical id of 0x73 in usage page = 0x20, represents an
accelerometer. The HID sensor hub driver uses this physical ids to create
platform devices using MFD. There is 1:1 correspondence between an phy id and a
client driver.

But in some cases these physical ids are reused. There is a phy id 0xe1, which
specifies a custom sensor, which can exist multiple times to represent various
custom sensors. In this case there can be multiple instances of client MFD
drivers, processing specific custom sensor. In this case when client driver
looks for report id or a field index, it should still get the report id
specific to its own type. This is also true for reports, they should be
directed towards correct instance.  This change introduce a way to parse and
tie physical devices to their correct instance.

Summary of changes:
- To get physical ids, use collections. If a collection of type=physical
  exist then use usage id as in the name of platform device name
- As part of the platform data, we assign a hdsev instance, which has
  start and end of collection indexes. Using these indexes attributes
  can be tied to correct MFD client instances
- When a report is received, call callback with correct hsdev instance.
  In this way using its private data stored as part of its registry, it
  can distinguish different sensors even when they have same physical and
  logical ids.

  This patch is co-authored with Archana Patni <archna.patni@intel.com>.

Reported-by: Archana Patni <archana.patni@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Archana Patni <archana.patni@intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-sensor-hub.c
include/linux/hid-sensor-hub.h
This page took 0.026815 seconds and 5 git commands to generate.