diff options
-rw-r--r-- | include/sound/ux500_ab8500_ext.h | 5 | ||||
-rw-r--r-- | sound/soc/codecs/ab8500_audio.c | 3 | ||||
-rw-r--r-- | sound/soc/codecs/ab8500_audio.h | 4 | ||||
-rw-r--r-- | sound/soc/ux500/ux500_ab8500.c | 32 |
4 files changed, 40 insertions, 4 deletions
diff --git a/include/sound/ux500_ab8500_ext.h b/include/sound/ux500_ab8500_ext.h index 1cc9a74585c..8c2b5d6bdf3 100644 --- a/include/sound/ux500_ab8500_ext.h +++ b/include/sound/ux500_ab8500_ext.h @@ -19,4 +19,9 @@ int ux500_ab8500_audio_gpadc_measure(struct ab8500_gpadc *gpadc, u8 channel, bool mode, int *value); +void ux500_ab8500_audio_pwm_vibra(unsigned char speed_left_pos, + unsigned char speed_left_neg, + unsigned char speed_right_pos, + unsigned char speed_right_neg); + #endif diff --git a/sound/soc/codecs/ab8500_audio.c b/sound/soc/codecs/ab8500_audio.c index e8005b72cca..4197e1b7efa 100644 --- a/sound/soc/codecs/ab8500_audio.c +++ b/sound/soc/codecs/ab8500_audio.c @@ -47,13 +47,10 @@ #define GPIO27_DIR_OUTPUT 0x04 #define GPIO29_DIR_OUTPUT 0x10 #define GPIO31_DIR_OUTPUT 0x40 -#define GPIO35_DIR_OUTPUT 0x04 /* Macrocell register definitions */ #define AB8500_CTRL3_REG 0x0200 #define AB8500_GPIO_DIR4_REG 0x1013 -#define AB8500_GPIO_DIR5_REG 0x1014 -#define AB8500_GPIO_OUT5_REG 0x1024 /* Nr of FIR/IIR-coeff banks in ANC-block */ #define AB8500_NR_OF_ANC_COEFF_BANKS 2 diff --git a/sound/soc/codecs/ab8500_audio.h b/sound/soc/codecs/ab8500_audio.h index a046357b55a..0b3d9bc92fa 100644 --- a/sound/soc/codecs/ab8500_audio.h +++ b/sound/soc/codecs/ab8500_audio.h @@ -27,6 +27,10 @@ extern struct snd_soc_codec_driver soc_codec_dev_ab8500; /* Extended interface for codec-driver */ int ab8500_audio_power_control(bool power_on); +void ab8500_audio_pwm_vibra(unsigned char speed_left_pos, + unsigned char speed_left_neg, + unsigned char speed_right_pos, + unsigned char speed_right_neg); int ab8500_audio_set_word_length(struct snd_soc_dai *dai, unsigned int wl); int ab8500_audio_set_bit_delay(struct snd_soc_dai *dai, unsigned int delay); int ab8500_audio_setup_if1(struct snd_soc_codec *codec, diff --git a/sound/soc/ux500/ux500_ab8500.c b/sound/soc/ux500/ux500_ab8500.c index 645c7676ffd..b3819f88b10 100644 --- a/sound/soc/ux500/ux500_ab8500.c +++ b/sound/soc/ux500/ux500_ab8500.c @@ -28,7 +28,6 @@ #include <sound/pcm.h> #include <sound/jack.h> #include <sound/pcm_params.h> -#include <sound/soc-dapm.h> #include <mach/hardware.h> #include "ux500_pcm.h" #include "ux500_msp_dai.h" @@ -48,6 +47,7 @@ #define DRIVERMODE_CODEC_ONLY 1 static struct snd_soc_jack jack; +static bool vibra_on; /* Power-control */ static DEFINE_MUTEX(power_lock); @@ -936,6 +936,8 @@ int ux500_ab8500_soc_machine_drv_init(void) return status; } + vibra_on = false; + return 0; } @@ -985,6 +987,34 @@ static int gpadc_convert_stable(struct ab8500_gpadc *gpadc, /* Extended interface */ +void ux500_ab8500_audio_pwm_vibra(unsigned char speed_left_pos, + unsigned char speed_left_neg, + unsigned char speed_right_pos, + unsigned char speed_right_neg) +{ + bool vibra_on_new; + + vibra_on_new = speed_left_pos | speed_left_neg | speed_right_pos | speed_right_neg; + if ((!vibra_on_new) && (vibra_on)) { + pr_debug("%s: PWM-vibra off.\n", __func__); + vibra_on = false; + + ux500_ab8500_power_control_dec(); + } + + if ((vibra_on_new) && (!vibra_on)) { + pr_debug("%s: PWM-vibra on.\n", __func__); + vibra_on = true; + + ux500_ab8500_power_control_inc(); + } + + ab8500_audio_pwm_vibra(speed_left_pos, + speed_left_neg, + speed_right_pos, + speed_right_neg); +} + int ux500_ab8500_audio_gpadc_measure(struct ab8500_gpadc *gpadc, u8 channel, bool mode, int *value) { |