Loading drivers/thermal/qcom-spmi-temp-alarm.c +50 −7 Original line number Diff line number Diff line /* * Copyright (c) 2011-2015, 2017-2018 The Linux Foundation. All rights reserved. * Copyright (c) 2011-2015, 2017-2019 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -78,6 +78,7 @@ struct qpnp_tm_chip { unsigned int stage; unsigned int prev_stage; unsigned int base; int irq; u32 init_thresh; struct iio_channel *adc; const long (*temp_map)[THRESH_COUNT][STAGE_COUNT]; Loading Loading @@ -273,7 +274,7 @@ static int qpnp_tm_probe(struct platform_device *pdev) u8 type, subtype, dig_major; unsigned long int flags; u32 res; int ret, irq; int ret; node = pdev->dev.of_node; Loading Loading @@ -301,9 +302,9 @@ static int qpnp_tm_probe(struct platform_device *pdev) } } irq = platform_get_irq(pdev, 0); if (irq < 0) return irq; chip->irq = platform_get_irq(pdev, 0); if (chip->irq < 0) return chip->irq; /* ADC based measurements are optional */ chip->adc = iio_channel_get(&pdev->dev, "thermal"); Loading Loading @@ -373,8 +374,8 @@ static int qpnp_tm_probe(struct platform_device *pdev) flags = IRQF_TRIGGER_RISING; } ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, qpnp_tm_isr, flags | IRQF_ONESHOT, node->name, chip); ret = devm_request_threaded_irq(&pdev->dev, chip->irq, NULL, qpnp_tm_isr, flags | IRQF_ONESHOT, node->name, chip); if (ret < 0) goto fail; Loading Loading @@ -405,6 +406,47 @@ static int qpnp_tm_remove(struct platform_device *pdev) return 0; } static int qpnp_tm_restore(struct device *dev) { int ret = 0; struct qpnp_tm_chip *chip = dev_get_drvdata(dev); struct device_node *node = dev->of_node; unsigned long int flags; if (chip->subtype == QPNP_TM_SUBTYPE_GEN2) flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING; else flags = IRQF_TRIGGER_RISING; if (chip->irq > 0) { ret = devm_request_threaded_irq(dev, chip->irq, NULL, qpnp_tm_isr, flags | IRQF_ONESHOT, node->name, chip); if (ret < 0) return ret; } ret = qpnp_tm_init(chip); if (ret < 0) dev_err(dev, "init failed\n"); return ret; } static int qpnp_tm_freeze(struct device *dev) { struct qpnp_tm_chip *chip = dev_get_drvdata(dev); if (chip->irq > 0) devm_free_irq(dev, chip->irq, chip); return 0; } static const struct dev_pm_ops qpnp_tm_pm_ops = { .freeze = qpnp_tm_freeze, .restore = qpnp_tm_restore, }; static const struct of_device_id qpnp_tm_match_table[] = { { .compatible = "qcom,spmi-temp-alarm" }, { } Loading @@ -415,6 +457,7 @@ static struct platform_driver qpnp_tm_driver = { .driver = { .name = "spmi-temp-alarm", .of_match_table = qpnp_tm_match_table, .pm = &qpnp_tm_pm_ops, }, .probe = qpnp_tm_probe, .remove = qpnp_tm_remove, Loading Loading
drivers/thermal/qcom-spmi-temp-alarm.c +50 −7 Original line number Diff line number Diff line /* * Copyright (c) 2011-2015, 2017-2018 The Linux Foundation. All rights reserved. * Copyright (c) 2011-2015, 2017-2019 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -78,6 +78,7 @@ struct qpnp_tm_chip { unsigned int stage; unsigned int prev_stage; unsigned int base; int irq; u32 init_thresh; struct iio_channel *adc; const long (*temp_map)[THRESH_COUNT][STAGE_COUNT]; Loading Loading @@ -273,7 +274,7 @@ static int qpnp_tm_probe(struct platform_device *pdev) u8 type, subtype, dig_major; unsigned long int flags; u32 res; int ret, irq; int ret; node = pdev->dev.of_node; Loading Loading @@ -301,9 +302,9 @@ static int qpnp_tm_probe(struct platform_device *pdev) } } irq = platform_get_irq(pdev, 0); if (irq < 0) return irq; chip->irq = platform_get_irq(pdev, 0); if (chip->irq < 0) return chip->irq; /* ADC based measurements are optional */ chip->adc = iio_channel_get(&pdev->dev, "thermal"); Loading Loading @@ -373,8 +374,8 @@ static int qpnp_tm_probe(struct platform_device *pdev) flags = IRQF_TRIGGER_RISING; } ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, qpnp_tm_isr, flags | IRQF_ONESHOT, node->name, chip); ret = devm_request_threaded_irq(&pdev->dev, chip->irq, NULL, qpnp_tm_isr, flags | IRQF_ONESHOT, node->name, chip); if (ret < 0) goto fail; Loading Loading @@ -405,6 +406,47 @@ static int qpnp_tm_remove(struct platform_device *pdev) return 0; } static int qpnp_tm_restore(struct device *dev) { int ret = 0; struct qpnp_tm_chip *chip = dev_get_drvdata(dev); struct device_node *node = dev->of_node; unsigned long int flags; if (chip->subtype == QPNP_TM_SUBTYPE_GEN2) flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING; else flags = IRQF_TRIGGER_RISING; if (chip->irq > 0) { ret = devm_request_threaded_irq(dev, chip->irq, NULL, qpnp_tm_isr, flags | IRQF_ONESHOT, node->name, chip); if (ret < 0) return ret; } ret = qpnp_tm_init(chip); if (ret < 0) dev_err(dev, "init failed\n"); return ret; } static int qpnp_tm_freeze(struct device *dev) { struct qpnp_tm_chip *chip = dev_get_drvdata(dev); if (chip->irq > 0) devm_free_irq(dev, chip->irq, chip); return 0; } static const struct dev_pm_ops qpnp_tm_pm_ops = { .freeze = qpnp_tm_freeze, .restore = qpnp_tm_restore, }; static const struct of_device_id qpnp_tm_match_table[] = { { .compatible = "qcom,spmi-temp-alarm" }, { } Loading @@ -415,6 +457,7 @@ static struct platform_driver qpnp_tm_driver = { .driver = { .name = "spmi-temp-alarm", .of_match_table = qpnp_tm_match_table, .pm = &qpnp_tm_pm_ops, }, .probe = qpnp_tm_probe, .remove = qpnp_tm_remove, Loading