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()
57 return -ENOMEM; in pasemi_platform_i2c_probe()
59 smbus = &data->smbus; in pasemi_platform_i2c_probe()
60 smbus->dev = dev; in pasemi_platform_i2c_probe()
62 smbus->ioaddr = devm_platform_ioremap_resource(pdev, 0); in pasemi_platform_i2c_probe()
63 if (IS_ERR(smbus->ioaddr)) in pasemi_platform_i2c_probe()
64 return PTR_ERR(smbus->ioaddr); in pasemi_platform_i2c_probe()
66 if (of_property_read_u32(dev->of_node, "clock-frequency", &frequency)) in pasemi_platform_i2c_probe()
69 data->clk_ref = devm_clk_get_enabled(dev, NULL); in pasemi_platform_i2c_probe()
70 if (IS_ERR(data->clk_ref)) in pasemi_platform_i2c_probe()
71 return PTR_ERR(data->clk_ref); in pasemi_platform_i2c_probe()
77 smbus->adapter.dev.of_node = pdev->dev.of_node; in pasemi_platform_i2c_probe()
83 …error = devm_request_irq(smbus->dev, irq_num, pasemi_irq_handler, 0, "pasemi_apple_i2c", (void *)s… in pasemi_platform_i2c_probe()
86 smbus->use_irq = 1; in pasemi_platform_i2c_probe()
95 { .compatible = "apple,t8103-i2c" },
96 { .compatible = "apple,i2c" },
103 .name = "i2c-apple",