Lines Matching refs:info

139 static void axp288_extcon_log_rsi(struct axp288_extcon_info *info)  in axp288_extcon_log_rsi()  argument
145 ret = regmap_read(info->regmap, AXP288_PS_BOOT_REASON_REG, &val); in axp288_extcon_log_rsi()
148 dev_dbg(info->dev, "%s\n", *rsi); in axp288_extcon_log_rsi()
154 regmap_write(info->regmap, AXP288_PS_BOOT_REASON_REG, clear_mask); in axp288_extcon_log_rsi()
157 static int axp288_handle_chrg_det_event(struct axp288_extcon_info *info) in axp288_handle_chrg_det_event() argument
165 ret = regmap_read(info->regmap, AXP288_PS_STAT_REG, &pwr_stat); in axp288_handle_chrg_det_event()
167 dev_err(info->dev, "failed to read vbus status\n"); in axp288_handle_chrg_det_event()
176 ret = regmap_read(info->regmap, AXP288_BC_GLOBAL_REG, &cfg); in axp288_handle_chrg_det_event()
180 dev_dbg(info->dev, "can't complete the charger detection\n"); in axp288_handle_chrg_det_event()
184 ret = regmap_read(info->regmap, AXP288_BC_DET_STAT_REG, &stat); in axp288_handle_chrg_det_event()
192 dev_dbg(info->dev, "sdp cable is connecetd\n"); in axp288_handle_chrg_det_event()
198 dev_dbg(info->dev, "cdp cable is connecetd\n"); in axp288_handle_chrg_det_event()
204 dev_dbg(info->dev, "dcp cable is connecetd\n"); in axp288_handle_chrg_det_event()
209 dev_warn(info->dev, in axp288_handle_chrg_det_event()
219 if (info->pdata->gpio_mux_cntl) in axp288_handle_chrg_det_event()
220 gpiod_set_value(info->pdata->gpio_mux_cntl, in axp288_handle_chrg_det_event()
224 atomic_notifier_call_chain(&info->otg->notifier, in axp288_handle_chrg_det_event()
229 extcon_set_cable_state_(info->edev, cable, vbus_attach); in axp288_handle_chrg_det_event()
239 dev_err(info->dev, "failed to detect BC Mod\n"); in axp288_handle_chrg_det_event()
246 struct axp288_extcon_info *info = data; in axp288_extcon_isr() local
249 ret = axp288_handle_chrg_det_event(info); in axp288_extcon_isr()
251 dev_err(info->dev, "failed to handle the interrupt\n"); in axp288_extcon_isr()
256 static void axp288_extcon_enable_irq(struct axp288_extcon_info *info) in axp288_extcon_enable_irq() argument
259 regmap_write(info->regmap, AXP288_PWRSRC_IRQ_CFG_REG, in axp288_extcon_enable_irq()
261 regmap_update_bits(info->regmap, AXP288_BC_GLOBAL_REG, in axp288_extcon_enable_irq()
264 regmap_write(info->regmap, AXP288_BC12_IRQ_CFG_REG, BC12_IRQ_CFG_MASK); in axp288_extcon_enable_irq()
266 regmap_update_bits(info->regmap, AXP288_BC_GLOBAL_REG, in axp288_extcon_enable_irq()
272 struct axp288_extcon_info *info; in axp288_extcon_probe() local
276 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); in axp288_extcon_probe()
277 if (!info) in axp288_extcon_probe()
280 info->dev = &pdev->dev; in axp288_extcon_probe()
281 info->regmap = axp20x->regmap; in axp288_extcon_probe()
282 info->regmap_irqc = axp20x->regmap_irqc; in axp288_extcon_probe()
283 info->pdata = pdev->dev.platform_data; in axp288_extcon_probe()
285 if (!info->pdata) { in axp288_extcon_probe()
292 platform_set_drvdata(pdev, info); in axp288_extcon_probe()
294 axp288_extcon_log_rsi(info); in axp288_extcon_probe()
297 info->edev = devm_extcon_dev_allocate(&pdev->dev, in axp288_extcon_probe()
299 if (IS_ERR(info->edev)) { in axp288_extcon_probe()
301 return PTR_ERR(info->edev); in axp288_extcon_probe()
305 ret = devm_extcon_dev_register(&pdev->dev, info->edev); in axp288_extcon_probe()
312 info->otg = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2); in axp288_extcon_probe()
313 if (IS_ERR(info->otg)) { in axp288_extcon_probe()
315 return PTR_ERR(info->otg); in axp288_extcon_probe()
319 if (info->pdata->gpio_mux_cntl) { in axp288_extcon_probe()
320 gpio = desc_to_gpio(info->pdata->gpio_mux_cntl); in axp288_extcon_probe()
327 gpiod_direction_output(info->pdata->gpio_mux_cntl, in axp288_extcon_probe()
333 info->irq[i] = regmap_irq_get_virq(info->regmap_irqc, pirq); in axp288_extcon_probe()
334 if (info->irq[i] < 0) { in axp288_extcon_probe()
337 ret = info->irq[i]; in axp288_extcon_probe()
341 ret = devm_request_threaded_irq(&pdev->dev, info->irq[i], in axp288_extcon_probe()
344 pdev->name, info); in axp288_extcon_probe()
347 info->irq[i]); in axp288_extcon_probe()
353 axp288_extcon_enable_irq(info); in axp288_extcon_probe()