Skip to content

Commit 2d4d4a8

Browse files
committed
Merge tag 'staging-3.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging driver fixes from Greg KH: "Here are some bugfixes for the staging and IIO drivers for 3.13-rc3. The resolve the vm memory issue in the tidspbridge driver, fix a much-reported build failure in an ARM driver, and some other IIO bugfixes that have been reported" * tag 'staging-3.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: Staging: TIDSPBRIDGE: Use vm_iomap_memory for mmap-ing instead of remap_pfn_range Fix build failure for gp2ap020a00f.c iio: hid-sensors: Fix power and report state HID: hid-sensor-hub: Add logical min and max
2 parents f64001e + 55ef003 commit 2d4d4a8

7 files changed

Lines changed: 43 additions & 34 deletions

File tree

drivers/hid/hid-sensor-hub.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,15 @@ static int sensor_hub_get_physical_device_count(
112112

113113
static void sensor_hub_fill_attr_info(
114114
struct hid_sensor_hub_attribute_info *info,
115-
s32 index, s32 report_id, s32 units, s32 unit_expo, s32 size)
115+
s32 index, s32 report_id, struct hid_field *field)
116116
{
117117
info->index = index;
118118
info->report_id = report_id;
119-
info->units = units;
120-
info->unit_expo = unit_expo;
121-
info->size = size/8;
119+
info->units = field->unit;
120+
info->unit_expo = field->unit_exponent;
121+
info->size = (field->report_size * field->report_count)/8;
122+
info->logical_minimum = field->logical_minimum;
123+
info->logical_maximum = field->logical_maximum;
122124
}
123125

124126
static struct hid_sensor_hub_callbacks *sensor_hub_get_callback(
@@ -325,9 +327,7 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev,
325327
if (field->physical == usage_id &&
326328
field->logical == attr_usage_id) {
327329
sensor_hub_fill_attr_info(info, i, report->id,
328-
field->unit, field->unit_exponent,
329-
field->report_size *
330-
field->report_count);
330+
field);
331331
ret = 0;
332332
} else {
333333
for (j = 0; j < field->maxusage; ++j) {
@@ -336,11 +336,7 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev,
336336
field->usage[j].collection_index ==
337337
collection_index) {
338338
sensor_hub_fill_attr_info(info,
339-
i, report->id,
340-
field->unit,
341-
field->unit_exponent,
342-
field->report_size *
343-
field->report_count);
339+
i, report->id, field);
344340
ret = 0;
345341
break;
346342
}

drivers/iio/common/hid-sensors/Kconfig

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,4 @@ config HID_SENSOR_IIO_TRIGGER
2525
If this driver is compiled as a module, it will be named
2626
hid-sensor-trigger.
2727

28-
config HID_SENSOR_ENUM_BASE_QUIRKS
29-
bool "ENUM base quirks for HID Sensor IIO drivers"
30-
depends on HID_SENSOR_IIO_COMMON
31-
help
32-
Say yes here to build support for sensor hub FW using
33-
enumeration, which is using 1 as base instead of 0.
34-
Since logical minimum is still set 0 instead of 1,
35-
there is no easy way to differentiate.
36-
3728
endmenu

drivers/iio/common/hid-sensors/hid-sensor-trigger.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,34 @@ static int hid_sensor_data_rdy_trigger_set_state(struct iio_trigger *trig,
3333
{
3434
struct hid_sensor_common *st = iio_trigger_get_drvdata(trig);
3535
int state_val;
36+
int report_val;
3637

3738
if (state) {
3839
if (sensor_hub_device_open(st->hsdev))
3940
return -EIO;
40-
} else
41+
state_val =
42+
HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM;
43+
report_val =
44+
HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM;
45+
46+
} else {
4147
sensor_hub_device_close(st->hsdev);
48+
state_val =
49+
HID_USAGE_SENSOR_PROP_POWER_STATE_D4_POWER_OFF_ENUM;
50+
report_val =
51+
HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVENTS_ENUM;
52+
}
4253

43-
state_val = state ? 1 : 0;
44-
if (IS_ENABLED(CONFIG_HID_SENSOR_ENUM_BASE_QUIRKS))
45-
++state_val;
4654
st->data_ready = state;
55+
state_val += st->power_state.logical_minimum;
56+
report_val += st->report_state.logical_minimum;
4757
sensor_hub_set_feature(st->hsdev, st->power_state.report_id,
4858
st->power_state.index,
4959
(s32)state_val);
5060

5161
sensor_hub_set_feature(st->hsdev, st->report_state.report_id,
5262
st->report_state.index,
53-
(s32)state_val);
63+
(s32)report_val);
5464

5565
return 0;
5666
}

drivers/iio/light/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ config GP2AP020A00F
4343
depends on I2C
4444
select IIO_BUFFER
4545
select IIO_TRIGGERED_BUFFER
46+
select IRQ_WORK
4647
help
4748
Say Y here if you have a Sharp GP2AP020A00F proximity/ALS combo-chip
4849
hooked to an I2C bus.

drivers/staging/tidspbridge/rmgr/drv_interface.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ static long bridge_ioctl(struct file *filp, unsigned int code,
258258
/* This function maps kernel space memory to user space memory. */
259259
static int bridge_mmap(struct file *filp, struct vm_area_struct *vma)
260260
{
261-
u32 status;
261+
struct omap_dsp_platform_data *pdata =
262+
omap_dspbridge_dev->dev.platform_data;
262263

263264
/* VM_IO | VM_DONTEXPAND | VM_DONTDUMP are set by remap_pfn_range() */
264265
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
@@ -268,13 +269,9 @@ static int bridge_mmap(struct file *filp, struct vm_area_struct *vma)
268269
vma->vm_start, vma->vm_end, vma->vm_page_prot,
269270
vma->vm_flags);
270271

271-
status = remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
272-
vma->vm_end - vma->vm_start,
273-
vma->vm_page_prot);
274-
if (status != 0)
275-
status = -EAGAIN;
276-
277-
return status;
272+
return vm_iomap_memory(vma,
273+
pdata->phys_mempool_base,
274+
pdata->phys_mempool_size);
278275
}
279276

280277
static const struct file_operations bridge_fops = {

include/linux/hid-sensor-hub.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ struct hid_sensor_hub_attribute_info {
4242
s32 units;
4343
s32 unit_expo;
4444
s32 size;
45+
s32 logical_minimum;
46+
s32 logical_maximum;
4547
};
4648

4749
/**

include/linux/hid-sensor-ids.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,16 @@
117117
#define HID_USAGE_SENSOR_PROP_REPORT_STATE 0x200316
118118
#define HID_USAGE_SENSOR_PROY_POWER_STATE 0x200319
119119

120+
/* Power state enumerations */
121+
#define HID_USAGE_SENSOR_PROP_POWER_STATE_UNDEFINED_ENUM 0x00
122+
#define HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM 0x01
123+
#define HID_USAGE_SENSOR_PROP_POWER_STATE_D1_LOW_POWER_ENUM 0x02
124+
#define HID_USAGE_SENSOR_PROP_POWER_STATE_D2_STANDBY_WITH_WAKE_ENUM 0x03
125+
#define HID_USAGE_SENSOR_PROP_POWER_STATE_D3_SLEEP_WITH_WAKE_ENUM 0x04
126+
#define HID_USAGE_SENSOR_PROP_POWER_STATE_D4_POWER_OFF_ENUM 0x05
127+
128+
/* Report State enumerations */
129+
#define HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVENTS_ENUM 0x00
130+
#define HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM 0x01
131+
120132
#endif

0 commit comments

Comments
 (0)