27 Nov
2012
27 Nov
'12
12:11 a.m.
Hi Mark,
On Mon, Nov 26, 2012 at 09:39:38PM +0000, Mark Brown wrote:
+static int arizona_haptics_play(struct input_dev *input, void *data,
struct ff_effect *effect)+{
- struct arizona_haptics *haptics = input_get_drvdata(input);
- struct arizona *arizona = haptics->arizona;
- struct mutex *dapm_mutex = &arizona->dapm->card->dapm_mutex;
- u8 val;
- int ret;
- if (!haptics->arizona->dapm) {
dev_err(arizona->dev, "No DAPM context\n");return -EBUSY;- }
- if (effect->u.rumble.strong_magnitude) {
/* Scale the magnitude into the range the device supports */if (arizona->pdata.hap_act) {val = effect->u.rumble.strong_magnitude >> 9;if (effect->direction < 0x8000)val += 0x7f;} else {val = effect->u.rumble.strong_magnitude >> 8;}ret = regmap_update_bits(arizona->regmap,ARIZONA_HAPTICS_PHASE_2_INTENSITY,ARIZONA_PHASE2_INTENSITY_MASK, val);if (ret != 0) {dev_err(arizona->dev, "Failed to set intensity: %d\n",ret);return ret;}/* This enable sequence will be a noop if already enabled */ret = regmap_update_bits(arizona->regmap,ARIZONA_HAPTICS_CONTROL_1,ARIZONA_HAP_CTRL_MASK,1 << ARIZONA_HAP_CTRL_SHIFT);if (ret != 0) {dev_err(arizona->dev, "Failed to start haptics: %d\n",ret);return ret;}mutex_lock_nested(dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
You cannot sleep in play() methods.
Thanks.
--
Dmitry