当前位置: 首页>>代码示例>>C++>>正文


C++ wm831x_set_bits函数代码示例

本文整理汇总了C++中wm831x_set_bits函数的典型用法代码示例。如果您正苦于以下问题:C++ wm831x_set_bits函数的具体用法?C++ wm831x_set_bits怎么用?C++ wm831x_set_bits使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wm831x_set_bits函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: wm831x_aldo_set_mode

static int wm831x_aldo_set_mode(struct regulator_dev *rdev,
				  unsigned int mode)
{
	struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
	struct wm831x *wm831x = ldo->wm831x;
	int ctrl_reg = ldo->base + WM831X_LDO_CONTROL;
	int on_reg = ldo->base + WM831X_LDO_ON_CONTROL;
	int ret;


	switch (mode) {
	case REGULATOR_MODE_NORMAL:
		ret = wm831x_set_bits(wm831x, on_reg,
				      WM831X_LDO7_ON_MODE, 0);
		if (ret < 0)
			return ret;
		break;

	case REGULATOR_MODE_IDLE:
		ret = wm831x_set_bits(wm831x, ctrl_reg,
				      WM831X_LDO7_ON_MODE,
				      WM831X_LDO7_ON_MODE);
		if (ret < 0)
			return ret;
		break;

	default:
		return -EINVAL;
	}

	return 0;
}
开发者ID:3sOx,项目名称:asuswrt-merlin,代码行数:32,代码来源:wm831x-ldo.c

示例2: wm831x_buckv_set_voltage

static int wm831x_buckv_set_voltage(struct regulator_dev *rdev,
				    int min_uV, int max_uV, unsigned *selector)
{
	struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
	struct wm831x *wm831x = dcdc->wm831x;
	int on_reg = dcdc->base + WM831X_DCDC_ON_CONFIG;
	int dvs_reg = dcdc->base + WM831X_DCDC_DVS_CONTROL;
	int vsel, ret;

	vsel = wm831x_buckv_select_min_voltage(rdev, min_uV, max_uV);
	if (vsel < 0)
		return vsel;

	*selector = vsel;

	/* If this value is already set then do a GPIO update if we can */
	if (dcdc->dvs_gpio && dcdc->on_vsel == vsel)
		return wm831x_buckv_set_dvs(rdev, 0);

	if (dcdc->dvs_gpio && dcdc->dvs_vsel == vsel)
		return wm831x_buckv_set_dvs(rdev, 1);

	/* Always set the ON status to the minimum voltage */
	ret = wm831x_set_bits(wm831x, on_reg, WM831X_DC1_ON_VSEL_MASK, vsel);
	if (ret < 0)
		return ret;
	dcdc->on_vsel = vsel;

	if (!dcdc->dvs_gpio)
		return ret;

	/* Kick the voltage transition now */
	ret = wm831x_buckv_set_dvs(rdev, 0);
	if (ret < 0)
		return ret;

	/* Set the high voltage as the DVS voltage.  This is optimised
	 * for CPUfreq usage, most processors will keep the maximum
	 * voltage constant and lower the minimum with the frequency. */
	vsel = wm831x_buckv_select_max_voltage(rdev, min_uV, max_uV);
	if (vsel < 0) {
		/* This should never happen - at worst the same vsel
		 * should be chosen */
		WARN_ON(vsel < 0);
		return 0;
	}

	/* Don't bother if it's the same VSEL we're already using */
	if (vsel == dcdc->on_vsel)
		return 0;

	ret = wm831x_set_bits(wm831x, dvs_reg, WM831X_DC1_DVS_VSEL_MASK, vsel);
	if (ret == 0)
		dcdc->dvs_vsel = vsel;
	else
		dev_warn(wm831x->dev, "Failed to set DCDC DVS VSEL: %d\n",
			 ret);

	return 0;
}
开发者ID:develersrl,项目名称:winmate-kernel,代码行数:60,代码来源:wm831x-dcdc.c

示例3: wm831x_dcdc_set_suspend_mode

static int wm831x_dcdc_set_suspend_mode(struct regulator_dev *rdev,
					unsigned int mode)
{
	int ret = 0;
	struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
	struct wm831x *wm831x = dcdc->wm831x;
	u16 reg = dcdc->base + WM831X_DCDC_SLEEP_CONTROL;

	ret = wm831x_dcdc_set_mode_int(wm831x, reg, mode);
	if (ret < 0)
		goto end;

	//set dcdc_x sleep slot
	switch(reg){
		case WM831X_DC1_SLEEP_CONTROL:
			ret = wm831x_set_bits(wm831x, reg, WM831X_DC1_SLP_SLOT_MASK, WM831X_DCDC1_SLP_SLOT << WM831X_DC1_SLP_SLOT_SHIFT);
			if (ret < 0)
				goto end;
			break;

		case WM831X_DC2_SLEEP_CONTROL:
			ret = wm831x_set_bits(wm831x, reg, WM831X_DC2_SLP_SLOT_MASK, WM831X_DCDC2_SLP_SLOT << WM831X_DC2_SLP_SLOT_SHIFT);
			if (ret < 0)
				goto end;
			break;

		case WM831X_DC3_SLEEP_CONTROL:
			ret = wm831x_set_bits(wm831x, reg, WM831X_DC3_SLP_SLOT_MASK, WM831X_DCDC3_SLP_SLOT << WM831X_DC3_SLP_SLOT_SHIFT);
			if (ret < 0)
				goto end;
			break;
	}
end:
	return ret;
}
开发者ID:WayWingsDev,项目名称:gopro-linux,代码行数:35,代码来源:wm831x-dcdc.c

示例4: wm831x_buckv_set_voltage

static int wm831x_buckv_set_voltage(struct regulator_dev *rdev,
				    int min_uV, int max_uV, unsigned *selector)
{
	struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
	struct wm831x *wm831x = dcdc->wm831x;
	int on_reg = dcdc->base + WM831X_DCDC_ON_CONFIG;
	int dvs_reg = dcdc->base + WM831X_DCDC_DVS_CONTROL;
	int vsel, ret;

	vsel = wm831x_buckv_select_min_voltage(rdev, min_uV, max_uV);
	if (vsel < 0)
		return vsel;

	*selector = vsel;

	/* If this value is already set then do a GPIO update if we can */
	if (dcdc->dvs_gpio && dcdc->on_vsel == vsel)
		return wm831x_buckv_set_dvs(rdev, 0);

	if (dcdc->dvs_gpio && dcdc->dvs_vsel == vsel)
		return wm831x_buckv_set_dvs(rdev, 1);

	/* Always set the ON status to the minimum voltage */
	ret = wm831x_set_bits(wm831x, on_reg, WM831X_DC1_ON_VSEL_MASK, vsel);
	if (ret < 0)
		return ret;
	dcdc->on_vsel = vsel;

	if (!dcdc->dvs_gpio)
		return ret;

	/* Kick the voltage transition now */
	ret = wm831x_buckv_set_dvs(rdev, 0);
	if (ret < 0)
		return ret;

	/*
	 * If this VSEL is higher than the last one we've seen then
	 * remember it as the DVS VSEL.  This is optimised for CPUfreq
	 * usage where we want to get to the highest voltage very
	 * quickly.
	 */
	if (vsel > dcdc->dvs_vsel) {
		ret = wm831x_set_bits(wm831x, dvs_reg,
				      WM831X_DC1_DVS_VSEL_MASK,
				      dcdc->dvs_vsel);
		if (ret == 0)
			dcdc->dvs_vsel = vsel;
		else
			dev_warn(wm831x->dev,
				 "Failed to set DCDC DVS VSEL: %d\n", ret);
	}

	return 0;
}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:55,代码来源:wm831x-dcdc.c

示例5: wm831x_rtc_start_alarm

static int wm831x_rtc_start_alarm(struct wm831x_rtc *wm831x_rtc)
{
	wm831x_rtc->alarm_enabled = 1;

	return wm831x_set_bits(wm831x_rtc->wm831x, WM831X_RTC_CONTROL,
			       WM831X_RTC_ALM_ENA, WM831X_RTC_ALM_ENA);
}
开发者ID:020gzh,项目名称:linux,代码行数:7,代码来源:rtc-wm831x.c

示例6: wm831x_gpio_set_debounce

static int wm831x_gpio_set_debounce(struct wm831x *wm831x, unsigned offset,
				    unsigned debounce)
{
	int reg = WM831X_GPIO1_CONTROL + offset;
	int ret, fn;

	ret = wm831x_reg_read(wm831x, reg);
	if (ret < 0)
		return ret;

	switch (ret & WM831X_GPN_FN_MASK) {
	case 0:
	case 1:
		break;
	default:
		/* Not in GPIO mode */
		return -EBUSY;
	}

	if (debounce >= 32 && debounce <= 64)
		fn = 0;
	else if (debounce >= 4000 && debounce <= 8000)
		fn = 1;
	else
		return -EINVAL;

	return wm831x_set_bits(wm831x, reg, WM831X_GPN_FN_MASK, fn);
}
开发者ID:EMFPGA,项目名称:linux_media,代码行数:28,代码来源:gpio-wm831x.c

示例7: wm831x_wdt_set_timeout

static int wm831x_wdt_set_timeout(struct watchdog_device *wdt_dev,
				  unsigned int timeout)
{
	struct wm831x_wdt_drvdata *driver_data = watchdog_get_drvdata(wdt_dev);
	struct wm831x *wm831x = driver_data->wm831x;
	int ret, i;

	for (i = 0; i < ARRAY_SIZE(wm831x_wdt_cfgs); i++)
		if (wm831x_wdt_cfgs[i].time == timeout)
			break;
	if (i == ARRAY_SIZE(wm831x_wdt_cfgs))
		return -EINVAL;

	ret = wm831x_reg_unlock(wm831x);
	if (ret == 0) {
		ret = wm831x_set_bits(wm831x, WM831X_WATCHDOG,
				      WM831X_WDOG_TO_MASK,
				      wm831x_wdt_cfgs[i].val);
		wm831x_reg_lock(wm831x);
	} else {
		dev_err(wm831x->dev, "Failed to unlock security key: %d\n",
			ret);
	}

	wdt_dev->timeout = timeout;

	return ret;
}
开发者ID:AD5GB,项目名称:kernel_n5_3.10-experimental,代码行数:28,代码来源:wm831x_wdt.c

示例8: wm831x_aldo_set_voltage_int

static int wm831x_aldo_set_voltage_int(struct regulator_dev *rdev, int reg,
				       int min_uV, int max_uV,
				       unsigned *selector)
{
	struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
	struct wm831x *wm831x = ldo->wm831x;
	int vsel, ret;

	if (min_uV < 1000000)
		vsel = 0;
	else if (min_uV < 1700000)
		vsel = ((min_uV - 1000000) / 50000);
	else
		vsel = ((min_uV - 1700000) / 100000)
			+ WM831X_ALDO_SELECTOR_LOW + 1;

	ret = wm831x_aldo_list_voltage(rdev, vsel);
	if (ret < 0)
		return ret;
	if (ret < min_uV || ret > max_uV)
		return -EINVAL;

	*selector = vsel;

	return wm831x_set_bits(wm831x, reg, WM831X_LDO7_ON_VSEL_MASK, vsel);
}
开发者ID:303750856,项目名称:linux-3.1,代码行数:26,代码来源:wm831x-ldo.c

示例9: wm831x_dcdc_set_mode_int

static int wm831x_dcdc_set_mode_int(struct wm831x *wm831x, int reg,
				    unsigned int mode)
{
	int val;

	switch (mode) {
	case REGULATOR_MODE_FAST:
		val = WM831X_DCDC_MODE_FAST;
		break;
	case REGULATOR_MODE_NORMAL:
		val = WM831X_DCDC_MODE_NORMAL;
		break;
	case REGULATOR_MODE_STANDBY:
		val = WM831X_DCDC_MODE_STANDBY;
		break;
	case REGULATOR_MODE_IDLE:
		val = WM831X_DCDC_MODE_IDLE;
		break;
	default:
		return -EINVAL;
	}

	return wm831x_set_bits(wm831x, reg, WM831X_DC1_ON_MODE_MASK,
			       val << WM831X_DC1_ON_MODE_SHIFT);
}
开发者ID:develersrl,项目名称:winmate-kernel,代码行数:25,代码来源:wm831x-dcdc.c

示例10: wm831x_device_shutdown

void wm831x_device_shutdown(struct wm831x *wm831x)
{
	if (wm831x->soft_shutdown) {
		dev_info(wm831x->dev, "Initiating shutdown...\n");
		wm831x_set_bits(wm831x, WM831X_POWER_STATE, WM831X_CHIP_ON, 0);
	}
}
开发者ID:03199618,项目名称:linux,代码行数:7,代码来源:wm831x-core.c

示例11: wm831x_dcdc_disable

static int wm831x_dcdc_disable(struct regulator_dev *rdev)
{
	struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
	struct wm831x *wm831x = dcdc->wm831x;
	int mask = 1 << rdev_get_id(rdev);

	return wm831x_set_bits(wm831x, WM831X_DCDC_ENABLE, mask, 0);
}
开发者ID:develersrl,项目名称:winmate-kernel,代码行数:8,代码来源:wm831x-dcdc.c

示例12: wm831x_gpio_set

static void wm831x_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
{
	struct wm831x_gpio *wm831x_gpio = gpiochip_get_data(chip);
	struct wm831x *wm831x = wm831x_gpio->wm831x;

	wm831x_set_bits(wm831x, WM831X_GPIO_LEVEL, 1 << offset,
			value << offset);
}
开发者ID:EMFPGA,项目名称:linux_media,代码行数:8,代码来源:gpio-wm831x.c

示例13: wm831x_ldo_disable

static int wm831x_ldo_disable(struct regulator_dev *rdev)
{
	struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
	struct wm831x *wm831x = ldo->wm831x;
	int mask = 1 << rdev_get_id(rdev);

	return wm831x_set_bits(wm831x, WM831X_LDO_ENABLE, mask, 0);
}
开发者ID:Core2idiot,项目名称:Kernel-Samsung-3.0...-,代码行数:8,代码来源:wm831x-ldo.c

示例14: wm831x_isink_disable

static int wm831x_isink_disable(struct regulator_dev *rdev)
{
	struct wm831x_isink *isink = rdev_get_drvdata(rdev);
	struct wm831x *wm831x = isink->wm831x;
	int ret;

	ret = wm831x_set_bits(wm831x, isink->reg, WM831X_CS1_DRIVE, 0);
	if (ret < 0)
		return ret;

	ret = wm831x_set_bits(wm831x, isink->reg, WM831X_CS1_ENA, 0);
	if (ret < 0)
		return ret;

	return ret;

}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:17,代码来源:wm831x-isink.c

示例15: rk30_pm_power_off

static void rk30_pm_power_off(void)
{
	printk(KERN_ERR "rk30_pm_power_off start...\n");
	gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
#if defined(CONFIG_MFD_WM831X)
	wm831x_set_bits(Wm831x,WM831X_GPIO_LEVEL,0x0001,0x0000);  //set sys_pwr 0
	wm831x_device_shutdown(Wm831x);//wm8326 shutdown
#endif
	while (1);
}
开发者ID:AndrewDB,项目名称:rk3066-kernel,代码行数:10,代码来源:board-rk30-sdk.c


注:本文中的wm831x_set_bits函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。