From a5969cabbb4660eab42b6ef0412cbbd1200cf14d Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Sat, 12 Oct 2024 07:10:09 +0000 Subject: [PATCH] 修改led为gpio --- kernel/drivers/i2c/busses/i2c-hix5hd2.c | 24 +++++++----------------- 1 files changed, 7 insertions(+), 17 deletions(-) diff --git a/kernel/drivers/i2c/busses/i2c-hix5hd2.c b/kernel/drivers/i2c/busses/i2c-hix5hd2.c index 0f08ef1..8993534 100644 --- a/kernel/drivers/i2c/busses/i2c-hix5hd2.c +++ b/kernel/drivers/i2c/busses/i2c-hix5hd2.c @@ -1,11 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (c) 2014 Linaro Ltd. * Copyright (c) 2014 Hisilicon Limited. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. * * Now only support 7 bit address. */ @@ -71,8 +67,6 @@ #define I2C_ACK_INTR BIT(2) #define I2C_ARBITRATE_INTR BIT(1) #define I2C_OVER_INTR BIT(0) - -#define HIX5I2C_MAX_FREQ 400000 /* 400k */ enum hix5hd2_i2c_state { HIX5I2C_STAT_RW_ERR = -1, @@ -394,7 +388,6 @@ { struct device_node *np = pdev->dev.of_node; struct hix5hd2_i2c_priv *priv; - struct resource *mem; unsigned int freq; int irq, ret; @@ -404,27 +397,24 @@ if (of_property_read_u32(np, "clock-frequency", &freq)) { /* use 100k as default value */ - priv->freq = 100000; + priv->freq = I2C_MAX_STANDARD_MODE_FREQ; } else { - if (freq > HIX5I2C_MAX_FREQ) { - priv->freq = HIX5I2C_MAX_FREQ; + if (freq > I2C_MAX_FAST_MODE_FREQ) { + priv->freq = I2C_MAX_FAST_MODE_FREQ; dev_warn(priv->dev, "use max freq %d instead\n", - HIX5I2C_MAX_FREQ); + I2C_MAX_FAST_MODE_FREQ); } else { priv->freq = freq; } } - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - priv->regs = devm_ioremap_resource(&pdev->dev, mem); + priv->regs = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(priv->regs)) return PTR_ERR(priv->regs); irq = platform_get_irq(pdev, 0); - if (irq <= 0) { - dev_err(&pdev->dev, "cannot find HS-I2C IRQ\n"); + if (irq < 0) return irq; - } priv->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(priv->clk)) { -- Gitblit v1.6.2