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


C++ pm8xxx_readb函数代码示例

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


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

示例1: pm8xxx_atc_led_ctrl

void pm8xxx_atc_led_ctrl(struct device *dev, unsigned on)
{
    u8 val;

    if (on) {
        pm8xxx_readb(dev, ATC_LED_SRC, &val);
        val |= ATC_LED_SRC_MASK;
        pm8xxx_writeb(dev, ATC_LED_SRC, val);
    } else {
        pm8xxx_readb(dev, ATC_LED_SRC, &val);
        val &= ~ATC_LED_SRC_MASK;
        pm8xxx_writeb(dev, ATC_LED_SRC, val);
    }
}
开发者ID:OUDhs,项目名称:android_kernel_motorola_asanti,代码行数:14,代码来源:board-mmi-pmic.c

示例2: pm8821_get_irq_stat

/**
 * pm8821_get_irq_stat - get the status of the irq line
 * @chip: pointer to identify a pmic irq controller
 * @irq: the irq number
 *
 * The pm8821 gpio and mpp rely on the interrupt block to read
 * the values on their pins. This function is to facilitate reading
 * the status of a gpio or an mpp line. The caller has to convert the
 * gpio number to irq number.
 *
 * RETURNS:
 * an int indicating the value read on that line
 */
int pm8821_get_irq_stat(struct pm_irq_chip *chip, int irq)
{
	int pmirq, rc;
	u8 block, bits, bit, master;
	unsigned long flags;

	if (chip == NULL || irq < chip->irq_base
	    || irq >= chip->irq_base + chip->num_irqs)
		return -EINVAL;

	pmirq = irq - chip->irq_base;

	block = pmirq >> 3;
	master = block / PM8821_BLOCKS_PER_MASTER;
	bit = pmirq % 8;
	block %= PM8821_BLOCKS_PER_MASTER;

	spin_lock_irqsave(&chip->pm_irq_lock, flags);

	rc = pm8xxx_readb(chip->dev,
		SSBI_REG_ADDR_IRQ_RT_STATUS(chip->masters[master], block),
		&bits);
	if (rc) {
		pr_err("Failed Configuring irq=%d pmirq=%d blk=%d rc=%d\n",
						irq, pmirq, block, rc);
		goto bail_out;
	}

	rc = (bits & BIT(bit)) ? 1 : 0;

bail_out:
	spin_unlock_irqrestore(&chip->pm_irq_lock, flags);

	return rc;
}
开发者ID:404992361,项目名称:mi1_kernel,代码行数:48,代码来源:pm8821-irq.c

示例3: pm8xxx_vib_read_u8

static int pm8xxx_vib_read_u8(struct pm8xxx_vib *vib,
				 u8 *data, u16 reg)
{
	int rc;

	rc = pm8xxx_readb(vib->dev->parent, reg, data);
	if (rc < 0)
		dev_warn(vib->dev, "Error reading pm8xxx reg 0x%x(0x%x)\n",
				reg, rc);
	return rc;
}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:11,代码来源:pm8xxx-vibrator.c

示例4: pm8058_init_xo_buffer

static int pm8058_init_xo_buffer(struct pm8058_xo_buffer *xo)
{
	int	rc;

	/* Save the current control register state */
	rc = pm8xxx_readb(xo->dev->parent, xo->ctrl_addr, &xo->ctrl_reg);

	if (rc)
		pr_err("FAIL: pm8xxx_read: rc=%d\n", rc);
	return rc;
}
开发者ID:Amin-jkr,项目名称:android_kernel_semc_msm8660-1,代码行数:11,代码来源:pm8058-xo.c

示例5: pm8xxx_tm_read_ctrl

static inline int pm8xxx_tm_read_ctrl(struct pm8xxx_tm_chip *chip, u8 *reg)
{
	int rc;

	rc = pm8xxx_readb(chip->dev->parent,
			  chip->cdata.reg_addr_temp_alarm_ctrl, reg);
	if (rc)
		pr_err("%s: pm8xxx_readb(0x%03X) failed, rc=%d\n",
			chip->cdata.tm_name,
			chip->cdata.reg_addr_temp_alarm_ctrl, rc);

	return rc;
}
开发者ID:98416,项目名称:Z7Max_NX505J_H129_kernel,代码行数:13,代码来源:pm8xxx-tm.c

示例6: pm8821_read_block_irq

static int pm8821_read_block_irq(struct pm_irq_chip *chip, int master,
						u8 block, u8 *bits)
{
	int rc;

	spin_lock(&chip->pm_irq_lock);

	rc = pm8xxx_readb(chip->dev,
	    SSBI_REG_ADDR_IRQ_IT_STATUS(chip->masters[master], block), bits);
	if (rc)
		pr_err("Failed Reading Status rc=%d\n", rc);

	spin_unlock(&chip->pm_irq_lock);
	return rc;
}
开发者ID:404992361,项目名称:mi1_kernel,代码行数:15,代码来源:pm8821-irq.c

示例7: pm8xxx_read_wrapper

/*
 * The RTC registers need to be read/written one byte at a time. This is a
 * hardware limitation.
 */
static int pm8xxx_read_wrapper(struct pm8xxx_rtc *rtc_dd, u8 *rtc_val,
		int base, int count)
{
	int i, rc;
	struct device *parent = rtc_dd->rtc_dev->parent;

	for (i = 0; i < count; i++) {
		rc = pm8xxx_readb(parent, base + i, &rtc_val[i]);
		if (rc < 0) {
			dev_err(rtc_dd->rtc_dev, "PMIC read failed\n");
			return rc;
		}
	}

	return 0;
}
开发者ID:LiquidSmooth-Devices,项目名称:Deathly_Kernel_D2,代码行数:20,代码来源:rtc-pm8xxx.c

示例8: pm8xxx_read_block_irq

static int pm8xxx_read_block_irq(struct pm_irq_chip *chip, u8 bp, u8 *ip)
{
	int	rc;

	spin_lock(&chip->pm_irq_lock);
	rc = pm8xxx_writeb(chip->dev, SSBI_REG_ADDR_IRQ_BLK_SEL, bp);
	if (rc) {
		pr_err("Failed Selecting Block %d rc=%d\n", bp, rc);
		goto bail;
	}

	rc = pm8xxx_readb(chip->dev, SSBI_REG_ADDR_IRQ_IT_STATUS, ip);
	if (rc)
		pr_err("Failed Reading Status rc=%d\n", rc);
bail:
	spin_unlock(&chip->pm_irq_lock);
	return rc;
}
开发者ID:03199618,项目名称:linux,代码行数:18,代码来源:pm8xxx-irq.c

示例9: pm8xxx_misc_masked_write

static int pm8xxx_misc_masked_write(struct pm8xxx_misc_chip *chip, u16 addr,
				    u8 mask, u8 val)
{
	int rc;
	u8 reg;

	rc = pm8xxx_readb(chip->dev->parent, addr, &reg);
	if (rc) {
		pr_err("pm8xxx_readb(0x%03X) failed, rc=%d\n", addr, rc);
		return rc;
	}
	reg &= ~mask;
	reg |= val & mask;
	rc = pm8xxx_writeb(chip->dev->parent, addr, reg);
	if (rc)
		pr_err("pm8xxx_writeb(0x%03X)=0x%02X failed, rc=%d\n", addr,
			reg, rc);
	return rc;
}
开发者ID:Albinoman887,项目名称:pyramid-3.4.10,代码行数:19,代码来源:pm8xxx-misc.c

示例10: pm8xxx_debug_data_get

static int pm8xxx_debug_data_get(void *data, u64 *val)
{
	struct pm8xxx_debug_device *debugdev = data;
	int rc;
	u8 reg;

	mutex_lock(&debugdev->debug_mutex);

	if (pm8xxx_debug_addr_is_valid(debugdev->addr)) {
		rc = pm8xxx_readb(debugdev->parent, debugdev->addr, &reg);

		if (rc)
			pr_err("pm8xxx_readb(0x%03X) failed: rc=%d\n",
				debugdev->addr, rc);
		else
			*val = reg;
	}

	mutex_unlock(&debugdev->debug_mutex);
	return 0;
}
开发者ID:98416,项目名称:Z7Max_NX505J_H129_kernel,代码行数:21,代码来源:pm8xxx-debug.c

示例11: pmic8xxx_set_pon1

static int pmic8xxx_set_pon1(struct device *dev, u32 debounce_us, bool pull_up)
{
	int err;
	u32 delay;
	u8 pon_cntl;

	
	if (debounce_us > USEC_PER_SEC * 2 ||
		debounce_us < USEC_PER_SEC / 64) {
		dev_err(dev, "invalid power key trigger delay\n");
		return -EINVAL;
	}

	delay = (debounce_us << 6) / USEC_PER_SEC;
	delay = ilog2(delay);

	err = pm8xxx_readb(dev->parent, PON_CNTL_1, &pon_cntl);
	if (err < 0) {
		dev_err(dev, "failed reading PON_CNTL_1 err=%d\n", err);
		return err;
	}

	pon_cntl &= ~PON_CNTL_TRIG_DELAY_MASK;
	pon_cntl |= (delay & PON_CNTL_TRIG_DELAY_MASK);

	if (pull_up)
		pon_cntl |= PON_CNTL_PULL_UP;
	else
		pon_cntl &= ~PON_CNTL_PULL_UP;

	err = pm8xxx_writeb(dev->parent, PON_CNTL_1, pon_cntl);
	if (err < 0) {
		dev_err(dev, "failed writing PON_CNTL_1 err=%d\n", err);
		return err;
	}

	return 0;
}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:38,代码来源:pmic8xxx-pwrkey.c

示例12: pm8821_irq_masked_write

static int pm8821_irq_masked_write(struct pm_irq_chip *chip, u16 addr,
							u8 mask, u8 val)
{
	int rc;
	u8 reg;

	rc = pm8xxx_readb(chip->dev, addr, &reg);
	if (rc) {
		pr_err("read failed addr = %03X, rc = %d\n", addr, rc);
		return rc;
	}

	reg &= ~mask;
	reg |= val & mask;

	rc = pm8xxx_writeb(chip->dev, addr, reg);
	if (rc) {
		pr_err("write failed addr = %03X, rc = %d\n", addr, rc);
		return rc;
	}

	return 0;
}
开发者ID:404992361,项目名称:mi1_kernel,代码行数:23,代码来源:pm8821-irq.c

示例13: pmic8xxx_pwrkey_probe

static int __devinit pmic8xxx_pwrkey_probe(struct platform_device *pdev)
{
	struct input_dev *pwr;
	int key_release_irq = platform_get_irq(pdev, 0);
	int key_press_irq = platform_get_irq(pdev, 1);
	int err;
	unsigned int delay;
	u8 pon_cntl;
	struct pmic8xxx_pwrkey *pwrkey;
	const struct pm8xxx_pwrkey_platform_data *pdata =
					dev_get_platdata(&pdev->dev);

	if (!pdata) {
		dev_err(&pdev->dev, "power key platform data not supplied\n");
		return -EINVAL;
	}

	/* Valid range of pwr key trigger delay is 1/64 sec to 2 seconds. */
	if (pdata->kpd_trigger_delay_us > USEC_PER_SEC * 2 ||
		pdata->kpd_trigger_delay_us < USEC_PER_SEC / 64) {
		dev_err(&pdev->dev, "invalid power key trigger delay\n");
		return -EINVAL;
	}

	pwrkey = kzalloc(sizeof(*pwrkey), GFP_KERNEL);
	if (!pwrkey)
		return -ENOMEM;
	init_timer(&pwrkey->hibernate_timer);
	pwrkey->hibernate_timer.data = (unsigned long)pwrkey;
	pwrkey->hibernate_timer.function = hibernate_timer_handle;
	
	pwrkey->pdata = pdata;

	pwr = input_allocate_device();
	if (!pwr) {
		dev_dbg(&pdev->dev, "Can't allocate power button\n");
		err = -ENOMEM;
		goto free_pwrkey;
	}

	input_set_capability(pwr, EV_KEY, KEY_POWER);

	pwr->name = "pmic8xxx_pwrkey";
	pwr->phys = "pmic8xxx_pwrkey/input0";
	pwr->dev.parent = &pdev->dev;

	delay = (pdata->kpd_trigger_delay_us << 6) / USEC_PER_SEC;
	delay = ilog2(delay);

	err = pm8xxx_readb(pdev->dev.parent, PON_CNTL_1, &pon_cntl);
	if (err < 0) {
		dev_err(&pdev->dev, "failed reading PON_CNTL_1 err=%d\n", err);
		goto free_input_dev;
	}

	pon_cntl &= ~PON_CNTL_TRIG_DELAY_MASK;
	pon_cntl |= (delay & PON_CNTL_TRIG_DELAY_MASK);
	if (pdata->pull_up)
		pon_cntl |= PON_CNTL_PULL_UP;
	else
		pon_cntl &= ~PON_CNTL_PULL_UP;

	err = pm8xxx_writeb(pdev->dev.parent, PON_CNTL_1, pon_cntl);
	if (err < 0) {
		dev_err(&pdev->dev, "failed writing PON_CNTL_1 err=%d\n", err);
		goto free_input_dev;
	}

	err = input_register_device(pwr);
	if (err) {
		dev_dbg(&pdev->dev, "Can't register power key: %d\n", err);
		goto free_input_dev;
	}

	pwrkey->key_press_irq = key_press_irq;
	pwrkey->pwr = pwr;

	platform_set_drvdata(pdev, pwrkey);
	the_pwrkey = pwrkey;

	err = request_any_context_irq(key_press_irq, pwrkey_press_irq,
		IRQF_TRIGGER_RISING, "pmic8xxx_pwrkey_press", pwrkey);
	if (err < 0) {
		dev_dbg(&pdev->dev, "Can't get %d IRQ for pwrkey: %d\n",
				 key_press_irq, err);
		goto unreg_input_dev;
	}

	err = request_any_context_irq(key_release_irq, pwrkey_release_irq,
		 IRQF_TRIGGER_RISING, "pmic8xxx_pwrkey_release", pwrkey);
	if (err < 0) {
		dev_dbg(&pdev->dev, "Can't get %d IRQ for pwrkey: %d\n",
				 key_release_irq, err);

		goto free_press_irq;
	}

	device_init_wakeup(&pdev->dev, pdata->wakeup);

	return 0;
//.........这里部分代码省略.........
开发者ID:dadcup18,项目名称:android_kernel_zte_elden,代码行数:101,代码来源:pmic8xxx-pwrkey.c

示例14: pm8058_mic_bias_enable

int pm8058_mic_bias_enable(bool enable)
{
	int rc = 0;
	u8 reg;
	u16 mic_bias_addr = loc_dat->mic_bias_pf->mic_bias_addr;

	dev_dbg(loc_dat->dev, "%s - %s MIC Bias\n", __func__,
			enable ? "Enabling" : "Disabling");

	LOCK(&loc_dat->lock);

	if (enable) {
		if (!loc_dat->mic_bias_enable_counter) {
			rc = pm8xxx_readb(loc_dat->dev->parent,
					mic_bias_addr, &reg);
			if (rc < 0) {
				dev_err(loc_dat->dev, "pm8058 read failed\n");
				goto error;
			}

			reg &= PM8058_OTHC_EN_SIG_MASK;
			reg |= (OTHC_SIGNAL_ALWAYS_ON <<
					PM8058_OTHC_EN_SIG_SHIFT);

			rc = pm8xxx_writeb(loc_dat->dev->parent,
					mic_bias_addr, reg);
			if (rc < 0) {
				dev_err(loc_dat->dev, "pm8058 write failed\n");
				goto error;
			}

			/*Wait a bit to get basicly stable ADC value*/
			msleep(WAIT_MIC_BIAS_VOLTAGE_STABLE_DELAY);
		}
		loc_dat->mic_bias_enable_counter++;
		dev_vdbg(loc_dat->dev,
				"%s - Increasing MIC_BIAS_COUNTER %u\n",
				__func__,
				loc_dat->mic_bias_enable_counter);
	} else {
		if (1 <= loc_dat->mic_bias_enable_counter) {
			if (1 == loc_dat->mic_bias_enable_counter) {
				rc = pm8xxx_readb(loc_dat->dev->parent,
						mic_bias_addr, &reg);
				if (rc < 0) {
					dev_err(loc_dat->dev, "pm8058 read failed\n");
					goto error;
				}

				reg &= PM8058_OTHC_EN_SIG_MASK;
				reg |= (OTHC_SIGNAL_OFF <<
						PM8058_OTHC_EN_SIG_SHIFT);

				rc = pm8xxx_writeb(loc_dat->dev->parent,
						mic_bias_addr, reg);
				if (rc < 0) {
					dev_err(loc_dat->dev, "pm8058 write failed\n");
					goto error;
				}

				if (!rc)
					dev_dbg(loc_dat->dev,
							"%s - MIC Bias disabled\n",
							__func__);
			}
			loc_dat->mic_bias_enable_counter--;
			dev_vdbg(loc_dat->dev,
					"%s - Decreasing MIC_BIAS_COUNTER %u\n",
					__func__,
					loc_dat->mic_bias_enable_counter);
		} else {
			dev_vdbg(loc_dat->dev, "%s - No need to decrease "
					"MIC_BIAS_COUNTER\n", __func__);
		}
	}

error:
	UNLOCK(&loc_dat->lock);

	if (rc)
		dev_err(loc_dat->dev, "Unable to toggle MIC Bias\n");

	return rc;
}
开发者ID:Amin-jkr,项目名称:android_kernel_semc_msm8660-1,代码行数:84,代码来源:pm8058-mic_bias.c

示例15: __pm8058_disable_smps_locally_set_pull_down

static int
__pm8058_disable_smps_locally_set_pull_down(struct pm8xxx_misc_chip *chip,
	u16 ctrl_addr, u16 test2_addr, u16 master_enable_addr,
	u8 master_enable_bit)
{
	int rc = 0;
	u8 vref_sel, vlow_sel, band, vprog, bank, reg;

	bank = PM8058_REGULATOR_BANK_SEL(7);
	rc = pm8xxx_writeb(chip->dev->parent, test2_addr, bank);
	if (rc) {
		pr_err("%s: pm8xxx_writeb(0x%03X) failed: rc=%d\n", __func__,
			test2_addr, rc);
		goto done;
	}

	rc = pm8xxx_readb(chip->dev->parent, test2_addr, &reg);
	if (rc) {
		pr_err("%s: FAIL pm8xxx_readb(0x%03X): rc=%d\n",
		       __func__, test2_addr, rc);
		goto done;
	}

	
	if ((reg & PM8058_SMPS_ADVANCED_MODE_MASK) ==
					PM8058_SMPS_ADVANCED_MODE) {
		
		rc = pm8xxx_readb(chip->dev->parent, ctrl_addr, &reg);
		if (rc) {
			pr_err("%s: FAIL pm8xxx_readb(0x%03X): rc=%d\n",
			       __func__, ctrl_addr, rc);
			goto done;
		}

		band = (reg & PM8058_SMPS_ADVANCED_BAND_MASK)
			>> PM8058_SMPS_ADVANCED_BAND_SHIFT;
		switch (band) {
		case 3:
			vref_sel = 0;
			vlow_sel = 0;
			break;
		case 2:
			vref_sel = PM8058_SMPS_LEGACY_VREF_SEL;
			vlow_sel = 0;
			break;
		case 1:
			vref_sel = PM8058_SMPS_LEGACY_VREF_SEL;
			vlow_sel = PM8058_SMPS_LEGACY_VLOW_SEL;
			break;
		default:
			pr_err("%s: regulator already disabled\n", __func__);
			return -EPERM;
		}
		vprog = (reg & PM8058_SMPS_ADVANCED_VPROG_MASK);
		
		vprog = (vprog + 1) >> 1;
		if (vprog > PM8058_SMPS_LEGACY_VPROG_MASK)
			vprog = PM8058_SMPS_LEGACY_VPROG_MASK;

		
		bank = PM8058_REGULATOR_BANK_SEL(1);
		rc = pm8xxx_writeb(chip->dev->parent, test2_addr, bank);
		if (rc) {
			pr_err("%s: FAIL pm8xxx_writeb(0x%03X): rc=%d\n",
			       __func__, test2_addr, rc);
			goto done;
		}

		rc = pm8xxx_misc_masked_write(chip, test2_addr,
			PM8058_REGULATOR_BANK_WRITE | PM8058_REGULATOR_BANK_MASK
				| PM8058_SMPS_LEGACY_VLOW_SEL,
			PM8058_REGULATOR_BANK_WRITE |
			PM8058_REGULATOR_BANK_SEL(1) | vlow_sel);
		if (rc)
			goto done;

		
		bank = PM8058_REGULATOR_BANK_SEL(7);
		rc = pm8xxx_writeb(chip->dev->parent, test2_addr, bank);
		if (rc) {
			pr_err("%s: FAIL pm8xxx_writeb(0x%03X): rc=%d\n",
					__func__, test2_addr, rc);
			goto done;
		}
		rc = pm8xxx_misc_masked_write(chip, test2_addr,
				PM8058_REGULATOR_BANK_WRITE |
				PM8058_REGULATOR_BANK_MASK |
				PM8058_SMPS_ADVANCED_MODE_MASK,
				PM8058_REGULATOR_BANK_WRITE |
				PM8058_REGULATOR_BANK_SEL(7) |
				PM8058_SMPS_LEGACY_MODE);
		if (rc)
			goto done;

		
		rc = pm8xxx_misc_masked_write(chip, ctrl_addr,
			PM8058_REGULATOR_ENABLE_MASK |
			PM8058_REGULATOR_PULL_DOWN_MASK |
			PM8058_SMPS_LEGACY_VREF_SEL |
			PM8058_SMPS_LEGACY_VPROG_MASK,
//.........这里部分代码省略.........
开发者ID:Albinoman887,项目名称:pyramid-3.4.10,代码行数:101,代码来源:pm8xxx-misc.c


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