本文整理汇总了C++中pinctrl_select_state函数的典型用法代码示例。如果您正苦于以下问题:C++ pinctrl_select_state函数的具体用法?C++ pinctrl_select_state怎么用?C++ pinctrl_select_state使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pinctrl_select_state函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: android_irrc_enable_pwm
static void android_irrc_enable_pwm(struct timed_irrc_data *irrc, int PWM_CLK, int duty)
{
int rc;
cancel_delayed_work_sync(&irrc->gpio_off_work); //android_irrc_disable_pwm
if(g_pwm_enabled == true) {
INFO_MSG("pwm already enabled !!!\n");
return;
}
if (irrc->vreg != NULL) {
rc = regulator_enable(irrc->vreg);
ERR_MSG("regulator_enabled1\n");
if (rc < 0)
ERR_MSG("regulator_enable failed\n");
}
/*if (irrc->vreg2 != NULL) {
rc = regulator_enable(irrc->vreg2);
ERR_MSG("irrc->vreg2 set!!\n");
if (rc < 0)
ERR_MSG("regulator_enable failed2\n");
}*/
if((PWM_CLK == 0) || (duty == 100)){
INFO_MSG("gpio set to high!!!\n");
rc = pinctrl_select_state(irrc->pctrl, irrc->active_state);
if(rc < 0) {
ERR_MSG("select active state failed\n");
} else {
ERR_MSG("state changed to active\n");
}
gpio_direction_output(irrc->pwm_gpio, 1);
gpio_set_value(irrc->pwm_gpio, 1);
gpio_high_flag = 1;
} else if((PWM_CLK < 23) || (PWM_CLK > 1200) || (duty > 60) || (duty < 20) ){
INFO_MSG("Out of range ! \n");
} else {
INFO_MSG("gpio set to gp!!!\n");
rc = pinctrl_select_state(irrc->pctrl, irrc->suspended_state);
if(rc < 0){
ERR_MSG("select suspended state failed\n");
} else {
ERR_MSG("state changed to suspended\n");
}
gpio_direction_output(irrc->pwm_gpio, 1);
//gpio_set_value(irrc->pwm_gpio, 1); no need
clk_set_rate(irrc->gp_clk, irrc->clk_rate);
clk_prepare_enable(irrc->gp_clk);
android_irrc_set_pwm(1, PWM_CLK, duty);
gpio_high_flag = 0;
}
g_pwm_enabled = true;
}
示例2: mtkcam_gpio_set
int mtkcam_gpio_set(int PinIdx, int PwrType, int Val)
{
int ret = 0;
switch (PwrType) {
case CAMRST:
if (PinIdx == 0) {
if (Val == 0)
pinctrl_select_state(camctrl, cam0_rst_l);
else
pinctrl_select_state(camctrl, cam0_rst_h);
} else {
if (Val == 0)
pinctrl_select_state(camctrl, cam1_rst_l);
else
pinctrl_select_state(camctrl, cam1_rst_h);
}
break;
default:
PK_DBG("PwrType(%d) is invalid !!\n", PwrType);
break;
};
PK_DBG("PinIdx(%d) PwrType(%d) val(%d)\n", PinIdx, PwrType, Val);
return ret;
}
示例3: tegra_sdhci_set_padctrl
static int tegra_sdhci_set_padctrl(struct sdhci_host *host, int voltage)
{
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
struct sdhci_tegra *tegra_host = sdhci_pltfm_priv(pltfm_host);
int ret;
if (!tegra_host->pad_control_available)
return 0;
if (voltage == MMC_SIGNAL_VOLTAGE_180) {
ret = pinctrl_select_state(tegra_host->pinctrl_sdmmc,
tegra_host->pinctrl_state_1v8);
if (ret < 0)
dev_err(mmc_dev(host->mmc),
"setting 1.8V failed, ret: %d\n", ret);
} else {
ret = pinctrl_select_state(tegra_host->pinctrl_sdmmc,
tegra_host->pinctrl_state_3v3);
if (ret < 0)
dev_err(mmc_dev(host->mmc),
"setting 3.3V failed, ret: %d\n", ret);
}
return ret;
}
示例4: ssusb_mode_manual_switch
/*
* We provide an interface via debugfs to switch between host and device modes
* depending on user input.
* This is useful in special cases, such as uses TYPE-A receptacle but also
* wants to support dual-role mode.
* It generates cable state changes by pulling up/down IDPIN and
* notifies driver to switch mode by "extcon-usb-gpio".
* NOTE: when use MICRO receptacle, should not enable this interface.
*/
static void ssusb_mode_manual_switch(struct ssusb_mtk *ssusb, int to_host)
{
struct otg_switch_mtk *otg_sx = &ssusb->otg_switch;
if (to_host)
pinctrl_select_state(otg_sx->id_pinctrl, otg_sx->id_ground);
else
pinctrl_select_state(otg_sx->id_pinctrl, otg_sx->id_float);
}
示例5: ci13xxx_msm_install_wake_gpio
static int ci13xxx_msm_install_wake_gpio(struct platform_device *pdev,
struct resource *res)
{
int wake_irq;
int ret;
struct pinctrl_state *set_state;
dev_dbg(&pdev->dev, "ci13xxx_msm_install_wake_gpio\n");
_udc_ctxt.wake_gpio = res->start;
if (_udc_ctxt.ci13xxx_pinctrl) {
set_state = pinctrl_lookup_state(_udc_ctxt.ci13xxx_pinctrl,
"ci13xxx_active");
if (IS_ERR(set_state)) {
pr_err("cannot get ci13xxx pinctrl active state\n");
return PTR_ERR(set_state);
}
pinctrl_select_state(_udc_ctxt.ci13xxx_pinctrl, set_state);
}
gpio_request(_udc_ctxt.wake_gpio, "USB_RESUME");
gpio_direction_input(_udc_ctxt.wake_gpio);
wake_irq = gpio_to_irq(_udc_ctxt.wake_gpio);
if (wake_irq < 0) {
dev_err(&pdev->dev, "could not register USB_RESUME GPIO.\n");
return -ENXIO;
}
dev_dbg(&pdev->dev, "_udc_ctxt.gpio_irq = %d and irq = %d\n",
_udc_ctxt.wake_gpio, wake_irq);
ret = request_irq(wake_irq, ci13xxx_msm_resume_irq,
IRQF_TRIGGER_RISING | IRQF_ONESHOT, "usb resume", NULL);
if (ret < 0) {
dev_err(&pdev->dev, "could not register USB_RESUME IRQ.\n");
goto gpio_free;
}
disable_irq(wake_irq);
_udc_ctxt.wake_irq = wake_irq;
return 0;
gpio_free:
gpio_free(_udc_ctxt.wake_gpio);
if (_udc_ctxt.ci13xxx_pinctrl) {
set_state = pinctrl_lookup_state(_udc_ctxt.ci13xxx_pinctrl,
"ci13xxx_sleep");
if (IS_ERR(set_state))
pr_err("cannot get ci13xxx pinctrl sleep state\n");
else
pinctrl_select_state(_udc_ctxt.ci13xxx_pinctrl,
set_state);
}
_udc_ctxt.wake_gpio = 0;
return ret;
}
示例6: config_irq
static int config_irq(int n, int t) {
int ret;
if(n == 2) {
trigger1_type = t;
ret = pinctrl_select_state(pinctrl, pin_irq1);
if(ret<0) {
printk("pinctrl select state pin irq[%d] error \n", n);
}
irq1 = gpio_to_irq(pin[n]);
printk("%s : requesting IRQ1 %d name = %s \n", __func__, irq1, "irq1");
ret = request_irq(irq1, vdev_irq1_handler,
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_NO_SUSPEND , "irq1", vdev_dev);
if(ret < 0) {
printk("request irq1 error\n");
return -1;
}
} else if(n == 7) {
trigger2_type = t;
ret = pinctrl_select_state(pinctrl, pin_irq2);
if(ret<0) {
printk("pinctrl select state pin irq[%d] error \n", n);
}
irq2 = gpio_to_irq(pin[n]);
printk("%s : requesting IRQ2 %d name = %s \n", __func__, irq2, "irq2");
ret = request_irq(irq2, vdev_irq2_handler,
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_NO_SUSPEND , "irq2", vdev_dev);
if(ret < 0) {
printk("request irq2 error\n");
return -1;
}
} else if(n == 9) {
trigger3_type = t;
ret = pinctrl_select_state(pinctrl, pin_irq3);
if(ret<0) {
printk("pinctrl select state pin irq[%d] error \n", n);
}
irq3 = gpio_to_irq(pin[n]);
printk("%s : requesting IRQ3 %d name = %s \n", __func__, irq3, "irq3");
ret = request_irq(irq3, vdev_irq3_handler,
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_NO_SUSPEND , "irq3", vdev_dev);
if(ret < 0) {
printk("request irq3 error\n");
return -1;
}
}
device_init_wakeup(&pn547_dev->client->dev, 1);
return ret;
}
示例7: c55_ctrl_suspend
static int c55_ctrl_suspend(struct platform_device *dev, pm_message_t state)
{
struct c55_ctrl_data *cdata = dev_get_drvdata(&dev->dev);
struct m4sensorhub_data *m4sensorhub = m4sensorhub_client_get_drvdata();
if (cdata->c55_mode != C55_OFF) {
dev_warn(&dev->dev, "C55 still ON when going into suspend\n");
/* Disable C55->AP IRQ when turning off C55 */
if (cdata->c55_ap_int_enabled) {
disable_irq_nosync(
__gpio_to_irq(cdata->c55_ap_int_gpio));
cdata->c55_ap_int_enabled = 0;
}
if (m4sensorhub_reg_write_1byte
(m4sensorhub, M4SH_REG_USERSETTINGS_AUDIOSTATUS,
AUDIO_STATUS_OFF, 0xFF) != 1) {
dev_err(&dev->dev,
"Unable to set screen status to 0x00\n");
}
/* AP->C55 interrupt needs to be set low when C55 is off
* for current drain reasons */
gpio_set_value(cdata->ap_c55_int_gpio, 0);
cdata->c55_mode = C55_OFF;
}
pinctrl_select_state(cdata->pctrl, cdata->states[C55_OFF]);
return 0;
}
示例8: c55_ctrl_pin_setup
static int c55_ctrl_pin_setup(struct device *dev, struct c55_ctrl_data *cdata)
{
int i, ret = 0;
cdata->pctrl = devm_pinctrl_get(dev);
if (IS_ERR(cdata->pctrl)) {
ret = PTR_ERR(cdata->pctrl);
dev_dbg(dev, "no pinctrl handle\n");
}
for (i = 0; !ret && (i < C55_MODE_MAX); i++) {
cdata->states[i] = pinctrl_lookup_state(cdata->pctrl,
c55_pin_state_labels[i]);
if (IS_ERR(cdata->states[i])) {
ret = PTR_ERR(cdata->states[i]);
dev_dbg(dev, "no %s pinctrl state\n",
c55_pin_state_labels[i]);
}
}
if (!ret) {
ret = pinctrl_select_state(cdata->pctrl,
cdata->states[C55_OFF]);
if (ret)
dev_dbg(dev, "failed to activate %s pinctrl state\n",
c55_pin_state_labels[C55_OFF]);
}
return ret;
}
示例9: select_pin_ctl
/**
* Will try to select the set of pins (GPIOS) defined in a pin control node of
* the device tree named @p name.
*
* The node can contain several eg. GPIOs that is controlled when selecting it.
* The node may activate or deactivate the pins it contains, the action is
* defined in the device tree node itself and not here. The states used
* internally is fetched at probe time.
*
* @see pctl_names
* @see fpc1020_probe
*/
static int select_pin_ctl(struct fpc1020_data *fpc1020, const char *name)
{
struct device *dev = fpc1020->dev;
size_t i;
int rc;
for (i = 0; i < ARRAY_SIZE(fpc1020->pinctrl_state); i++) {
const char *n = pctl_names[i];
if (!strncmp(n, name, strlen(n))) {
rc = pinctrl_select_state(fpc1020->fingerprint_pinctrl,
fpc1020->pinctrl_state[i]);
if (rc)
dev_err(dev, "cannot select '%s'\n", name);
else
dev_dbg(dev, "Selected '%s'\n", name);
goto exit;
}
}
rc = -EINVAL;
dev_err(dev, "%s:'%s' not found\n", __func__, name);
exit:
return rc;
}
示例10: twi_request_gpio
static int twi_request_gpio(struct sunxi_i2c *i2c)
{
int ret = 0;
I2C_DBG("Pinctrl init %d ... [%s]\n", i2c->bus_num, i2c->adap.dev.parent->init_name);
if (!twi_chan_is_enable(i2c->bus_num))
return -1;
i2c->pctrl = devm_pinctrl_get(i2c->adap.dev.parent);
if (IS_ERR(i2c->pctrl)) {
I2C_ERR("TWI%d devm_pinctrl_get() failed! return %ld\n", i2c->bus_num, PTR_ERR(i2c->pctrl));
return -1;
}
i2c->pctrl_state = pinctrl_lookup_state(i2c->pctrl, PINCTRL_STATE_DEFAULT);
if (IS_ERR(i2c->pctrl_state)) {
I2C_ERR("TWI%d pinctrl_lookup_state() failed! return %p \n", i2c->bus_num, i2c->pctrl_state);
return -1;
}
ret = pinctrl_select_state(i2c->pctrl, i2c->pctrl_state);
if (ret < 0)
I2C_ERR("TWI%d pinctrl_select_state() failed! return %d \n", i2c->bus_num, ret);
return ret;
}
示例11: isdbt_pinctrl_init
static int isdbt_pinctrl_init(void)
{
struct pinctrl *tdmb_pinctrl;
struct pinctrl_state *gpio_state_suspend;
tdmb_pinctrl = devm_pinctrl_get(&(IsdbCtrlInfo.pdev->dev));
if(IS_ERR_OR_NULL(tdmb_pinctrl)) {
pr_err("%s: Getting pinctrl handle failed\n", __func__);
return -EINVAL;
}
gpio_state_suspend
= pinctrl_lookup_state(tdmb_pinctrl, "isdbt_gpio_suspend");
if(IS_ERR_OR_NULL(gpio_state_suspend)) {
pr_err("%s: [dtv]Failed to get the suspend state pinctrl handle\n", __func__);
return -EINVAL;
}
if(pinctrl_select_state(tdmb_pinctrl, gpio_state_suspend)) {
pr_err("%s: [dtv]error on pinctrl_select_state DTV GPIOs\n", __func__);
return -EINVAL;
}
else {
printk("%s: success to set pinctrl_select_state for DTV GPIOss\n", __func__);
}
return 0;
}
示例12: msm_flash_lm3642_i2c_remove
static int msm_flash_lm3642_i2c_remove(struct i2c_client *client)
{
struct msm_camera_sensor_board_info *flashdata = NULL;
struct msm_camera_power_ctrl_t *power_info = NULL;
int rc = 0 ;
LM3642_DBG("%s entry\n", __func__);
flashdata = fctrl.flashdata;
power_info = &flashdata->power_info;
rc = msm_camera_request_gpio_table(
power_info->gpio_conf->cam_gpio_req_tbl,
power_info->gpio_conf->cam_gpio_req_tbl_size, 0);
if (rc < 0) {
pr_err("%s: request gpio failed\n", __func__);
return rc;
}
if (fctrl.pinctrl_info.use_pinctrl == true) {
rc = pinctrl_select_state(fctrl.pinctrl_info.pinctrl,
fctrl.pinctrl_info.gpio_state_suspend);
if (rc)
pr_err("%s:%d cannot set pin to suspend state",
__func__, __LINE__);
}
return rc;
}
示例13: pinctrl_init
static int pinctrl_init(struct i2c_client *client)
{
struct lge_touch_data *ts = i2c_get_clientdata(client);
/* Get pinctrl if target uses pinctrl */
ts->ts_pinctrl = devm_pinctrl_get(&(client->dev));
if (IS_ERR(ts->ts_pinctrl)) {
if (PTR_ERR(ts->ts_pinctrl) == -EPROBE_DEFER) {
LGTC_ERR("ts_pinctrl == -EPROBE_DEFER\n");
return -EPROBE_DEFER;
}
LGTC_DBG("Target does not use pinctrl(ts->ts_pinctrl == NULL) \n");
ts->ts_pinctrl = NULL;
}
if (ts->ts_pinctrl) {
ts->ts_pinset_state_active = pinctrl_lookup_state(ts->ts_pinctrl, "pmx_ts_active");
if (IS_ERR(ts->ts_pinset_state_active))
LGTC_DBG("cannot get ts pinctrl active state\n");
ts->ts_pinset_state_suspend = pinctrl_lookup_state(ts->ts_pinctrl, "pmx_ts_suspend");
if (IS_ERR(ts->ts_pinset_state_suspend))
LGTC_DBG("cannot get ts pinctrl active state\n");
if (ts->ts_pinset_state_active) {
DO_SAFE(pinctrl_select_state(ts->ts_pinctrl, ts->ts_pinset_state_active), error);
} else {
LGTC_DBG("pinctrl active == NULL \n");
}
}
return NO_ERROR;
error:
return ERROR;
}
示例14: dummy_codec_device_init
static void dummy_codec_device_init(void)
{
#ifdef CONFIG_USE_OF
int ret;
struct pinctrl_state *s;
p = pinctrl_get(dummy_codec_dev);
if (IS_ERR(p))
return;
s = pinctrl_lookup_state(p, "dummy_codec_audio");
if (IS_ERR(s)) {
pinctrl_put(p);
return;
}
ret = pinctrl_select_state(p, s);
if (ret < 0) {
pinctrl_put(p);
return;
}
printk("=%s==,dummy_codec_audio init done\n",__func__);
#else
/* audio pinmux */
// pinmux_set(&rt5631_pinmux_set);
/* GPIOA_19 PULL_UP_REG0 bit19 */
// aml_set_reg32_bits(P_PAD_PULL_UP_REG0, 1, 19, 1);
#endif
}
示例15: msm_gpioset_activate
int msm_gpioset_activate(enum pinctrl_client client, char *keyword)
{
int ret = 0;
int gp_set = 0;
int active_set = 0;
gp_set = msm_get_gpioset_index(client, keyword);
if (gp_set < 0) {
pr_err("%s: gpio set name does not exist\n",
__func__);
return gp_set;
}
if (!gpioset_info[client].gpioset_state[gp_set]) {
/*
* If pinctrl pointer is not valid,
* no need to proceed further
*/
active_set = pinctrl_info[client].active_set;
if (IS_ERR(pinctrl_info[client].cdc_lines[active_set]))
return 0;
pinctrl_info[client].active_set |= (1 << gp_set);
active_set = pinctrl_info[client].active_set;
pr_debug("%s: pinctrl.active_set: %d\n", __func__, active_set);
/* Select the appropriate pinctrl state */
ret = pinctrl_select_state(pinctrl_info[client].pinctrl,
pinctrl_info[client].cdc_lines[active_set]);
}
gpioset_info[client].gpioset_state[gp_set]++;
return ret;
}