• Home
  • Raw
  • Download

Lines Matching refs:info

160 static int max8997_muic_set_debounce_time(struct max8997_muic_info *info,  in max8997_muic_set_debounce_time()  argument
170 ret = max8997_update_reg(info->muic, in max8997_muic_set_debounce_time()
175 dev_err(info->dev, "failed to set ADC debounce time\n"); in max8997_muic_set_debounce_time()
180 dev_err(info->dev, "invalid ADC debounce time\n"); in max8997_muic_set_debounce_time()
197 static int max8997_muic_set_path(struct max8997_muic_info *info, in max8997_muic_set_path() argument
208 ret = max8997_update_reg(info->muic, in max8997_muic_set_path()
211 dev_err(info->dev, "failed to update MUIC register\n"); in max8997_muic_set_path()
220 ret = max8997_update_reg(info->muic, in max8997_muic_set_path()
224 dev_err(info->dev, "failed to update MUIC register\n"); in max8997_muic_set_path()
228 dev_info(info->dev, in max8997_muic_set_path()
246 static int max8997_muic_get_cable_type(struct max8997_muic_info *info, in max8997_muic_get_cable_type() argument
259 adc = info->status[0] & STATUS1_ADC_MASK; in max8997_muic_get_cable_type()
270 cable_type = info->prev_cable_type; in max8997_muic_get_cable_type()
271 info->prev_cable_type = MAX8997_MUIC_ADC_OPEN; in max8997_muic_get_cable_type()
275 cable_type = info->prev_cable_type = adc; in max8997_muic_get_cable_type()
283 chg_type = info->status[1] & STATUS2_CHGTYP_MASK; in max8997_muic_get_cable_type()
289 cable_type = info->prev_chg_type; in max8997_muic_get_cable_type()
290 info->prev_chg_type = MAX8997_CHARGER_TYPE_NONE; in max8997_muic_get_cable_type()
299 cable_type = info->prev_chg_type = chg_type; in max8997_muic_get_cable_type()
304 dev_err(info->dev, "Unknown cable group (%d)\n", group); in max8997_muic_get_cable_type()
312 static int max8997_muic_handle_usb(struct max8997_muic_info *info, in max8997_muic_handle_usb() argument
317 ret = max8997_muic_set_path(info, info->path_usb, attached); in max8997_muic_handle_usb()
319 dev_err(info->dev, "failed to update muic register\n"); in max8997_muic_handle_usb()
325 extcon_set_state_sync(info->edev, EXTCON_USB_HOST, attached); in max8997_muic_handle_usb()
328 extcon_set_state_sync(info->edev, EXTCON_USB, attached); in max8997_muic_handle_usb()
329 extcon_set_state_sync(info->edev, EXTCON_CHG_USB_SDP, in max8997_muic_handle_usb()
333 dev_err(info->dev, "failed to detect %s usb cable\n", in max8997_muic_handle_usb()
341 static int max8997_muic_handle_dock(struct max8997_muic_info *info, in max8997_muic_handle_dock() argument
346 ret = max8997_muic_set_path(info, CONTROL1_SW_AUDIO, attached); in max8997_muic_handle_dock()
348 dev_err(info->dev, "failed to update muic register\n"); in max8997_muic_handle_dock()
355 extcon_set_state_sync(info->edev, EXTCON_DOCK, attached); in max8997_muic_handle_dock()
358 dev_err(info->dev, "failed to detect %s dock device\n", in max8997_muic_handle_dock()
366 static int max8997_muic_handle_jig_uart(struct max8997_muic_info *info, in max8997_muic_handle_jig_uart() argument
372 ret = max8997_muic_set_path(info, info->path_uart, attached); in max8997_muic_handle_jig_uart()
374 dev_err(info->dev, "failed to update muic register\n"); in max8997_muic_handle_jig_uart()
378 extcon_set_state_sync(info->edev, EXTCON_JIG, attached); in max8997_muic_handle_jig_uart()
383 static int max8997_muic_adc_handler(struct max8997_muic_info *info) in max8997_muic_adc_handler() argument
390 cable_type = max8997_muic_get_cable_type(info, in max8997_muic_adc_handler()
395 ret = max8997_muic_handle_usb(info, MAX8997_USB_HOST, attached); in max8997_muic_adc_handler()
400 extcon_set_state_sync(info->edev, EXTCON_DISP_MHL, attached); in max8997_muic_adc_handler()
404 ret = max8997_muic_handle_usb(info, in max8997_muic_adc_handler()
411 ret = max8997_muic_handle_dock(info, cable_type, attached); in max8997_muic_adc_handler()
416 ret = max8997_muic_handle_jig_uart(info, attached); in max8997_muic_adc_handler()
447 dev_info(info->dev, in max8997_muic_adc_handler()
452 dev_err(info->dev, in max8997_muic_adc_handler()
461 static int max8997_muic_chg_handler(struct max8997_muic_info *info) in max8997_muic_chg_handler() argument
467 chg_type = max8997_muic_get_cable_type(info, in max8997_muic_chg_handler()
474 adc = info->status[0] & STATUS1_ADC_MASK; in max8997_muic_chg_handler()
478 max8997_muic_handle_usb(info, in max8997_muic_chg_handler()
483 extcon_set_state_sync(info->edev, EXTCON_CHG_USB_CDP, in max8997_muic_chg_handler()
487 extcon_set_state_sync(info->edev, EXTCON_CHG_USB_DCP, in max8997_muic_chg_handler()
491 extcon_set_state_sync(info->edev, EXTCON_CHG_USB_SLOW, in max8997_muic_chg_handler()
495 extcon_set_state_sync(info->edev, EXTCON_CHG_USB_FAST, in max8997_muic_chg_handler()
499 dev_err(info->dev, in max8997_muic_chg_handler()
510 struct max8997_muic_info *info = container_of(work, in max8997_muic_irq_work() local
515 if (!info->edev) in max8997_muic_irq_work()
518 mutex_lock(&info->mutex); in max8997_muic_irq_work()
521 if (info->irq == muic_irqs[i].virq) in max8997_muic_irq_work()
524 ret = max8997_bulk_read(info->muic, MAX8997_MUIC_REG_STATUS1, in max8997_muic_irq_work()
525 2, info->status); in max8997_muic_irq_work()
527 dev_err(info->dev, "failed to read muic register\n"); in max8997_muic_irq_work()
528 mutex_unlock(&info->mutex); in max8997_muic_irq_work()
537 ret = max8997_muic_adc_handler(info); in max8997_muic_irq_work()
547 ret = max8997_muic_chg_handler(info); in max8997_muic_irq_work()
552 dev_info(info->dev, "misc interrupt: irq %d occurred\n", in max8997_muic_irq_work()
554 mutex_unlock(&info->mutex); in max8997_muic_irq_work()
559 dev_err(info->dev, "failed to handle MUIC interrupt\n"); in max8997_muic_irq_work()
561 mutex_unlock(&info->mutex); in max8997_muic_irq_work()
566 struct max8997_muic_info *info = data; in max8997_muic_irq_handler() local
568 dev_dbg(info->dev, "irq:%d\n", irq); in max8997_muic_irq_handler()
569 info->irq = irq; in max8997_muic_irq_handler()
571 schedule_work(&info->irq_work); in max8997_muic_irq_handler()
576 static int max8997_muic_detect_dev(struct max8997_muic_info *info) in max8997_muic_detect_dev() argument
583 mutex_lock(&info->mutex); in max8997_muic_detect_dev()
586 ret = max8997_bulk_read(info->muic, in max8997_muic_detect_dev()
587 MAX8997_MUIC_REG_STATUS1, 2, info->status); in max8997_muic_detect_dev()
589 dev_err(info->dev, "failed to read MUIC register\n"); in max8997_muic_detect_dev()
590 mutex_unlock(&info->mutex); in max8997_muic_detect_dev()
594 adc = max8997_muic_get_cable_type(info, MAX8997_CABLE_GROUP_ADC, in max8997_muic_detect_dev()
597 ret = max8997_muic_adc_handler(info); in max8997_muic_detect_dev()
599 dev_err(info->dev, "Cannot detect ADC cable\n"); in max8997_muic_detect_dev()
600 mutex_unlock(&info->mutex); in max8997_muic_detect_dev()
605 chg_type = max8997_muic_get_cable_type(info, MAX8997_CABLE_GROUP_CHG, in max8997_muic_detect_dev()
608 ret = max8997_muic_chg_handler(info); in max8997_muic_detect_dev()
610 dev_err(info->dev, "Cannot detect charger cable\n"); in max8997_muic_detect_dev()
611 mutex_unlock(&info->mutex); in max8997_muic_detect_dev()
616 mutex_unlock(&info->mutex); in max8997_muic_detect_dev()
623 struct max8997_muic_info *info = container_of(to_delayed_work(work), in max8997_muic_detect_cable_wq() local
627 ret = max8997_muic_detect_dev(info); in max8997_muic_detect_cable_wq()
629 dev_err(info->dev, "failed to detect cable type\n"); in max8997_muic_detect_cable_wq()
636 struct max8997_muic_info *info; in max8997_muic_probe() local
642 info = devm_kzalloc(&pdev->dev, sizeof(struct max8997_muic_info), in max8997_muic_probe()
644 if (!info) in max8997_muic_probe()
647 info->dev = &pdev->dev; in max8997_muic_probe()
648 info->muic = max8997->muic; in max8997_muic_probe()
650 platform_set_drvdata(pdev, info); in max8997_muic_probe()
651 mutex_init(&info->mutex); in max8997_muic_probe()
653 INIT_WORK(&info->irq_work, max8997_muic_irq_work); in max8997_muic_probe()
654 ret = devm_work_autocancel(&pdev->dev, &info->irq_work, in max8997_muic_probe()
672 muic_irq->name, info); in max8997_muic_probe()
682 info->edev = devm_extcon_dev_allocate(&pdev->dev, max8997_extcon_cable); in max8997_muic_probe()
683 if (IS_ERR(info->edev)) { in max8997_muic_probe()
685 return PTR_ERR(info->edev); in max8997_muic_probe()
688 ret = devm_extcon_dev_register(&pdev->dev, info->edev); in max8997_muic_probe()
700 max8997_write_reg(info->muic, in max8997_muic_probe()
710 info->path_uart = muic_pdata->path_uart; in max8997_muic_probe()
712 info->path_uart = CONTROL1_SW_UART; in max8997_muic_probe()
715 info->path_usb = muic_pdata->path_usb; in max8997_muic_probe()
717 info->path_usb = CONTROL1_SW_USB; in max8997_muic_probe()
729 info->path_uart = CONTROL1_SW_UART; in max8997_muic_probe()
730 info->path_usb = CONTROL1_SW_USB; in max8997_muic_probe()
735 ret = max8997_bulk_read(info->muic, MAX8997_MUIC_REG_STATUS1, in max8997_muic_probe()
736 2, info->status); in max8997_muic_probe()
738 dev_err(info->dev, "failed to read MUIC register\n"); in max8997_muic_probe()
741 cable_type = max8997_muic_get_cable_type(info, in max8997_muic_probe()
744 max8997_muic_set_path(info, info->path_uart, true); in max8997_muic_probe()
747 max8997_muic_set_debounce_time(info, ADC_DEBOUNCE_TIME_25MS); in max8997_muic_probe()
757 INIT_DELAYED_WORK(&info->wq_detcable, max8997_muic_detect_cable_wq); in max8997_muic_probe()
758 queue_delayed_work(system_power_efficient_wq, &info->wq_detcable, in max8997_muic_probe()