本文整理汇总了C++中wm8350_set_bits函数的典型用法代码示例。如果您正苦于以下问题:C++ wm8350_set_bits函数的具体用法?C++ wm8350_set_bits怎么用?C++ wm8350_set_bits使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wm8350_set_bits函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wm8350_hp_jack_detect
/**
* wm8350_hp_jack_detect - Enable headphone jack detection.
*
* @codec: WM8350 codec
* @which: left or right jack detect signal
* @jack: jack to report detection events on
* @report: value to report
*
* Enables the headphone jack detection of the WM8350.
*/
int wm8350_hp_jack_detect(struct snd_soc_codec *codec, enum wm8350_jack which,
struct snd_soc_jack *jack, int report)
{
struct wm8350_data *priv = codec->private_data;
struct wm8350 *wm8350 = codec->control_data;
int irq;
int ena;
switch (which) {
case WM8350_JDL:
priv->hpl.jack = jack;
priv->hpl.report = report;
irq = WM8350_IRQ_CODEC_JCK_DET_L;
ena = WM8350_JDL_ENA;
break;
case WM8350_JDR:
priv->hpr.jack = jack;
priv->hpr.report = report;
irq = WM8350_IRQ_CODEC_JCK_DET_R;
ena = WM8350_JDR_ENA;
break;
default:
return -EINVAL;
}
wm8350_set_bits(wm8350, WM8350_POWER_MGMT_4, WM8350_TOCLK_ENA);
wm8350_set_bits(wm8350, WM8350_JACK_DETECT, ena);
/* Sync status */
wm8350_hp_jack_handler(irq, priv);
return 0;
}
示例2: wm8350_set_fll
static int wm8350_set_fll(struct snd_soc_dai *codec_dai,
int pll_id, int source, unsigned int freq_in,
unsigned int freq_out)
{
struct snd_soc_codec *codec = codec_dai->codec;
struct wm8350 *wm8350 = codec->control_data;
struct wm8350_data *priv = codec->private_data;
struct _fll_div fll_div;
int ret = 0;
u16 fll_1, fll_4;
if (freq_in == priv->fll_freq_in && freq_out == priv->fll_freq_out)
return 0;
/* power down FLL - we need to do this for reconfiguration */
wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_4,
WM8350_FLL_ENA | WM8350_FLL_OSC_ENA);
if (freq_out == 0 || freq_in == 0)
return ret;
ret = fll_factors(&fll_div, freq_in, freq_out);
if (ret < 0)
return ret;
dev_dbg(wm8350->dev,
"FLL in %u FLL out %u N 0x%x K 0x%x div %d ratio %d",
freq_in, freq_out, fll_div.n, fll_div.k, fll_div.div,
fll_div.ratio);
/* set up N.K & dividers */
fll_1 = wm8350_codec_read(codec, WM8350_FLL_CONTROL_1) &
~(WM8350_FLL_OUTDIV_MASK | WM8350_FLL_RSP_RATE_MASK | 0xc000);
wm8350_codec_write(codec, WM8350_FLL_CONTROL_1,
fll_1 | (fll_div.div << 8) | 0x50);
wm8350_codec_write(codec, WM8350_FLL_CONTROL_2,
(fll_div.ratio << 11) | (fll_div.
n & WM8350_FLL_N_MASK));
wm8350_codec_write(codec, WM8350_FLL_CONTROL_3, fll_div.k);
fll_4 = wm8350_codec_read(codec, WM8350_FLL_CONTROL_4) &
~(WM8350_FLL_FRAC | WM8350_FLL_SLOW_LOCK_REF);
wm8350_codec_write(codec, WM8350_FLL_CONTROL_4,
fll_4 | (fll_div.k ? WM8350_FLL_FRAC : 0) |
(fll_div.ratio == 8 ? WM8350_FLL_SLOW_LOCK_REF : 0));
/* power FLL on */
wm8350_set_bits(wm8350, WM8350_POWER_MGMT_4, WM8350_FLL_OSC_ENA);
wm8350_set_bits(wm8350, WM8350_POWER_MGMT_4, WM8350_FLL_ENA);
priv->fll_freq_out = freq_out;
priv->fll_freq_in = freq_in;
return 0;
}
示例3: imx_3stack_startup
static int imx_3stack_startup(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_codec *codec = rtd->socdev->card->codec;
struct wm8350 *wm8350 = codec->control_data;
struct imx_3stack_priv *priv = &machine_priv;
/* In master mode the LR clock can come from either the DAC or ADC.
* We use the LR clock from whatever stream is enabled first.
*/
if (!priv->lr_clk_active) {
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
wm8350_clear_bits(wm8350, WM8350_CLOCK_CONTROL_2,
WM8350_LRC_ADC_SEL);
else
wm8350_set_bits(wm8350, WM8350_CLOCK_CONTROL_2,
WM8350_LRC_ADC_SEL);
}
priv->lr_clk_active++;
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
priv->capture_active = 1;
else
priv->playback_active = 1;
return 0;
}
示例4: imx_3stack_shutdown
static void imx_3stack_shutdown(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_codec *codec = rtd->socdev->card->codec;
struct snd_soc_dai_link *machine = rtd->dai;
struct snd_soc_dai *codec_dai = machine->codec_dai;
struct imx_3stack_priv *priv = &machine_priv;
struct wm8350 *wm8350 = codec->control_data;
/* disable the PLL if there are no active Tx or Rx channels */
if (!codec_dai->active)
snd_soc_dai_set_pll(codec_dai, 0, 0, 0);
priv->lr_clk_active--;
/*
* We need to keep track of active streams in master mode and
* switch LRC source if necessary.
*/
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
priv->capture_active = 0;
else
priv->playback_active = 0;
if (priv->capture_active)
wm8350_set_bits(wm8350, WM8350_CLOCK_CONTROL_2,
WM8350_LRC_ADC_SEL);
else if (priv->playback_active)
wm8350_clear_bits(wm8350, WM8350_CLOCK_CONTROL_2,
WM8350_LRC_ADC_SEL);
}
示例5: force_continuous_enable
static int force_continuous_enable(struct wm8350 *wm8350, int dcdc, int enable)
{
int reg = 0, ret;
switch (dcdc) {
case WM8350_DCDC_1:
reg = WM8350_DCDC1_FORCE_PWM;
break;
case WM8350_DCDC_3:
reg = WM8350_DCDC3_FORCE_PWM;
break;
case WM8350_DCDC_4:
reg = WM8350_DCDC4_FORCE_PWM;
break;
case WM8350_DCDC_6:
reg = WM8350_DCDC6_FORCE_PWM;
break;
default:
return -EINVAL;
}
if (enable)
ret = wm8350_set_bits(wm8350, reg,
WM8350_DCDC1_FORCE_PWM_ENA);
else
ret = wm8350_clear_bits(wm8350, reg,
WM8350_DCDC1_FORCE_PWM_ENA);
return ret;
}
示例6: config_hibernate
static int config_hibernate(struct wm8350 *wm8350)
{
struct wm8350_pmic *pmic = &wm8350->pmic;
/* dont assert RTS when hibernating */
wm8350_set_bits(wm8350, WM8350_SYSTEM_HIBERNATE, WM8350_RST_HIB_MODE);
/* set up hibernate voltages -- needs refining */
wm8350_dcdc_set_image_voltage(pmic, WM8350_DCDC_1, 1400, /*1200, *//* 1.0v for mx32 */
WM8350_DCDC_HIB_MODE_IMAGE,
WM8350_DCDC_HIB_SIG_REG);
wm8350_dcdc_set_image_voltage(pmic, WM8350_DCDC_3, 2800,
WM8350_DCDC_HIB_MODE_IMAGE,
WM8350_DCDC_HIB_SIG_REG);
wm8350_dcdc_set_image_voltage(pmic, WM8350_DCDC_4, 1800,
WM8350_DCDC_HIB_MODE_IMAGE,
WM8350_DCDC_HIB_SIG_REG);
wm8350_dcdc_set_image_voltage(pmic, WM8350_DCDC_6, 1800,
WM8350_DCDC_HIB_MODE_IMAGE,
WM8350_DCDC_HIB_SIG_REG);
wm8350_ldo_set_image_voltage(pmic, WM8350_LDO_1, 2800,
WM8350_LDO_HIB_MODE_IMAGE,
WM8350_LDO_HIB_SIG_REG);
wm8350_ldo_set_image_voltage(pmic, WM8350_LDO_2, 3300,
WM8350_LDO_HIB_MODE_IMAGE,
WM8350_LDO_HIB_SIG_REG);
wm8350_ldo_set_image_voltage(pmic, WM8350_LDO_3, 1500,
WM8350_LDO_HIB_MODE_IMAGE,
WM8350_LDO_HIB_SIG_REG);
wm8350_ldo_set_image_voltage(pmic, WM8350_LDO_4, 2500,
WM8350_LDO_HIB_MODE_IMAGE,
WM8350_LDO_HIB_MODE_DIS);
return 0;
}
示例7: gpio_set_invert
static int gpio_set_invert(struct wm8350 *wm8350, int gpio, int invert)
{
if (invert == WM8350_GPIO_INVERT_ON)
return wm8350_set_bits(wm8350, WM8350_GPIO_INT_MODE, 1 << gpio);
else
return wm8350_clear_bits(wm8350,
WM8350_GPIO_INT_MODE, 1 << gpio);
}
示例8: wm8350_charger_handler
static irqreturn_t wm8350_charger_handler(int irq, void *data)
{
struct wm8350 *wm8350 = data;
struct wm8350_power *power = &wm8350->power;
struct wm8350_charger_policy *policy = power->policy;
switch (irq - wm8350->irq_base) {
case WM8350_IRQ_CHG_BAT_FAIL:
dev_err(wm8350->dev, "battery failed\n");
break;
case WM8350_IRQ_CHG_TO:
dev_err(wm8350->dev, "charger timeout\n");
power_supply_changed(&power->battery);
break;
case WM8350_IRQ_CHG_BAT_HOT:
case WM8350_IRQ_CHG_BAT_COLD:
case WM8350_IRQ_CHG_START:
case WM8350_IRQ_CHG_END:
power_supply_changed(&power->battery);
break;
case WM8350_IRQ_CHG_FAST_RDY:
dev_dbg(wm8350->dev, "fast charger ready\n");
wm8350_charger_config(wm8350, policy);
wm8350_reg_unlock(wm8350);
wm8350_set_bits(wm8350, WM8350_BATTERY_CHARGER_CONTROL_1,
WM8350_CHG_FAST);
wm8350_reg_lock(wm8350);
break;
case WM8350_IRQ_CHG_VBATT_LT_3P9:
dev_warn(wm8350->dev, "battery < 3.9V\n");
break;
case WM8350_IRQ_CHG_VBATT_LT_3P1:
dev_warn(wm8350->dev, "battery < 3.1V\n");
break;
case WM8350_IRQ_CHG_VBATT_LT_2P85:
dev_warn(wm8350->dev, "battery < 2.85V\n");
break;
/* Supply change. We will overnotify but it should do
* no harm. */
case WM8350_IRQ_EXT_USB_FB:
case WM8350_IRQ_EXT_WALL_FB:
wm8350_charger_config(wm8350, policy);
case WM8350_IRQ_EXT_BAT_FB: /* Fall through */
power_supply_changed(&power->battery);
power_supply_changed(&power->usb);
power_supply_changed(&power->ac);
break;
default:
dev_err(wm8350->dev, "Unknown interrupt %d\n", irq);
}
return IRQ_HANDLED;
}
示例9: wm8350_power_probe
static __devinit int wm8350_power_probe(struct platform_device *pdev)
{
struct wm8350 *wm8350 = platform_get_drvdata(pdev);
struct wm8350_power *power = &wm8350->power;
struct wm8350_charger_policy *policy = power->policy;
struct power_supply *usb = &power->usb;
struct power_supply *battery = &power->battery;
struct power_supply *ac = &power->ac;
int ret;
ac->name = "wm8350-ac";
ac->type = POWER_SUPPLY_TYPE_MAINS;
ac->properties = wm8350_ac_props;
ac->num_properties = ARRAY_SIZE(wm8350_ac_props);
ac->get_property = wm8350_ac_get_prop;
ret = power_supply_register(&pdev->dev, ac);
if (ret)
return ret;
battery->name = "wm8350-battery";
battery->properties = wm8350_bat_props;
battery->num_properties = ARRAY_SIZE(wm8350_bat_props);
battery->get_property = wm8350_bat_get_property;
battery->use_for_apm = 1;
ret = power_supply_register(&pdev->dev, battery);
if (ret)
goto battery_failed;
usb->name = "wm8350-usb",
usb->type = POWER_SUPPLY_TYPE_USB;
usb->properties = wm8350_usb_props;
usb->num_properties = ARRAY_SIZE(wm8350_usb_props);
usb->get_property = wm8350_usb_get_prop;
ret = power_supply_register(&pdev->dev, usb);
if (ret)
goto usb_failed;
ret = device_create_file(&pdev->dev, &dev_attr_charger_state);
if (ret < 0)
dev_warn(wm8350->dev, "failed to add charge sysfs: %d\n", ret);
ret = 0;
wm8350_init_charger(wm8350);
if (wm8350_charger_config(wm8350, policy) == 0) {
wm8350_reg_unlock(wm8350);
wm8350_set_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CHG_ENA);
wm8350_reg_lock(wm8350);
}
return ret;
usb_failed:
power_supply_unregister(battery);
battery_failed:
power_supply_unregister(ac);
return ret;
}
示例10: gpio_set_debounce
static int gpio_set_debounce(struct wm8350 *wm8350, int gpio, int db)
{
if (db == WM8350_GPIO_DEBOUNCE_ON)
return wm8350_set_bits(wm8350, WM8350_GPIO_DEBOUNCE,
1 << gpio);
else
return wm8350_clear_bits(wm8350,
WM8350_GPIO_DEBOUNCE, 1 << gpio);
}
示例11: wm8350_dcdc_set_mode
static int wm8350_dcdc_set_mode(struct regulator_dev *rdev, unsigned int mode)
{
struct wm8350 *wm8350 = rdev_get_drvdata(rdev);
int dcdc = rdev_get_id(rdev);
u16 val;
if (dcdc < WM8350_DCDC_1 || dcdc > WM8350_DCDC_6)
return -EINVAL;
if (dcdc == WM8350_DCDC_2 || dcdc == WM8350_DCDC_5)
return -EINVAL;
val = 1 << (dcdc - WM8350_DCDC_1);
switch (mode) {
case REGULATOR_MODE_FAST:
/* force continuous mode */
wm8350_set_bits(wm8350, WM8350_DCDC_ACTIVE_OPTIONS, val);
wm8350_clear_bits(wm8350, WM8350_DCDC_SLEEP_OPTIONS, val);
force_continuous_enable(wm8350, dcdc, 1);
break;
case REGULATOR_MODE_NORMAL:
/* active / pulse skipping */
wm8350_set_bits(wm8350, WM8350_DCDC_ACTIVE_OPTIONS, val);
wm8350_clear_bits(wm8350, WM8350_DCDC_SLEEP_OPTIONS, val);
force_continuous_enable(wm8350, dcdc, 0);
break;
case REGULATOR_MODE_IDLE:
/* standby mode */
force_continuous_enable(wm8350, dcdc, 0);
wm8350_clear_bits(wm8350, WM8350_DCDC_SLEEP_OPTIONS, val);
wm8350_clear_bits(wm8350, WM8350_DCDC_ACTIVE_OPTIONS, val);
break;
case REGULATOR_MODE_STANDBY:
/* LDO mode */
force_continuous_enable(wm8350, dcdc, 0);
wm8350_set_bits(wm8350, WM8350_DCDC_SLEEP_OPTIONS, val);
break;
}
return 0;
}
示例12: gpio_set_polarity
static int gpio_set_polarity(struct wm8350 *wm8350, int gpio, int pol)
{
if (pol == WM8350_GPIO_ACTIVE_HIGH)
return wm8350_set_bits(wm8350,
WM8350_GPIO_PIN_POLARITY_TYPE,
1 << gpio);
else
return wm8350_clear_bits(wm8350,
WM8350_GPIO_PIN_POLARITY_TYPE,
1 << gpio);
}
示例13: gpio_set_pull_down
static int gpio_set_pull_down(struct wm8350 *wm8350, int gpio, int down)
{
if (down)
return wm8350_set_bits(wm8350,
WM8350_GPIO_PULL_DOWN_CONTROL,
1 << gpio);
else
return wm8350_clear_bits(wm8350,
WM8350_GPIO_PULL_DOWN_CONTROL,
1 << gpio);
}
示例14: gpio_set_pull_up
static int gpio_set_pull_up(struct wm8350 *wm8350, int gpio, int up)
{
if (up)
return wm8350_set_bits(wm8350,
WM8350_GPIO_PIN_PULL_UP_CONTROL,
1 << gpio);
else
return wm8350_clear_bits(wm8350,
WM8350_GPIO_PIN_PULL_UP_CONTROL,
1 << gpio);
}
示例15: wm8350_mic_jack_detect
/**
* wm8350_mic_jack_detect - Enable microphone jack detection.
*
* @codec: WM8350 codec
* @jack: jack to report detection events on
* @detect_report: value to report when presence detected
* @short_report: value to report when microphone short detected
*
* Enables the microphone jack detection of the WM8350. If both reports
* are specified as zero then detection is disabled.
*/
int wm8350_mic_jack_detect(struct snd_soc_codec *codec,
struct snd_soc_jack *jack,
int detect_report, int short_report)
{
struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
struct wm8350 *wm8350 = codec->control_data;
priv->mic.jack = jack;
priv->mic.report = detect_report;
priv->mic.short_report = short_report;
if (detect_report || short_report) {
wm8350_set_bits(wm8350, WM8350_POWER_MGMT_4, WM8350_TOCLK_ENA);
wm8350_set_bits(wm8350, WM8350_POWER_MGMT_1,
WM8350_MIC_DET_ENA);
} else {
wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_1,
WM8350_MIC_DET_ENA);
}
return 0;
}