diff options
author | Geert Uytterhoeven <geert+renesas@linux-m68k.org> | 2014-03-11 05:59:11 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-03-11 06:44:45 -0400 |
commit | e2a0ba547ba31cd7b217cc948d93e4edc78cbcb1 (patch) | |
tree | 8b090588d8b398317a3a1c8a6e99ad751f2815a0 /drivers | |
parent | f9ee821ebc5e58ff5da08d625ea4e2d74b221317 (diff) |
spi: sh-msiof: Convert to spi core auto_runtime_pm framework
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/spi/spi-sh-msiof.c | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c index 3ffb8eed5ac5..b6b013a2f397 100644 --- a/drivers/spi/spi-sh-msiof.c +++ b/drivers/spi/spi-sh-msiof.c | |||
@@ -449,9 +449,6 @@ static int sh_msiof_prepare_message(struct spi_master *master, | |||
449 | struct sh_msiof_spi_priv *p = spi_master_get_devdata(master); | 449 | struct sh_msiof_spi_priv *p = spi_master_get_devdata(master); |
450 | const struct spi_device *spi = msg->spi; | 450 | const struct spi_device *spi = msg->spi; |
451 | 451 | ||
452 | pm_runtime_get_sync(&p->pdev->dev); | ||
453 | clk_enable(p->clk); | ||
454 | |||
455 | /* Configure pins before asserting CS */ | 452 | /* Configure pins before asserting CS */ |
456 | sh_msiof_spi_set_pin_regs(p, !!(spi->mode & SPI_CPOL), | 453 | sh_msiof_spi_set_pin_regs(p, !!(spi->mode & SPI_CPOL), |
457 | !!(spi->mode & SPI_CPHA), | 454 | !!(spi->mode & SPI_CPHA), |
@@ -461,16 +458,6 @@ static int sh_msiof_prepare_message(struct spi_master *master, | |||
461 | return 0; | 458 | return 0; |
462 | } | 459 | } |
463 | 460 | ||
464 | static int sh_msiof_unprepare_message(struct spi_master *master, | ||
465 | struct spi_message *msg) | ||
466 | { | ||
467 | struct sh_msiof_spi_priv *p = spi_master_get_devdata(master); | ||
468 | |||
469 | clk_disable(p->clk); | ||
470 | pm_runtime_put(&p->pdev->dev); | ||
471 | return 0; | ||
472 | } | ||
473 | |||
474 | static int sh_msiof_spi_txrx_once(struct sh_msiof_spi_priv *p, | 461 | static int sh_msiof_spi_txrx_once(struct sh_msiof_spi_priv *p, |
475 | void (*tx_fifo)(struct sh_msiof_spi_priv *, | 462 | void (*tx_fifo)(struct sh_msiof_spi_priv *, |
476 | const void *, int, int), | 463 | const void *, int, int), |
@@ -743,12 +730,6 @@ static int sh_msiof_spi_probe(struct platform_device *pdev) | |||
743 | goto err1; | 730 | goto err1; |
744 | } | 731 | } |
745 | 732 | ||
746 | ret = clk_prepare(p->clk); | ||
747 | if (ret < 0) { | ||
748 | dev_err(&pdev->dev, "unable to prepare clock\n"); | ||
749 | goto err1; | ||
750 | } | ||
751 | |||
752 | p->pdev = pdev; | 733 | p->pdev = pdev; |
753 | pm_runtime_enable(&pdev->dev); | 734 | pm_runtime_enable(&pdev->dev); |
754 | 735 | ||
@@ -769,8 +750,8 @@ static int sh_msiof_spi_probe(struct platform_device *pdev) | |||
769 | master->num_chipselect = p->info->num_chipselect; | 750 | master->num_chipselect = p->info->num_chipselect; |
770 | master->setup = sh_msiof_spi_setup; | 751 | master->setup = sh_msiof_spi_setup; |
771 | master->prepare_message = sh_msiof_prepare_message; | 752 | master->prepare_message = sh_msiof_prepare_message; |
772 | master->unprepare_message = sh_msiof_unprepare_message; | ||
773 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(8, 32); | 753 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(8, 32); |
754 | master->auto_runtime_pm = true; | ||
774 | master->transfer_one = sh_msiof_transfer_one; | 755 | master->transfer_one = sh_msiof_transfer_one; |
775 | 756 | ||
776 | ret = devm_spi_register_master(&pdev->dev, master); | 757 | ret = devm_spi_register_master(&pdev->dev, master); |
@@ -783,7 +764,6 @@ static int sh_msiof_spi_probe(struct platform_device *pdev) | |||
783 | 764 | ||
784 | err2: | 765 | err2: |
785 | pm_runtime_disable(&pdev->dev); | 766 | pm_runtime_disable(&pdev->dev); |
786 | clk_unprepare(p->clk); | ||
787 | err1: | 767 | err1: |
788 | spi_master_put(master); | 768 | spi_master_put(master); |
789 | return ret; | 769 | return ret; |
@@ -791,10 +771,7 @@ static int sh_msiof_spi_probe(struct platform_device *pdev) | |||
791 | 771 | ||
792 | static int sh_msiof_spi_remove(struct platform_device *pdev) | 772 | static int sh_msiof_spi_remove(struct platform_device *pdev) |
793 | { | 773 | { |
794 | struct sh_msiof_spi_priv *p = platform_get_drvdata(pdev); | ||
795 | |||
796 | pm_runtime_disable(&pdev->dev); | 774 | pm_runtime_disable(&pdev->dev); |
797 | clk_unprepare(p->clk); | ||
798 | return 0; | 775 | return 0; |
799 | } | 776 | } |
800 | 777 | ||