Skip to content

Commit

Permalink
clk: max77686: Add support for MAX77620 clocks
Browse files Browse the repository at this point in the history
Maxim Max77620 has one 32KHz clock output and the clock HW
IP used on this PMIC is same as what it is there in the MAX77686.

Add clock driver support for MAX77620 on the MAX77686 driver.

CC: Krzysztof Kozlowski <k.kozlowski@samsung.com>
CC: Javier Martinez Canillas <javier@dowhile0.org>
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Tested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
  • Loading branch information
Laxman Dewangan authored and Stephen Boyd committed Aug 15, 2016
1 parent e581245 commit 5a227cd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/clk/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ config COMMON_CLK_WM831X
source "drivers/clk/versatile/Kconfig"

config COMMON_CLK_MAX77686
tristate "Clock driver for Maxim 77686/77802 MFD"
depends on MFD_MAX77686
tristate "Clock driver for Maxim 77620/77686/77802 MFD"
depends on MFD_MAX77686 || MFD_MAX77620
---help---
This driver supports Maxim 77686/77802 crystal oscillator clock.
This driver supports Maxim 77620/77686/77802 crystal oscillator
clock.

config COMMON_CLK_RK808
tristate "Clock driver for RK808/RK818"
Expand Down
18 changes: 18 additions & 0 deletions drivers/clk/clk-max77686.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <linux/err.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/mfd/max77620.h>
#include <linux/mfd/max77686.h>
#include <linux/mfd/max77686-private.h>
#include <linux/clk-provider.h>
Expand All @@ -35,12 +36,14 @@

#include <dt-bindings/clock/maxim,max77686.h>
#include <dt-bindings/clock/maxim,max77802.h>
#include <dt-bindings/clock/maxim,max77620.h>

#define MAX77802_CLOCK_LOW_JITTER_SHIFT 0x3

enum max77686_chip_name {
CHIP_MAX77686,
CHIP_MAX77802,
CHIP_MAX77620,
};

struct max77686_hw_clk_info {
Expand Down Expand Up @@ -97,6 +100,15 @@ max77686_hw_clk_info max77802_hw_clks_info[MAX77802_CLKS_NUM] = {
},
};

static const struct
max77686_hw_clk_info max77620_hw_clks_info[MAX77620_CLKS_NUM] = {
[MAX77620_CLK_32K_OUT0] = {
.name = "32khz_out0",
.clk_reg = MAX77620_REG_CNFG1_32K,
.clk_enable_mask = MAX77620_CNFG1_32K_OUT0_EN,
},
};

static struct max77686_clk_init_data *to_max77686_clk_init_data(
struct clk_hw *hw)
{
Expand Down Expand Up @@ -181,6 +193,11 @@ static int max77686_clk_probe(struct platform_device *pdev)
hw_clks = max77802_hw_clks_info;
break;

case CHIP_MAX77620:
num_clks = MAX77620_CLKS_NUM;
hw_clks = max77620_hw_clks_info;
break;

default:
dev_err(dev, "Unknown Chip ID\n");
return -EINVAL;
Expand Down Expand Up @@ -284,6 +301,7 @@ static int max77686_clk_remove(struct platform_device *pdev)
static const struct platform_device_id max77686_clk_id[] = {
{ "max77686-clk", .driver_data = CHIP_MAX77686, },
{ "max77802-clk", .driver_data = CHIP_MAX77802, },
{ "max77620-clock", .driver_data = CHIP_MAX77620, },
{},
};
MODULE_DEVICE_TABLE(platform, max77686_clk_id);
Expand Down

0 comments on commit 5a227cd

Please sign in to comment.