Lines Matching +full:t8103 +full:- +full:i2c

1 // SPDX-License-Identifier: GPL-2.0-only
9 #include <linux/i2c.h>
16 #include "i2c-pasemi-core.h"
27 unsigned long clk_rate = clk_get_rate(data->clk_ref); in pasemi_platform_i2c_calc_clk_div()
30 return -EINVAL; in pasemi_platform_i2c_calc_clk_div()
32 data->smbus.clk_div = DIV_ROUND_UP(clk_rate, 16 * frequency); in pasemi_platform_i2c_calc_clk_div()
33 if (data->smbus.clk_div < 4) in pasemi_platform_i2c_calc_clk_div()
34 return dev_err_probe(data->smbus.dev, -EINVAL, in pasemi_platform_i2c_calc_clk_div()
37 if (data->smbus.clk_div > 0xff) in pasemi_platform_i2c_calc_clk_div()
38 return dev_err_probe(data->smbus.dev, -EINVAL, in pasemi_platform_i2c_calc_clk_div()
47 struct device *dev = &pdev->dev; in pasemi_platform_i2c_probe()
56 return -ENOMEM; in pasemi_platform_i2c_probe()
58 smbus = &data->smbus; in pasemi_platform_i2c_probe()
59 smbus->dev = dev; in pasemi_platform_i2c_probe()
61 smbus->ioaddr = devm_platform_ioremap_resource(pdev, 0); in pasemi_platform_i2c_probe()
62 if (IS_ERR(smbus->ioaddr)) in pasemi_platform_i2c_probe()
63 return PTR_ERR(smbus->ioaddr); in pasemi_platform_i2c_probe()
65 if (of_property_read_u32(dev->of_node, "clock-frequency", &frequency)) in pasemi_platform_i2c_probe()
68 data->clk_ref = devm_clk_get(dev, NULL); in pasemi_platform_i2c_probe()
69 if (IS_ERR(data->clk_ref)) in pasemi_platform_i2c_probe()
70 return PTR_ERR(data->clk_ref); in pasemi_platform_i2c_probe()
72 error = clk_prepare_enable(data->clk_ref); in pasemi_platform_i2c_probe()
80 smbus->adapter.dev.of_node = pdev->dev.of_node; in pasemi_platform_i2c_probe()
90 clk_disable_unprepare(data->clk_ref); in pasemi_platform_i2c_probe()
99 clk_disable_unprepare(data->clk_ref); in pasemi_platform_i2c_remove()
104 { .compatible = "apple,t8103-i2c" },
105 { .compatible = "apple,i2c" },
112 .name = "i2c-apple",