[alsa-devel] [PATCH 4/8] Input: twl6040-vibra: Check the selected path for vibra

Liam Girdwood lrg at ti.com
Fri Sep 16 11:26:41 CEST 2011


On Thu, 2011-09-15 at 15:59 +0300, Peter Ujfalusi wrote:
> The VIBSELL/R bit in the VIBCTLL/R register tells the source of the data,
> which is going to be used to drive the attached motor(s).
> Do not allow effect execution if any of the channels are set to receive
> audio data.
> 
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi at ti.com>
> ---
>  drivers/input/misc/twl6040-vibra.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/input/misc/twl6040-vibra.c b/drivers/input/misc/twl6040-vibra.c
> index cb74185..fe624f2 100644
> --- a/drivers/input/misc/twl6040-vibra.c
> +++ b/drivers/input/misc/twl6040-vibra.c
> @@ -201,6 +201,13 @@ static int vibra_play(struct input_dev *input, void *data,
>  	struct vibra_info *info = input_get_drvdata(input);
>  	int ret;
>  
> +	/* Do not allow effect, while the routing is set to use audio */
> +	ret = twl6040_get_vibralr_status(info->twl6040);
> +	if (ret & TWL6040_VIBSEL) {
> +		dev_info(&input->dev, "Vibra is configured for audio\n");
> +		return -EPERM;
> +	}

Sorry, missed this earlier.

Probably best to return -EBUSY here otherwise it may look like a device
permissions problem to some users.

Liam




More information about the Alsa-devel mailing list