From 52f4ac49f491bc363c9ded8cb513d3e46e3584e4 Mon Sep 17 00:00:00 2001 From: Damon Ding Date: Tue, 24 Oct 2023 10:41:23 +0800 Subject: [PATCH 01/35] misc: rk628: add support for pwm In addition, add pwm debugfs file to dump regs: cat /sys/kernel/debug/rk628/2-0050/pwm_regs Signed-off-by: Damon Ding Change-Id: I80ae8e40562d7593f1a2183ea73e29de798495f4 --- drivers/misc/rk628/Makefile | 2 +- drivers/misc/rk628/panel.c | 13 +- drivers/misc/rk628/rk628.c | 99 ++++++++- drivers/misc/rk628/rk628.h | 19 ++ drivers/misc/rk628/rk628_pwm.c | 393 +++++++++++++++++++++++++++++++++ drivers/misc/rk628/rk628_pwm.h | 16 ++ 6 files changed, 529 insertions(+), 13 deletions(-) create mode 100644 drivers/misc/rk628/rk628_pwm.c create mode 100644 drivers/misc/rk628/rk628_pwm.h diff --git a/drivers/misc/rk628/Makefile b/drivers/misc/rk628/Makefile index fe5b33b4e52f..d463d90b6782 100644 --- a/drivers/misc/rk628/Makefile +++ b/drivers/misc/rk628/Makefile @@ -3,7 +3,7 @@ rk628_misc-$(CONFIG_RK628_MISC) += rk628.o rk628_cru.o rk628_config.o rk628_post_process.o \ rk628_combrxphy.o rk628_hdmirx.o rk628_combtxphy.o rk628_dsi.o \ panel.o rk628_lvds.o rk628_rgb.o rk628_gvi.o rk628_pinctrl.o \ - rk628_csi.o rk628_efuse.o + rk628_csi.o rk628_efuse.o rk628_pwm.o rk628_misc-$(CONFIG_RK628_MISC_HDMITX) += rk628_hdmitx.o diff --git a/drivers/misc/rk628/panel.c b/drivers/misc/rk628/panel.c index ed7b89b335ea..a3feb4dbfde1 100644 --- a/drivers/misc/rk628/panel.c +++ b/drivers/misc/rk628/panel.c @@ -164,14 +164,15 @@ int rk628_panel_info_get(struct rk628 *rk628, struct device_node *np) backlight = of_parse_phandle(dev->of_node, "panel-backlight", 0); if (backlight) { - panel->backlight = of_find_backlight_by_node(backlight); - of_node_put(backlight); + if (!rk628->pwm_bl_en) { + panel->backlight = of_find_backlight_by_node(backlight); + of_node_put(backlight); - if (!panel->backlight) { - dev_err(dev, "failed to find backlight\n"); - return -EPROBE_DEFER; + if (!panel->backlight) { + dev_err(dev, "%s: failed to find backlight\n", __func__); + return -EPROBE_DEFER; + } } - } device_property_read_u32(dev, "panel-prepare-delay-ms", &panel->delay.prepare); diff --git a/drivers/misc/rk628/rk628.c b/drivers/misc/rk628/rk628.c index af7069748d43..102e8b12ff83 100644 --- a/drivers/misc/rk628/rk628.c +++ b/drivers/misc/rk628/rk628.c @@ -31,6 +31,7 @@ #include "rk628_hdmitx.h" #include "rk628_efuse.h" #include "rk628_config.h" +#include "rk628_pwm.h" static const struct regmap_range rk628_cru_readable_ranges[] = { regmap_reg_range(CRU_CPLL_CON0, CRU_CPLL_CON4), @@ -586,6 +587,27 @@ static int rk628_fb_notifier_callback(struct notifier_block *nb, } #endif +static int rk628_get_pwm_bl(struct rk628 *rk628) +{ + struct device_node *backlight; + + backlight = of_parse_phandle(rk628->dev->of_node, "panel-backlight", 0); + if (backlight) { + rk628->panel->backlight = of_find_backlight_by_node(backlight); + of_node_put(backlight); + + if (!rk628->panel->backlight) { + dev_err(rk628->dev, "%s: failed to find backlight\n", __func__); + return -EAGAIN; + } + } else { + dev_err(rk628->dev, "%s: failed to find panel-backlight\n", __func__); + return -EINVAL; + } + + return 0; +} + static void rk628_display_work(struct work_struct *work) { u8 ret = 0; @@ -609,7 +631,22 @@ static void rk628_display_work(struct work_struct *work) if (ret & HDMIRX_PLUGIN) { /* if resolution or input format change, disable first */ rk628_display_disable(rk628); - rk628_display_enable(rk628); + if (rk628->pwm_bl_en && !rk628->panel->backlight) { + int bl_ret = 0; + + bl_ret = rk628_get_pwm_bl(rk628); + if (!bl_ret) { + rk628_display_enable(rk628); + } else if (bl_ret == -EAGAIN) { + queue_delayed_work(rk628->monitor_wq, + &rk628->delay_work, msecs_to_jiffies(50)); + return; + } else { + return; + } + } else { + rk628_display_enable(rk628); + } } else if (ret & HDMIRX_PLUGOUT) { rk628_display_disable(rk628); } @@ -914,6 +951,19 @@ static int rk628_display_timings_get(struct rk628 *rk628) } +static void rk628_pwm_work(struct work_struct *work) +{ + struct rk628 *rk628 = container_of(work, struct rk628, pwm_delay_work.work); + int ret; + + ret = rk628_get_pwm_bl(rk628); + if (!ret) + rk628_display_enable(rk628); + else if (ret == -EAGAIN) + queue_delayed_work(rk628->pwm_wq, &rk628->pwm_delay_work, + msecs_to_jiffies(50)); +} + #define DEBUG_PRINT(args...) \ do { \ if (s) \ @@ -1377,6 +1427,7 @@ static void rk628_debugfs_create(struct rk628 *rk628) rk628_mipi_dsi_create_debugfs_file(rk628); rk628_gvi_create_debugfs_file(rk628); rk628_hdmitx_create_debugfs_file(rk628); + rk628_pwm_create_debugfs_file(rk628); } static void rk628_loader_protect(struct rk628 *rk628) @@ -1412,6 +1463,7 @@ rk628_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) struct rk628 *rk628; int i, ret; unsigned long irq_flags; + struct device_node *np; rk628 = devm_kzalloc(dev, sizeof(*rk628), GFP_KERNEL); if (!rk628) @@ -1422,17 +1474,38 @@ rk628_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) i2c_set_clientdata(client, rk628); rk628->hdmirx_irq = client->irq; + np = of_find_node_by_name(rk628->dev->of_node, "rk628-pwm"); + if (of_device_is_available(np)) { + ret = rk628_pwm_probe(rk628, np); + if (ret) { + of_node_put(np); + dev_err(dev, "failed to probe pwm\n"); + return ret; + } + } + of_node_put(np); + + if (rk628->pwm_bl_en) { + rk628->pwm_wq = alloc_ordered_workqueue("%s", + WQ_MEM_RECLAIM | WQ_FREEZABLE, "rk628-pwm-wq"); + if (!rk628->pwm_wq) + return -ENOMEM; + + INIT_DELAYED_WORK(&rk628->pwm_delay_work, rk628_pwm_work); + } + ret = rk628_display_route_info_parse(rk628); if (ret) { - dev_err(dev, "display route parse err\n"); - return ret; + if (ret != -EPROBE_DEFER) + dev_err(dev, "display route err\n"); + goto destroy_pwm_wq; } if (!rk628_output_is_csi(rk628)) { ret = rk628_display_timings_get(rk628); if (ret && !rk628_output_is_hdmi(rk628)) { dev_info(dev, "display timings err\n"); - return ret; + goto destroy_pwm_wq; } } @@ -1443,7 +1516,7 @@ rk628_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) if (IS_ERR(rk628->soc_24M)) { ret = PTR_ERR(rk628->soc_24M); dev_err(dev, "Unable to get soc_24M: %d\n", ret); - return ret; + goto destroy_pwm_wq; } clk_prepare_enable(rk628->soc_24M); @@ -1518,6 +1591,8 @@ rk628_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) INIT_DELAYED_WORK(&rk628->dsi_delay_work, rk628_dsi_work); } + rk628_pwm_init(rk628); + rk628_cru_init(rk628); if (rk628_output_is_csi(rk628)) @@ -1566,7 +1641,11 @@ rk628_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) msecs_to_jiffies(50)); } } else { - rk628_display_enable(rk628); + if (rk628->pwm_bl_en) + queue_delayed_work(rk628->pwm_wq, &rk628->pwm_delay_work, + msecs_to_jiffies(50)); + else + rk628_display_enable(rk628); } pm_runtime_enable(dev); @@ -1576,6 +1655,11 @@ rk628_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) err_clk: clk_disable_unprepare(rk628->soc_24M); + +destroy_pwm_wq: + if (rk628->pwm_wq) + destroy_workqueue(rk628->pwm_wq); + return ret; } @@ -1601,6 +1685,9 @@ static int rk628_i2c_remove(struct i2c_client *client) rk628_set_hdmirx_irq(rk628, GRF_INTR0_EN, false); cancel_delayed_work_sync(&rk628->delay_work); destroy_workqueue(rk628->monitor_wq); + cancel_delayed_work_sync(&rk628->pwm_delay_work); + destroy_workqueue(rk628->pwm_wq); + put_device(&rk628->panel->backlight->dev); pm_runtime_disable(dev); clk_disable_unprepare(rk628->soc_24M); #if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE diff --git a/drivers/misc/rk628/rk628.h b/drivers/misc/rk628/rk628.h index e257a29a3e67..3ceacf1822ad 100644 --- a/drivers/misc/rk628/rk628.h +++ b/drivers/misc/rk628/rk628.h @@ -18,6 +18,7 @@ #include #include #include +#include #define DRIVER_VERSION "0.1.0" #define UPDATE(x, h, l) (((x) << (l)) & GENMASK((h), (l))) @@ -223,6 +224,11 @@ #define GRF_OS_REG1 0x0144 #define GRF_OS_REG2 0x0148 #define GRF_OS_REG3 0x014c +#define GRF_PWM_PERIOD 0x0150 +#define GRF_PWM_DUTY 0x0154 +#define GRF_PWM_CTRL 0x0158 +#define GRF_PWM_CH_CNT 0x015c +#define GRF_PWM_STATUS 0x0160 #define GRF_RGB_RX_DBG_MEAS0 0x0170 #define RGB_RX_EVAL_TIME_MASK GENMASK(27, 16) #define RGB_RX_MODET_EN BIT(1) @@ -547,6 +553,15 @@ struct rk628_rgb { bool bt1120_uv_swap; }; +struct rk628_pwm { + struct pwm_chip chip; + unsigned long clk_rate; + bool center_aligned; + bool oneshot_en; + bool is_output_m1; + int irq; +}; + struct rk628 { struct device *dev; struct i2c_client *client; @@ -578,12 +593,16 @@ struct rk628 { struct rk628_lvds lvds; struct rk628_gvi gvi; struct rk628_combtxphy combtxphy; + struct rk628_pwm pwm; int sync_pol; void *csi; struct notifier_block fb_nb; u32 version; struct rk628_rgb rgb; int old_blank; + struct workqueue_struct *pwm_wq; + struct delayed_work pwm_delay_work; + bool pwm_bl_en; }; static inline bool rk628_input_is_hdmi(struct rk628 *rk628) diff --git a/drivers/misc/rk628/rk628_pwm.c b/drivers/misc/rk628/rk628_pwm.c new file mode 100644 index 000000000000..4ad962989116 --- /dev/null +++ b/drivers/misc/rk628/rk628_pwm.c @@ -0,0 +1,393 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2023 Rockchip Electronics Co., Ltd. + * + * Author: Lingsong Ding + */ + +#include +#include +#include "rk628.h" +#include "rk628_cru.h" +#include "rk628_gpio.h" +#include "rk628_pwm.h" + +#define PWM_ENABLE (1 << 0) +#define PWM_MODE_SHIFT 1 +#define PWM_MODE_MASK (0x3 << PWM_MODE_SHIFT) +#define PWM_ONESHOT (0 << PWM_MODE_SHIFT) +#define PWM_CONTINUOUS (1 << PWM_MODE_SHIFT) +#define PWM_DUTY_POSITIVE (1 << 3) +#define PWM_DUTY_NEGATIVE (0 << 3) +#define PWM_INACTIVE_NEGATIVE (0 << 4) +#define PWM_INACTIVE_POSITIVE (1 << 4) +#define PWM_POLARITY_MASK (PWM_DUTY_POSITIVE | PWM_INACTIVE_POSITIVE) +#define PWM_OUTPUT_LEFT (0 << 5) +#define PWM_OUTPUT_CENTER (1 << 5) +#define PWM_LP_DISABLE (0 << 8) +#define PWM_CLK_SEL_SHIFT 9 +#define PWM_CLK_SEL_MASK (1 << PWM_CLK_SEL_SHIFT) +#define PWM_SEL_NO_SCALED_CLOCK (0 << PWM_CLK_SEL_SHIFT) +#define PWM_SEL_SCALED_CLOCK (1 << PWM_CLK_SEL_SHIFT) +#define PWM_PRESCELE_SHIFT 12 +#define PWM_PRESCALE_MASK (0x3 << PWM_PRESCELE_SHIFT) +#define PWM_SCALE_SHIFT 16 +#define PWM_SCALE_MASK (0xff << PWM_SCALE_SHIFT) + +#define PWM_ONESHOT_COUNT_SHIFT 24 +#define PWM_ONESHOT_COUNT_MASK (0xff << PWM_ONESHOT_COUNT_SHIFT) +#define PWM_ONESHOT_COUNT_MAX 256 + +#define PWM_EN_CLR_SHIFT 2 +#define PWM_EN_CLR (1 << PWM_EN_CLR_SHIFT) +#define PWM_INT_SET_SHIFT 3 + +#define PWM_ENABLE_CONF (PWM_OUTPUT_LEFT | PWM_LP_DISABLE | PWM_ENABLE | PWM_CONTINUOUS) +#define PWM_ENABLE_CONF_MASK (GENMASK(2, 0) | BIT(5) | BIT(8)) + +#define PWM_DCLK_RATE 24000000 + +#define DEBUG_PRINT(args...) \ + do { \ + if (s) \ + seq_printf(s, args); \ + else \ + pr_info(args); \ + } while (0) + +static inline struct rk628 *to_rk628(struct rk628_pwm *p) +{ + return container_of(p, struct rk628, pwm); +} + +static inline struct rk628_pwm *to_rk628_pwm(struct pwm_chip *pc) +{ + return container_of(pc, struct rk628_pwm, chip); +} + +static void rk628_pwm_dclk_enable(struct rk628 *rk628) +{ +} + +static void rk628_pwm_dclk_disable(struct rk628 *rk628) +{ +} + +#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE +static void rk628_pwm_get_state(struct pwm_chip *chip, + struct pwm_device *pwm, + struct pwm_state *state) +#else +static int rk628_pwm_get_state(struct pwm_chip *chip, + struct pwm_device *pwm, + struct pwm_state *state) +#endif +{ + struct rk628_pwm *p = to_rk628_pwm(chip); + struct rk628 *rk628 = to_rk628(p); + u32 enable_conf = PWM_ENABLE_CONF; + u32 val; + u32 dclk_div; + u64 tmp; + + dclk_div = p->oneshot_en ? 2 : 1; + + rk628_i2c_read(rk628, GRF_PWM_PERIOD, &val); + tmp = val * dclk_div * NSEC_PER_SEC; + state->period = DIV_ROUND_CLOSEST_ULL(tmp, p->clk_rate); + + rk628_i2c_read(rk628, GRF_PWM_DUTY, &val); + tmp = val * dclk_div * NSEC_PER_SEC; + state->duty_cycle = DIV_ROUND_CLOSEST_ULL(tmp, p->clk_rate); + + rk628_i2c_read(rk628, GRF_PWM_CTRL, &val); + if (p->oneshot_en) + enable_conf &= ~PWM_CONTINUOUS; + state->enabled = (val & enable_conf) == enable_conf; + + if (!(val & PWM_DUTY_POSITIVE)) + state->polarity = PWM_POLARITY_INVERSED; + else + state->polarity = PWM_POLARITY_NORMAL; +#if KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE + return 0; +#endif +} + +static void rk628_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, + const struct pwm_state *state) +{ + struct rk628_pwm *p = to_rk628_pwm(chip); + struct rk628 *rk628 = to_rk628(p); + unsigned long period, duty; + u64 div; + u32 ctrl; + u8 dclk_div = 1; + +#ifdef CONFIG_PWM_ROCKCHIP_ONESHOT + if (state->oneshot_count > 0 && state->oneshot_count <= PWM_ONESHOT_COUNT_MAX) + dclk_div = 2; +#endif + + /* + * Since period and duty cycle registers have a width of 32 + * bits, every possible input period can be obtained using the + * default prescaler value for all practical clock rate values. + */ + div = (u64)p->clk_rate * state->period; + period = DIV_ROUND_CLOSEST_ULL(div, dclk_div * NSEC_PER_SEC); + + div = (u64)p->clk_rate * state->duty_cycle; + duty = DIV_ROUND_CLOSEST_ULL(div, dclk_div * NSEC_PER_SEC); + + /* + * Lock the period and duty of previous configuration, then + * change the duty and period, that would not be effective. + */ + rk628_i2c_read(rk628, GRF_PWM_CTRL, &ctrl); + +#ifdef CONFIG_PWM_ROCKCHIP_ONESHOT + if (state->oneshot_count > 0 && state->oneshot_count <= PWM_ONESHOT_COUNT_MAX) { + u32 int_ctrl; + + /* + * This is a workaround, an uncertain waveform will be + * generated after oneshot ends. It is needed to enable + * the dclk scale function to resolve it. It doesn't + * matter what the scale factor is, just make sure the + * scale function is turned on, for which we set scale + * factor to 2. + */ + ctrl &= ~PWM_SCALE_MASK; + ctrl |= (dclk_div / 2) << PWM_SCALE_SHIFT; + ctrl &= ~PWM_CLK_SEL_MASK; + ctrl |= PWM_SEL_SCALED_CLOCK; + + p->oneshot_en = true; + ctrl &= ~PWM_MODE_MASK; + ctrl |= PWM_ONESHOT; + + ctrl &= ~PWM_ONESHOT_COUNT_MASK; + ctrl |= (state->oneshot_count - 1) << PWM_ONESHOT_COUNT_SHIFT; + + rk628_i2c_read(rk628, GRF_PWM_STATUS, &int_ctrl); + int_ctrl |= PWM_EN_CLR; + rk628_i2c_write(rk628, GRF_PWM_STATUS, int_ctrl); + } else { + u32 int_ctrl; + + ctrl &= ~PWM_SCALE_MASK; + ctrl &= ~PWM_CLK_SEL_MASK; + ctrl |= PWM_SEL_NO_SCALED_CLOCK; + + if (state->oneshot_count) + dev_err(chip->dev, "Oneshot_count must be between 1 and 256.\n"); + + p->oneshot_en = false; + ctrl &= ~PWM_MODE_MASK; + ctrl |= PWM_CONTINUOUS; + + ctrl &= ~PWM_ONESHOT_COUNT_MASK; + + rk628_i2c_read(rk628, GRF_PWM_STATUS, &int_ctrl); + int_ctrl &= ~PWM_EN_CLR; + rk628_i2c_write(rk628, GRF_PWM_STATUS, int_ctrl); + } +#endif + + rk628_i2c_write(rk628, GRF_PWM_PERIOD, period); + rk628_i2c_write(rk628, GRF_PWM_DUTY, duty); + + ctrl &= ~PWM_POLARITY_MASK; + if (state->polarity == PWM_POLARITY_INVERSED) + ctrl |= PWM_DUTY_NEGATIVE | PWM_INACTIVE_POSITIVE; + else + ctrl |= PWM_DUTY_POSITIVE | PWM_INACTIVE_NEGATIVE; + + rk628_i2c_write(rk628, GRF_PWM_CTRL, ctrl); +} + +static int rk628_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm, bool enable) +{ + struct rk628_pwm *p = to_rk628_pwm(chip); + struct rk628 *rk628 = to_rk628(p); + u32 val; + + if (enable) + rk628_pwm_dclk_enable(rk628); + + rk628_i2c_read(rk628, GRF_PWM_CTRL, &val); + val &= ~PWM_ENABLE_CONF_MASK; + + if (p->center_aligned) + val |= PWM_OUTPUT_CENTER; + + if (enable) { + val |= PWM_ENABLE_CONF; + if (p->oneshot_en) + val &= ~PWM_CONTINUOUS; + } else { + val &= ~PWM_ENABLE_CONF; + } + + rk628_i2c_write(rk628, GRF_PWM_CTRL, val); + + if (!enable) + rk628_pwm_dclk_disable(rk628); + + return 0; +} + +static void rk628_pwm_set_iomux(struct pwm_chip *chip) +{ + struct rk628_pwm *p = to_rk628_pwm(chip); + struct rk628 *rk628 = to_rk628(p); + + /* + * The pwm output iomux: + * m0: gpio3b4 + * m1: gpio0a6 + */ + if (p->is_output_m1) { + rk628_i2c_write(rk628, GRF_GPIO0AB_SEL_CON, 0x03000300); + rk628_i2c_write(rk628, RK628_GPIO0_BASE + GPIO_SWPORT_DDR_L, 0x00400040); + } else { + rk628_i2c_write(rk628, GRF_GPIO3AB_SEL_CON, 0x30003000); + rk628_i2c_write(rk628, RK628_GPIO3_BASE + GPIO_SWPORT_DDR_L, 0x10001000); + } +} + +static int rk628_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, + const struct pwm_state *state) +{ + struct pwm_state curstate; + bool enabled; + int ret = 0; + + pwm_get_state(pwm, &curstate); + enabled = curstate.enabled; + + if (state->polarity != curstate.polarity && enabled) { + ret = rk628_pwm_enable(chip, pwm, false); + if (ret) + goto out; + enabled = false; + } + + rk628_pwm_config(chip, pwm, state); + if (state->enabled != enabled) { + ret = rk628_pwm_enable(chip, pwm, state->enabled); + if (ret) + goto out; + } + + if (state->enabled) + rk628_pwm_set_iomux(chip); + +out: + return ret; +} + +static const struct pwm_ops rk628_pwm_ops = { + .get_state = rk628_pwm_get_state, + .apply = rk628_pwm_apply, + .owner = THIS_MODULE, +}; + +int rk628_pwm_probe(struct rk628 *rk628, struct device_node *pwm_np) +{ + struct pwm_chip *chip = &rk628->pwm.chip; + struct platform_device *pd; + int ret; + + pd = platform_device_alloc("rk628-pwm", -1); + if (!pd) { + dev_err(rk628->dev, "failed to alloc pwm platform device\n"); + return -EINVAL; + } + + ret = platform_device_add(pd); + if (ret) { + dev_err(rk628->dev, "failed to add pwm platform device\n"); + return -EINVAL; + } + + chip->dev = &pd->dev; + chip->dev->of_node = pwm_np; + chip->ops = &rk628_pwm_ops; + chip->base = -1; + chip->npwm = 1; + chip->of_xlate = of_pwm_xlate_with_flags; + chip->of_pwm_n_cells = 3; + + rk628->pwm.clk_rate = PWM_DCLK_RATE; + + rk628->pwm.center_aligned = of_property_read_bool(pwm_np, "pwm,center-aligned"); + rk628->pwm.is_output_m1 = of_property_read_bool(pwm_np, "pwm,output-m1"); + rk628->pwm_bl_en = of_property_read_bool(pwm_np, "pwm,backlight"); + + ret = pwmchip_add(chip); + if (ret < 0) { + dev_err(rk628->dev, "pwmchip_add() failed: %d\n", ret); + return ret; + } + + /* + * To avoid warning in devm_pwm_get() process. + */ + pd->dev.links.status = DL_DEV_PROBING; + + return 0; +} + +void rk628_pwm_init(struct rk628 *rk628) +{ + u32 ctrl; + bool enabled; + + rk628_i2c_read(rk628, GRF_PWM_CTRL, &ctrl); + enabled = (ctrl & PWM_ENABLE_CONF) == PWM_ENABLE_CONF; + if (!enabled) + rk628_pwm_dclk_disable(rk628); +} + +static int rk628_debugfs_pwm_regs_dump(struct seq_file *s, void *data) +{ + struct rk628 *rk628 = s->private; + u32 val; + + DEBUG_PRINT("pwm regs:\n"); + rk628_i2c_read(rk628, GRF_PWM_PERIOD, &val); + DEBUG_PRINT("period: 0x%08x\n", val); + rk628_i2c_read(rk628, GRF_PWM_DUTY, &val); + DEBUG_PRINT("duty: 0x%08x\n", val); + rk628_i2c_read(rk628, GRF_PWM_CTRL, &val); + DEBUG_PRINT("ctrl: 0x%08x\n", val); + rk628_i2c_read(rk628, GRF_PWM_CH_CNT, &val); + DEBUG_PRINT("ch_cnt: 0x%08x\n", val); + rk628_i2c_read(rk628, GRF_PWM_STATUS, &val); + DEBUG_PRINT("status: 0x%08x\n", val); + + return 0; +} + +static int rk628_debugfs_pwm_regs_open(struct inode *inode, struct file *file) +{ + struct rk628 *rk628 = inode->i_private; + + return single_open(file, rk628_debugfs_pwm_regs_dump, rk628); +} + +static const struct file_operations rk628_debugfs_pwm_regs_fops = { + .owner = THIS_MODULE, + .open = rk628_debugfs_pwm_regs_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +void rk628_pwm_create_debugfs_file(struct rk628 *rk628) +{ + debugfs_create_file("pwm_regs", 0400, rk628->debug_dir, rk628, + &rk628_debugfs_pwm_regs_fops); +} diff --git a/drivers/misc/rk628/rk628_pwm.h b/drivers/misc/rk628/rk628_pwm.h new file mode 100644 index 000000000000..a2c8c9295ba1 --- /dev/null +++ b/drivers/misc/rk628/rk628_pwm.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 + * + * Copyright (c) 2023 Rockchip Electronics Co., Ltd. + * + * Author: Lingsong Ding + */ + +#ifndef RK628_PWM_H +#define RK628_PWM_H +#include "rk628.h" + +int rk628_pwm_probe(struct rk628 *rk628, struct device_node *pwm_np); +void rk628_pwm_init(struct rk628 *rk628); +void rk628_pwm_create_debugfs_file(struct rk628 *rk628); + +#endif From 093fb7f0ced3c9df0eebbca5f5de970d8a9b28ad Mon Sep 17 00:00:00 2001 From: Zhibin Huang Date: Mon, 20 Jan 2025 18:05:17 +0800 Subject: [PATCH 02/35] misc: rk628: Fix probability of WARNING when sleeping The warning log is as follows: [ 2548.269614][ T7373] workqueue: WQ_MEM_RECLAIM rk628-monitor-wq:rk628_display_work is flushing !WQ_MEM_RECLAIM events:rk628_hdmirx_delayed_work_audio [ 2548.269661][ T7373] WARNING: CPU: 3 PID: 7373 at kernel/workqueue.c:2652 check_flush_dependency+0x11c/0x124 [ 2548.269696][ T7373] Modules linked in: wlan_mt7663_usb rtl8367vb btmtk_usb_unify [ 2548.269727][ T7373] CPU: 3 PID: 7373 Comm: kworker/u16:4 Not tainted 6.1.75 #3 [ 2548.269741][ T7373] Hardware name: LANGO RK3576 V10 Board (DT) [ 2548.269754][ T7373] Workqueue: rk628-monitor-wq rk628_display_work [ 2548.269768][ T7373] pstate: 604000c5 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 2548.269783][ T7373] pc : check_flush_dependency+0x11c/0x124 [ 2548.269796][ T7373] lr : check_flush_dependency+0x11c/0x124 [ 2548.269808][ T7373] sp : ffffffc0134dbbb0 [ 2548.269816][ T7373] x29: ffffffc0134dbbb0 x28: ffffff80c2a31108 x27: ffffffc008079110 [ 2548.269831][ T7373] x26: ffffffc0134dbc98 x25: ffffff8093d0c9c0 x24: ffffff8092141e80 [ 2548.269847][ T7373] x23: ffffff81f6d88d00 x22: ffffff8092141e80 x21: ffffff807cc366c0 [ 2548.269861][ T7373] x20: ffffff80c0008600 x19: ffffffc008a036ec x18: ffffffc00f3e3050 [ 2548.269876][ T7373] x17: 0000000000000069 x16: ffffffffffffffff x15: 0000000000000004 [ 2548.269891][ T7373] x14: ffffffc009fdd720 x13: 0000000000000a9e x12: 0000000000000003 [ 2548.269906][ T7373] x11: 0000000000000000 x10: 0000000000000027 x9 : 7313130eec8ea700 [ 2548.269920][ T7373] x8 : 7313130eec8ea700 x7 : 7f7f7f7f7f7f7f7f x6 : fefefefeff6e6863 [ 2548.269934][ T7373] x5 : 000000000000001c x4 : 0000000000000018 x3 : 0000000000000000 [ 2548.269948][ T7373] x2 : 0000000000000000 x1 : ffffffc0134db950 x0 : 0000000000000080 [ 2548.269964][ T7373] Call trace: [ 2548.269973][ T7373] check_flush_dependency+0x11c/0x124 [ 2548.269987][ T7373] __flush_work+0xc8/0x2ac [ 2548.270000][ T7373] __cancel_work_timer+0x128/0x1c8 [ 2548.270012][ T7373] cancel_delayed_work_sync+0x14/0x24 [ 2548.270025][ T7373] rk628_hdmirx_disable+0x40/0xc0 [ 2548.270038][ T7373] rk628_display_disable+0x54/0xbc [ 2548.270048][ T7373] rk628_display_work+0x7c/0xd8 [ 2548.270057][ T7373] process_one_work+0x1a8/0x3b8 [ 2548.270071][ T7373] worker_thread+0x25c/0x430 [ 2548.270083][ T7373] kthread+0xec/0x1b8 [ 2548.270101][ T7373] ret_from_fork+0x10/0x20 [ 2548.270116][ T7373] ... Type: Fix Redmine ID: #526169 Associated modifications: N/A Test: N/A Signed-off-by: Zhibin Huang Change-Id: I2d3a3be7e4696ccb2773e66d11e25ce49191e952 --- drivers/misc/rk628/rk628_hdmirx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/misc/rk628/rk628_hdmirx.c b/drivers/misc/rk628/rk628_hdmirx.c index 777d3259d851..5a0faefd0977 100644 --- a/drivers/misc/rk628/rk628_hdmirx.c +++ b/drivers/misc/rk628/rk628_hdmirx.c @@ -363,7 +363,8 @@ static void rk628_hdmirx_delayed_work_audio(struct work_struct *work) } audio_state->pre_state = fifo_status; exit: - schedule_delayed_work(&hdmirx->delayed_work_audio, msecs_to_jiffies(delay)); + queue_delayed_work(system_freezable_wq, &hdmirx->delayed_work_audio, + msecs_to_jiffies(delay)); } static void rk628_hdmirx_audio_setup(struct rk628 *rk628) @@ -417,7 +418,8 @@ static void rk628_hdmirx_audio_setup(struct rk628 *rk628) rk628_i2c_write(rk628, HDMI_RX_AUD_CHEXTR_CTRL, AUD_LAYOUT_CTRL(1)); /* audio detect */ rk628_i2c_write(rk628, HDMI_RX_PDEC_AUDIODET_CTRL, AUDIODET_THRESHOLD(0)); - schedule_delayed_work(&hdmirx->delayed_work_audio, msecs_to_jiffies(1000)); + queue_delayed_work(system_freezable_wq, &hdmirx->delayed_work_audio, + msecs_to_jiffies(1000)); } static void rk628_hdmirx_ctrl_enable(struct rk628 *rk628) From 847bf612e00e7b62029cc9bb39ce966c3b1ffa0b Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 10:42:10 +0800 Subject: [PATCH 03/35] scsi: ufs: rockchip: Fix typos in Rockchip copyright notices There are many cases in which the company name is misspelled. The patch fixes these typos. Signed-off-by: Tao Huang Change-Id: Ibdb599ef5f0f66cc0d910ddeca873d41e46ed3bc --- drivers/ufs/host/ufs-rockchip.c | 2 +- drivers/ufs/host/ufs-rockchip.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ufs/host/ufs-rockchip.c b/drivers/ufs/host/ufs-rockchip.c index 4b0fd9726522..79d3bdb6ae9e 100644 --- a/drivers/ufs/host/ufs-rockchip.c +++ b/drivers/ufs/host/ufs-rockchip.c @@ -2,7 +2,7 @@ /* * Rockchip UFS Host Controller driver * - * Copyright (C) 2024 Rockchip Electronics Co.Ltd. + * Copyright (C) 2024 Rockchip Electronics Co., Ltd. */ #include diff --git a/drivers/ufs/host/ufs-rockchip.h b/drivers/ufs/host/ufs-rockchip.h index 7f3c2602f37c..fab75da8a101 100644 --- a/drivers/ufs/host/ufs-rockchip.h +++ b/drivers/ufs/host/ufs-rockchip.h @@ -2,7 +2,7 @@ /* * Rockchip UFS Host Controller driver * - * Copyright (C) 2024 Rockchip Electronics Co.Ltd. + * Copyright (C) 2024 Rockchip Electronics Co., Ltd. */ #ifndef _UFS_ROCKCHIP_H_ From 9d7e3d15b97997037031c841e6fb74e918726bc9 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 10:44:56 +0800 Subject: [PATCH 04/35] rpmsg: rockchip: Fix typos in Rockchip copyright notices Signed-off-by: Tao Huang Change-Id: I998b95a178aae548cf627e094bf8baa52249c9b3 --- drivers/rpmsg/rockchip_rpmsg_mbox.c | 2 +- drivers/rpmsg/rockchip_rpmsg_softirq.c | 2 +- drivers/rpmsg/rockchip_rpmsg_test.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/rpmsg/rockchip_rpmsg_mbox.c b/drivers/rpmsg/rockchip_rpmsg_mbox.c index 6362d5eb49f1..4bb2920a3cb9 100644 --- a/drivers/rpmsg/rockchip_rpmsg_mbox.c +++ b/drivers/rpmsg/rockchip_rpmsg_mbox.c @@ -2,7 +2,7 @@ /* * Rockchip Remote Processors Messaging Platform Support. * - * Copyright (c) 2022 Rockchip Electronics Co. Ltd. + * Copyright (c) 2022 Rockchip Electronics Co., Ltd. * Author: Steven Liu */ diff --git a/drivers/rpmsg/rockchip_rpmsg_softirq.c b/drivers/rpmsg/rockchip_rpmsg_softirq.c index df3c77b25ffa..5c4c0bfae0f6 100644 --- a/drivers/rpmsg/rockchip_rpmsg_softirq.c +++ b/drivers/rpmsg/rockchip_rpmsg_softirq.c @@ -2,7 +2,7 @@ /* * Rockchip Remote Processors Messaging Platform Support. * - * Copyright (c) 2023 Rockchip Electronics Co. Ltd. + * Copyright (c) 2023 Rockchip Electronics Co., Ltd. * Author: Hongming Zou */ diff --git a/drivers/rpmsg/rockchip_rpmsg_test.c b/drivers/rpmsg/rockchip_rpmsg_test.c index 7f607bd296e0..e8d1a0878cd4 100644 --- a/drivers/rpmsg/rockchip_rpmsg_test.c +++ b/drivers/rpmsg/rockchip_rpmsg_test.c @@ -2,7 +2,7 @@ /* * Rockchip Remote Processors Messaging Test. * - * Copyright (c) 2022 Rockchip Electronics Co. Ltd. + * Copyright (c) 2022 Rockchip Electronics Co., Ltd. * Author: Hongming Zou */ From 66ba7d48d87badf5e91fe6f486bc905ce38c70a9 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 10:46:51 +0800 Subject: [PATCH 05/35] soc: rockchip: power-domain: Fix typo in Rockchip copyright notice Signed-off-by: Tao Huang Change-Id: I3dce33c4e226d68bdf0566d63dcfd008c238c5e4 --- drivers/soc/rockchip/pm_domains.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c index 0d8a47b385d3..435102ba6740 100644 --- a/drivers/soc/rockchip/pm_domains.c +++ b/drivers/soc/rockchip/pm_domains.c @@ -2,7 +2,7 @@ /* * Rockchip Generic power domain support. * - * Copyright (c) 2015 ROCKCHIP, Co. Ltd. + * Copyright (c) 2015 Rockchip Electronics Co., Ltd. */ #include From e51e8b7ffa8d818e95a015fea1ac6d5779ef2e08 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 10:47:33 +0800 Subject: [PATCH 06/35] rtc: rockchip: Fix typo in Rockchip copyright notice Signed-off-by: Tao Huang Change-Id: I56a77a9b972b3701c833c76babc554ee792d1f2f --- drivers/rtc/rtc-rockchip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-rockchip.c b/drivers/rtc/rtc-rockchip.c index 14861b215940..5210ee41154b 100644 --- a/drivers/rtc/rtc-rockchip.c +++ b/drivers/rtc/rtc-rockchip.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Copyright (c) 2022 Rockchip Electronics Co., Ltd + * Copyright (c) 2022 Rockchip Electronics Co., Ltd. */ #include #include From 721045842750fa243224308c7bb461f7f3e8f604 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 10:48:00 +0800 Subject: [PATCH 07/35] rtc: rk630: Fix typo in Rockchip copyright notice Signed-off-by: Tao Huang Change-Id: I6a2b409cd432ba493bea69e760acfa39783ad670 --- drivers/rtc/rtc-rk630.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-rk630.c b/drivers/rtc/rtc-rk630.c index c9c08914c135..c931301a588d 100644 --- a/drivers/rtc/rtc-rk630.c +++ b/drivers/rtc/rtc-rk630.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Copyright (c) 2023 Rockchip Electronics Co., Ltd + * Copyright (c) 2023 Rockchip Electronics Co., Ltd. */ #include #include From f3bd9974c114f04df56ec39566eeb663f3d5db02 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 10:49:11 +0800 Subject: [PATCH 08/35] net: rfkill: Fix typos in Rockchip copyright notices There are many cases in which the company name is misspelled. The patch fixes these typos. Signed-off-by: Tao Huang Change-Id: I1b354ef90bd36bf277e87d965b45d3d42c77d05e --- net/rfkill/rfkill-bt.c | 2 +- net/rfkill/rfkill-wlan.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/rfkill/rfkill-bt.c b/net/rfkill/rfkill-bt.c index e76de540804c..95e56553e2b6 100644 --- a/net/rfkill/rfkill-bt.c +++ b/net/rfkill/rfkill-bt.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 ROCKCHIP, Inc. + * Copyright (C) 2012 Rockchip Electronics Co., Ltd. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and diff --git a/net/rfkill/rfkill-wlan.c b/net/rfkill/rfkill-wlan.c index 7cd3b242211c..6e0f162712e1 100644 --- a/net/rfkill/rfkill-wlan.c +++ b/net/rfkill/rfkill-wlan.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 ROCKCHIP, Inc. + * Copyright (C) 2012 Rockchip Electronics Co., Ltd. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and From d56da1e9df2db9353c60dfa6d7b7c1ef1b7b1819 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 10:51:25 +0800 Subject: [PATCH 09/35] phy: rockchip: inno-video: Fix typo in Rockchip copyright notice Signed-off-by: Tao Huang Change-Id: Icba2c9e138ff449ac97e8b7a358513aed5a76690 --- drivers/phy/rockchip/phy-rockchip-inno-video-phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-video-phy.c b/drivers/phy/rockchip/phy-rockchip-inno-video-phy.c index 22d26f1413d9..970d65fba385 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-video-phy.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-video-phy.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Copyright (c) 2018 Rockchip Electronics Co. Ltd. + * Copyright (c) 2018 Rockchip Electronics Co., Ltd. * * Author: Wyon Bi */ From 12cbd8db22bb8f664107a4c69de4ddfd8c148d72 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 10:56:13 +0800 Subject: [PATCH 10/35] tools: testing: selftests: rkpinctrl: Fix typo in Rockchip copyright notice Signed-off-by: Tao Huang Change-Id: Ie8d419ab8a770b5dabda7538c8f8725d7a650522 --- tools/testing/selftests/rkpinctrl/iomux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/rkpinctrl/iomux.c b/tools/testing/selftests/rkpinctrl/iomux.c index 6d829c36bc30..f17443b5a26c 100644 --- a/tools/testing/selftests/rkpinctrl/iomux.c +++ b/tools/testing/selftests/rkpinctrl/iomux.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Copyright (c) 2022 Rockchip Electronics Co. Ltd. + * Copyright (c) 2022 Rockchip Electronics Co., Ltd. */ #include From 819625f764e1a54225cabb4661a981b7f0ce7a83 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 10:56:50 +0800 Subject: [PATCH 11/35] rk: mkkrnlimg: Fix typo in Rockchip copyright notice Signed-off-by: Tao Huang Change-Id: I26f965746bf16f8c429a39cdaa94f4e1df7be5db --- scripts/mkkrnlimg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mkkrnlimg.c b/scripts/mkkrnlimg.c index a39d1a15fa1e..8ffe79fed410 100644 --- a/scripts/mkkrnlimg.c +++ b/scripts/mkkrnlimg.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * (C) Copyright Fuzhou Rockchip Electronics Co., Ltd + * (C) Copyright Rockchip Electronics Co., Ltd. */ #include From ef353b603dcf77bc943cbf89dd013aff16062538 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 10:57:49 +0800 Subject: [PATCH 12/35] mm: cma_debug_bitmap_hex: Fix typo in Rockchip copyright notice Signed-off-by: Tao Huang Change-Id: I8f8754dbb3aeff24fb35a616629bbb89f48fd9a8 --- mm/cma_debug_bitmap_hex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/cma_debug_bitmap_hex.c b/mm/cma_debug_bitmap_hex.c index bf9f7db28a14..9d8dbd5c5d3f 100644 --- a/mm/cma_debug_bitmap_hex.c +++ b/mm/cma_debug_bitmap_hex.c @@ -4,7 +4,7 @@ * * Copyright (c) 2015 Sasha Levin * - * Copyright (C) 2022 Rockchip Electronics Co. Ltd. + * Copyright (C) 2022 Rockchip Electronics Co., Ltd. * */ From 5590fba8e0c39e87a3682cea8c6cb7052d1ab2cd Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 11:09:05 +0800 Subject: [PATCH 13/35] ASoC: rockchip: spdif: Fix typo in Rockchip copyright notice Signed-off-by: Tao Huang Change-Id: Ia45da7f0a1da4c91e471bdd8bcb6932edfc1ef44 --- sound/soc/rockchip/rockchip_spdif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/rockchip/rockchip_spdif.c b/sound/soc/rockchip/rockchip_spdif.c index 7977887d6f5f..f7191cc7ca5d 100644 --- a/sound/soc/rockchip/rockchip_spdif.c +++ b/sound/soc/rockchip/rockchip_spdif.c @@ -3,7 +3,7 @@ * * ALSA SoC Audio Layer - Rockchip I2S Controller driver * - * Copyright (c) 2014 Rockchip Electronics Co. Ltd. + * Copyright (c) 2014 Rockchip Electronics Co., Ltd. * Author: Jianqun * Copyright (c) 2015 Collabora Ltd. * Author: Sjoerd Simons From f6db37909400bef80f2857f415cc84f198a94032 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 11:09:57 +0800 Subject: [PATCH 14/35] ASoC: rockchip: rockchip_rt5645: Fix typo in Rockchip copyright notice Signed-off-by: Tao Huang Change-Id: Ic237c7b1fa97a4e8ae244abfc997c18f38be2a6d --- sound/soc/rockchip/rockchip_rt5645.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/rockchip/rockchip_rt5645.c b/sound/soc/rockchip/rockchip_rt5645.c index d07cc5c813f2..7638f2c8932a 100644 --- a/sound/soc/rockchip/rockchip_rt5645.c +++ b/sound/soc/rockchip/rockchip_rt5645.c @@ -2,7 +2,7 @@ /* * Rockchip machine ASoC driver for boards using a RT5645/RT5650 CODEC. * - * Copyright (c) 2015, ROCKCHIP CORPORATION. All rights reserved. + * Copyright (c) 2015, Rockchip Electronics Co., Ltd. All rights reserved. */ #include From e11ddc23bb4b7da2ac440b30246e45e10912d339 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 11:10:19 +0800 Subject: [PATCH 15/35] ASoC: rockchip: rockchip_max98090: Fix typo in Rockchip copyright notice Signed-off-by: Tao Huang Change-Id: I25fe4a425e3f188af34c62daf7fc0c62941b2f2a --- sound/soc/rockchip/rockchip_max98090.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/rockchip/rockchip_max98090.c b/sound/soc/rockchip/rockchip_max98090.c index 150ac524a590..a806da654949 100644 --- a/sound/soc/rockchip/rockchip_max98090.c +++ b/sound/soc/rockchip/rockchip_max98090.c @@ -2,7 +2,7 @@ /* * Rockchip machine ASoC driver for boards using a MAX90809 CODEC. * - * Copyright (c) 2014, ROCKCHIP CORPORATION. All rights reserved. + * Copyright (c) 2014, Rockchip Electronics Co., Ltd. All rights reserved. */ #include From 5c97584fe0803c9a61c4843e4b962a5e5adb03a1 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 11:10:43 +0800 Subject: [PATCH 16/35] ASoC: rockchip: i2s-tdm: Fix typos in Rockchip copyright notices There are many cases in which the company name is misspelled. The patch fixes these typos. Signed-off-by: Tao Huang Change-Id: I4b2fde05b5b3502dec4689395a78555226252652 --- sound/soc/rockchip/rockchip_i2s_tdm.c | 2 +- sound/soc/rockchip/rockchip_i2s_tdm.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.c b/sound/soc/rockchip/rockchip_i2s_tdm.c index 260195072ba3..ce832212b0be 100644 --- a/sound/soc/rockchip/rockchip_i2s_tdm.c +++ b/sound/soc/rockchip/rockchip_i2s_tdm.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only // ALSA SoC Audio Layer - Rockchip I2S/TDM Controller driver -// Copyright (c) 2018 Rockchip Electronics Co. Ltd. +// Copyright (c) 2018 Rockchip Electronics Co., Ltd. // Author: Sugar Zhang // Author: Nicolas Frattaroli diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.h b/sound/soc/rockchip/rockchip_i2s_tdm.h index 0f9ee806b4b9..404a89083b28 100644 --- a/sound/soc/rockchip/rockchip_i2s_tdm.h +++ b/sound/soc/rockchip/rockchip_i2s_tdm.h @@ -2,7 +2,7 @@ /* * ALSA SoC Audio Layer - Rockchip I2S/TDM Controller driver * - * Copyright (c) 2018 Rockchip Electronics Co. Ltd. + * Copyright (c) 2018 Rockchip Electronics Co., Ltd. * Author: Sugar Zhang * */ From aca417b416785f622417970b5cde095e66fb7280 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 11:13:01 +0800 Subject: [PATCH 17/35] ASoC: rockchip: i2s: Fix typos in Rockchip copyright notices There are many cases in which the company name is misspelled. The patch fixes these typos. Signed-off-by: Tao Huang Change-Id: I7e41a2271345ce285b755f5b1c959f033e93c29c --- sound/soc/rockchip/rockchip_i2s.c | 2 +- sound/soc/rockchip/rockchip_i2s.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c index c7ec42d74880..a3f3a158d3d5 100644 --- a/sound/soc/rockchip/rockchip_i2s.c +++ b/sound/soc/rockchip/rockchip_i2s.c @@ -3,7 +3,7 @@ * * ALSA SoC Audio Layer - Rockchip I2S Controller driver * - * Copyright (c) 2014 Rockchip Electronics Co. Ltd. + * Copyright (c) 2014 Rockchip Electronics Co., Ltd. * Author: Jianqun */ diff --git a/sound/soc/rockchip/rockchip_i2s.h b/sound/soc/rockchip/rockchip_i2s.h index 748cf7bf68ad..a9f0c536a8fb 100644 --- a/sound/soc/rockchip/rockchip_i2s.h +++ b/sound/soc/rockchip/rockchip_i2s.h @@ -4,7 +4,7 @@ * * ALSA SoC Audio Layer - Rockchip I2S Controller driver * - * Copyright (c) 2014 Rockchip Electronics Co. Ltd. + * Copyright (c) 2014 Rockchip Electronics Co., Ltd. * Author: Jianqun xu */ From af300ad9418148a83ea566b384534e3a6eeaef08 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 11:13:42 +0800 Subject: [PATCH 18/35] ASoC: rockchip: rk3399_gru_sound: Fix typo in Rockchip copyright notice Signed-off-by: Tao Huang Change-Id: I818dad170f76698444754bfe64d0dd5fb07eea57 --- sound/soc/rockchip/rk3399_gru_sound.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/rockchip/rk3399_gru_sound.c b/sound/soc/rockchip/rk3399_gru_sound.c index 2540b9ba37c8..b0e0900670d3 100644 --- a/sound/soc/rockchip/rk3399_gru_sound.c +++ b/sound/soc/rockchip/rk3399_gru_sound.c @@ -2,7 +2,7 @@ /* * Rockchip machine ASoC driver for boards using MAX98357A/RT5514/DA7219 * - * Copyright (c) 2016, ROCKCHIP CORPORATION. All rights reserved. + * Copyright (c) 2016, Rockchip Electronics Co., Ltd. All rights reserved. */ #include From c506bab7ff889d153817d8990948fa12b712ea4b Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 11:17:45 +0800 Subject: [PATCH 19/35] nvmem: rockchip-secure-otp: Fix typos in Rockchip copyright notices There are many cases in which the company name is misspelled. The patch fixes these typos. Signed-off-by: Tao Huang Change-Id: I8968fdbbbb6db89dbd94ce547b9dc5d37e928d6d --- drivers/nvmem/rockchip-secure-otp.c | 2 +- include/linux/rockchip/nvmem.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/nvmem/rockchip-secure-otp.c b/drivers/nvmem/rockchip-secure-otp.c index d71be3a95834..e8df65c3736b 100644 --- a/drivers/nvmem/rockchip-secure-otp.c +++ b/drivers/nvmem/rockchip-secure-otp.c @@ -2,7 +2,7 @@ /* * Rockchip Secure OTP Driver * - * Copyright (c) 2023 Rockchip Electronics Co. Ltd. + * Copyright (c) 2023 Rockchip Electronics Co., Ltd. * Author: Hisping */ diff --git a/include/linux/rockchip/nvmem.h b/include/linux/rockchip/nvmem.h index 741887856e33..bda7c9b82caa 100644 --- a/include/linux/rockchip/nvmem.h +++ b/include/linux/rockchip/nvmem.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2023 Rockchip Electronics Co. Ltd. + * Copyright (c) 2023 Rockchip Electronics Co., Ltd. * Author: Hisping */ #ifndef __ROCKCHIP_NVMEM_H From 2b6ff0a3483738d27555233c7705bd22b398835b Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 11:19:27 +0800 Subject: [PATCH 20/35] nvmem: rockchip-efuse: Fix typo in Rockchip copyright notice Signed-off-by: Tao Huang Change-Id: I69341134fa72ce50eb887c86dbeb4069c78397a7 --- drivers/nvmem/rockchip-efuse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvmem/rockchip-efuse.c b/drivers/nvmem/rockchip-efuse.c index f8901837698a..937034e3f019 100644 --- a/drivers/nvmem/rockchip-efuse.c +++ b/drivers/nvmem/rockchip-efuse.c @@ -2,7 +2,7 @@ /* * Rockchip eFuse Driver * - * Copyright (c) 2015 Rockchip Electronics Co. Ltd. + * Copyright (c) 2015 Rockchip Electronics Co., Ltd. * Author: Caesar Wang */ From fc99a30371953e81d24fd9b045c2b06f1297ce67 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 11:19:41 +0800 Subject: [PATCH 21/35] nvmem: rockchip-otp: Fix typo in Rockchip copyright notice Signed-off-by: Tao Huang Change-Id: I9f037b87411cf11dd1f18333dbedb5a93ef7a15f --- drivers/nvmem/rockchip-otp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvmem/rockchip-otp.c b/drivers/nvmem/rockchip-otp.c index 981b78418453..cbdfffe12d61 100644 --- a/drivers/nvmem/rockchip-otp.c +++ b/drivers/nvmem/rockchip-otp.c @@ -2,7 +2,7 @@ /* * Rockchip OTP Driver * - * Copyright (c) 2018 Rockchip Electronics Co. Ltd. + * Copyright (c) 2018 Rockchip Electronics Co., Ltd. * Author: Finley Xiao */ From da6a13140bc07b219c3058b780334567777d41d3 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 11:21:45 +0800 Subject: [PATCH 22/35] PCI: rockchip: Fix typos in Rockchip copyright notices There are many cases in which the company name is misspelled. The patch fixes these typos. Signed-off-by: Tao Huang Change-Id: I44290a23559d0fb3c9c8154c635e2d974245bfd2 --- drivers/pci/controller/pcie-rockchip-ep.c | 2 +- drivers/pci/controller/pcie-rockchip-host.c | 2 +- drivers/pci/controller/pcie-rockchip.c | 2 +- drivers/pci/controller/pcie-rockchip.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pcie-rockchip-ep.c b/drivers/pci/controller/pcie-rockchip-ep.c index 1e3c3192d122..ab9d62d14ae9 100644 --- a/drivers/pci/controller/pcie-rockchip-ep.c +++ b/drivers/pci/controller/pcie-rockchip-ep.c @@ -2,7 +2,7 @@ /* * Rockchip AXI PCIe endpoint controller driver * - * Copyright (c) 2018 Rockchip, Inc. + * Copyright (c) 2018 Rockchip Electronics Co., Ltd. * * Author: Shawn Lin * Simon Xue diff --git a/drivers/pci/controller/pcie-rockchip-host.c b/drivers/pci/controller/pcie-rockchip-host.c index 3f3faefc2a5a..393a47659053 100644 --- a/drivers/pci/controller/pcie-rockchip-host.c +++ b/drivers/pci/controller/pcie-rockchip-host.c @@ -2,7 +2,7 @@ /* * Rockchip AXI PCIe host controller driver * - * Copyright (c) 2016 Rockchip, Inc. + * Copyright (c) 2016 Rockchip Electronics Co., Ltd. * * Author: Shawn Lin * Wenrui Li diff --git a/drivers/pci/controller/pcie-rockchip.c b/drivers/pci/controller/pcie-rockchip.c index 49b2b16bee34..f602a06938f7 100644 --- a/drivers/pci/controller/pcie-rockchip.c +++ b/drivers/pci/controller/pcie-rockchip.c @@ -2,7 +2,7 @@ /* * Rockchip AXI PCIe host controller driver * - * Copyright (c) 2016 Rockchip, Inc. + * Copyright (c) 2016 Rockchip Electronics Co., Ltd. * * Author: Shawn Lin * Wenrui Li diff --git a/drivers/pci/controller/pcie-rockchip.h b/drivers/pci/controller/pcie-rockchip.h index 0a775f0aefbf..2370186d1530 100644 --- a/drivers/pci/controller/pcie-rockchip.h +++ b/drivers/pci/controller/pcie-rockchip.h @@ -2,7 +2,7 @@ /* * Rockchip AXI PCIe controller driver * - * Copyright (c) 2018 Rockchip, Inc. + * Copyright (c) 2018 Rockchip Electronics Co., Ltd. * * Author: Shawn Lin * From 7705538e331ff59b6a88ee41ae7877ec7c381800 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 11:26:45 +0800 Subject: [PATCH 23/35] phy: rockchip: phy-rockchip-dp: Fix typo in Rockchip copyright notice Signed-off-by: Tao Huang Change-Id: Ia834288dccf152164bd28c7f09c3b3bf894cb1b2 --- drivers/phy/rockchip/phy-rockchip-dp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/rockchip/phy-rockchip-dp.c b/drivers/phy/rockchip/phy-rockchip-dp.c index 592aa956eead..e493e2401eba 100644 --- a/drivers/phy/rockchip/phy-rockchip-dp.c +++ b/drivers/phy/rockchip/phy-rockchip-dp.c @@ -2,7 +2,7 @@ /* * Rockchip DP PHY driver * - * Copyright (C) 2016 FuZhou Rockchip Co., Ltd. + * Copyright (C) 2016 Rockchip Electronics Co., Ltd. * Author: Yakir Yang */ From 87f1835d26d9caa6fe3ca49b427483d344d14ef5 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 11:26:55 +0800 Subject: [PATCH 24/35] phy: rockchip: phy-rockchip-emmc: Fix typo in Rockchip copyright notice Signed-off-by: Tao Huang Change-Id: I5bf8868490c39c63a54b72e3792b340b395b5b7f --- drivers/phy/rockchip/phy-rockchip-emmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/rockchip/phy-rockchip-emmc.c b/drivers/phy/rockchip/phy-rockchip-emmc.c index 20023f6eb994..5aca52c7a3ab 100644 --- a/drivers/phy/rockchip/phy-rockchip-emmc.c +++ b/drivers/phy/rockchip/phy-rockchip-emmc.c @@ -3,7 +3,7 @@ * Rockchip emmc PHY driver * * Copyright (C) 2016 Shawn Lin - * Copyright (C) 2016 ROCKCHIP, Inc. + * Copyright (C) 2016 Rockchip Electronics Co., Ltd. */ #include From 62787b3e701d8d97156befb0421349478a331879 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 11:27:10 +0800 Subject: [PATCH 25/35] phy: rockchip: phy-rockchip-inno-csidphy: Fix typo in Rockchip copyright notice Signed-off-by: Tao Huang Change-Id: I07ca57d935a38dab16df4c873b47df6b22230470 --- drivers/phy/rockchip/phy-rockchip-inno-csidphy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-csidphy.c b/drivers/phy/rockchip/phy-rockchip-inno-csidphy.c index 75f948bdea6a..29805489ad36 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-csidphy.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-csidphy.c @@ -2,7 +2,7 @@ /* * Rockchip MIPI RX Innosilicon DPHY driver * - * Copyright (C) 2021 Fuzhou Rockchip Electronics Co., Ltd. + * Copyright (C) 2021 Rockchip Electronics Co., Ltd. */ #include From 7630eeb0c56da89788f024c651868bc17a4bc451 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 11:27:26 +0800 Subject: [PATCH 26/35] phy: rockchip: phy-rockchip-inno-dsidphy: Fix typo in Rockchip copyright notice Signed-off-by: Tao Huang Change-Id: I2fc1a7091f07056a827476f7c702ba4a0101b088 --- drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c b/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c index 0932c20063df..18960a829ba5 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Copyright (c) 2018 Rockchip Electronics Co. Ltd. + * Copyright (c) 2018 Rockchip Electronics Co., Ltd. * * Author: Wyon Bi */ From f0dae7d050e463e451178e621414442c846fe84d Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 11:27:46 +0800 Subject: [PATCH 27/35] phy: rockchip: phy-rockchip-inno-hdmi: Fix typo in Rockchip copyright notice Signed-off-by: Tao Huang Change-Id: I8fe00a35344f6fca989f92cca3d9ad8e15ebb69d --- drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c b/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c index 2556caf475c0..986a15780313 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * Copyright (c) 2017 Rockchip Electronics Co. Ltd. + * Copyright (c) 2017 Rockchip Electronics Co., Ltd. * * Author: Zheng Yang * Heiko Stuebner From bbea500ea31365b2ebce6cf38af96cd4732469fe Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 11:28:12 +0800 Subject: [PATCH 28/35] phy: rockchip: phy-rockchip-pcie: Fix typo in Rockchip copyright notice Signed-off-by: Tao Huang Change-Id: I75a92c7a67c03810d77ace1b241112eecfa19aa0 --- drivers/phy/rockchip/phy-rockchip-pcie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/rockchip/phy-rockchip-pcie.c b/drivers/phy/rockchip/phy-rockchip-pcie.c index 2f47a3e7fd88..3bbf33a85f09 100644 --- a/drivers/phy/rockchip/phy-rockchip-pcie.c +++ b/drivers/phy/rockchip/phy-rockchip-pcie.c @@ -3,7 +3,7 @@ * Rockchip PCIe PHY driver * * Copyright (C) 2016 Shawn Lin - * Copyright (C) 2016 ROCKCHIP, Inc. + * Copyright (C) 2016 Rockchip Electronics Co., Ltd. */ #include From 03ef5cdb66c6ada200c8ed5294e3508a6b5d8255 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 11:28:38 +0800 Subject: [PATCH 29/35] phy: rockchip: phy-rockchip-samsung-hdptx: Fix typo in Rockchip copyright notice Signed-off-by: Tao Huang Change-Id: I324698116a3d6dd0662bf0db4b3e92a120999e09 --- drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c index 036e8ac657a5..68d8d6ac2ed3 100644 --- a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +++ b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c @@ -2,7 +2,7 @@ /* * Rockchip HDMI/DP Combo PHY with Samsung IP block * - * Copyright (c) 2021 Rockchip Electronics Co. Ltd. + * Copyright (c) 2021 Rockchip Electronics Co., Ltd. */ #include From c62cb5bbc2d291d9d012d9730f5930a9a25c3902 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 11:28:59 +0800 Subject: [PATCH 30/35] phy: rockchip: phy-rockchip-typec: Fix typo in Rockchip copyright notice Signed-off-by: Tao Huang Change-Id: I2b7b4d912fdea13ffb02ee37f9b6d135642691f7 --- drivers/phy/rockchip/phy-rockchip-typec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c index 98a272c7d931..f1f65086ce09 100644 --- a/drivers/phy/rockchip/phy-rockchip-typec.c +++ b/drivers/phy/rockchip/phy-rockchip-typec.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd + * Copyright (C) Rockchip Electronics Co., Ltd. * Author: Chris Zhong * Kever Yang * From c399ece89e5a87e8fb79dffc6573a87bc921d3be Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 11:29:13 +0800 Subject: [PATCH 31/35] phy: rockchip: phy-rockchip-usb: Fix typo in Rockchip copyright notice Signed-off-by: Tao Huang Change-Id: I1f71ca88cd968fac019ef4c68a1c5fc8aa3f1002 --- drivers/phy/rockchip/phy-rockchip-usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/rockchip/phy-rockchip-usb.c b/drivers/phy/rockchip/phy-rockchip-usb.c index a891018fe72e..902a8aeea9f4 100644 --- a/drivers/phy/rockchip/phy-rockchip-usb.c +++ b/drivers/phy/rockchip/phy-rockchip-usb.c @@ -3,7 +3,7 @@ * Rockchip usb PHY driver * * Copyright (C) 2014 Yunzhi Li - * Copyright (C) 2014 ROCKCHIP, Inc. + * Copyright (C) 2014 Rockchip Electronics Co., Ltd. */ #include From e6e1a2e414c9c26b1e53acfc1e3ac3e1792678f1 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 21 Jan 2025 11:29:29 +0800 Subject: [PATCH 32/35] phy: rockchip: phy-rockchip-usbdp: Fix typo in Rockchip copyright notice Signed-off-by: Tao Huang Change-Id: Icb10db3143a2920ee3356b6c8e7b6f80eb8a948b --- drivers/phy/rockchip/phy-rockchip-usbdp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/rockchip/phy-rockchip-usbdp.c b/drivers/phy/rockchip/phy-rockchip-usbdp.c index d5f8e18022d9..89ddc07c5b78 100644 --- a/drivers/phy/rockchip/phy-rockchip-usbdp.c +++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c @@ -2,7 +2,7 @@ /* * Rockchip USBDP Combo PHY with Samsung IP block driver * - * Copyright (C) 2021 Rockchip Electronics Co., Ltd + * Copyright (C) 2021 Rockchip Electronics Co., Ltd. */ #include From 7e090f70d03c6f03198b48e9ca7658710083ed87 Mon Sep 17 00:00:00 2001 From: Zhibin Huang Date: Tue, 7 Jan 2025 09:37:45 +0800 Subject: [PATCH 33/35] misc: rk628: dsi: fix timing configuration not working Type: Fix Redmine ID: #525257 Associated modifications: Icc494d1c4c345ca01c9636ad8a2b47e0d9351972 Test: N/A Signed-off-by: Zhibin Huang Change-Id: I018ee73c0a62a6a07b0943f5886a8d0c3f409a85 --- drivers/misc/rk628/rk628_dsi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/misc/rk628/rk628_dsi.c b/drivers/misc/rk628/rk628_dsi.c index a2755565ca57..3d0681855c37 100644 --- a/drivers/misc/rk628/rk628_dsi.c +++ b/drivers/misc/rk628/rk628_dsi.c @@ -984,6 +984,10 @@ static void mipi_dphy_set_timing(const struct rk628_dsi *dsi) }; unsigned int index; + // These ranges use the controller's internal automatically calculated timing. + if (dsi->lane_mbps < 800 || (dsi->lane_mbps >= 900 && dsi->lane_mbps < 1100)) + return; + if (dsi->lane_mbps < timing_table[0].min_lane_mbps) return; @@ -995,9 +999,6 @@ static void mipi_dphy_set_timing(const struct rk628_dsi *dsi) if (index == ARRAY_SIZE(timing_table)) --index; - if (dsi->lane_mbps < timing_table[index].max_lane_mbps) - return; - testif_set_timing(dsi, 0x60, 0x3f, timing_table[index].clk_lp); testif_set_timing(dsi, 0x61, 0x7f, timing_table[index].clk_hs_prepare); testif_set_timing(dsi, 0x62, 0x3f, timing_table[index].clk_hs_zero); From 09d4048078bf663e034634c67a234df4b3876738 Mon Sep 17 00:00:00 2001 From: XiaoTan Luo Date: Fri, 17 Sep 2021 10:35:22 +0800 Subject: [PATCH 34/35] drm: rockchip: rk618: add spdif for hdmi audio source Signed-off-by: XiaoTan Luo Change-Id: I15cac9c3ab92140983511a5ea0e333ef991ba1e1 --- drivers/gpu/drm/rockchip/rk618/rk618_hdmi.c | 31 +++++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rk618/rk618_hdmi.c b/drivers/gpu/drm/rockchip/rk618/rk618_hdmi.c index 512887f4b274..fd21102a4fc3 100644 --- a/drivers/gpu/drm/rockchip/rk618/rk618_hdmi.c +++ b/drivers/gpu/drm/rockchip/rk618/rk618_hdmi.c @@ -1133,8 +1133,9 @@ static const struct drm_bridge_funcs rk618_hdmi_bridge_funcs = { .disable = rk618_hdmi_bridge_disable, }; -static int -rk618_hdmi_audio_config_set(struct rk618_hdmi *hdmi, struct audio_info *audio) +static int rk618_hdmi_audio_config_set(struct rk618_hdmi *hdmi, + struct hdmi_codec_daifmt *daifmt, + struct audio_info *audio) { int rate, N, channel; @@ -1182,14 +1183,19 @@ rk618_hdmi_audio_config_set(struct rk618_hdmi *hdmi, struct audio_info *audio) return -ENOENT; } - /* set_audio source I2S */ - hdmi_writeb(hdmi, HDMI_AUDIO_CTRL1, 0x01); + if (daifmt->fmt == HDMI_SPDIF) { + /* set_audio source SPDIF */ + hdmi_writeb(hdmi, HDMI_AUDIO_CTRL1, 0x09); + } else { + /* set_audio source I2S */ + hdmi_writeb(hdmi, HDMI_AUDIO_CTRL1, 0x01); + } hdmi_writeb(hdmi, AUDIO_SAMPLE_RATE, rate); hdmi_writeb(hdmi, AUDIO_I2S_MODE, v_I2S_MODE(I2S_STANDARD) | v_I2S_CHANNEL(channel)); hdmi_writeb(hdmi, AUDIO_I2S_MAP, 0x00); - hdmi_writeb(hdmi, AUDIO_I2S_SWAPS_SPDIF, 0); + hdmi_writeb(hdmi, AUDIO_I2S_SWAPS_SPDIF, rate); /* Set N value */ hdmi_writeb(hdmi, AUDIO_N_H, (N >> 16) & 0x0F); @@ -1224,12 +1230,14 @@ static int rk618_hdmi_audio_hw_params(struct device *dev, void *d, switch (daifmt->fmt) { case HDMI_I2S: break; + case HDMI_SPDIF: + break; default: dev_err(dev, "%s: Invalid format %d\n", __func__, daifmt->fmt); return -EINVAL; } - return rk618_hdmi_audio_config_set(hdmi, &audio); + return rk618_hdmi_audio_config_set(hdmi, daifmt, &audio); } static void rk618_hdmi_audio_shutdown(struct device *dev, void *d) @@ -1289,12 +1297,23 @@ static const struct hdmi_codec_ops audio_codec_ops = { static int rk618_hdmi_audio_codec_init(struct rk618_hdmi *hdmi, struct device *dev) { + const char *str = "i2s"; + struct device_node *np = dev->of_node; struct hdmi_codec_pdata codec_data = { .i2s = 1, + .spdif = 0, .ops = &audio_codec_ops, .max_i2s_channels = 8, }; + if (of_property_read_string(np, "rockchip,format", &str)) + dev_warn(dev, "can not get rockchip,format\n"); + + if (strstr(str, "spdif")) { + codec_data.i2s = 0; + codec_data.spdif = 1; + } + hdmi->audio_enable = false; hdmi->audio_pdev = platform_device_register_data(dev, HDMI_CODEC_DRV_NAME, PLATFORM_DEVID_NONE, From c1862eb07d904923cfbff4b91f51005e3195c4f4 Mon Sep 17 00:00:00 2001 From: XiaoTan Luo Date: Fri, 17 Sep 2021 11:03:49 +0800 Subject: [PATCH 35/35] drm: rockchip: rk618: update hdmi connect status to jack Signed-off-by: XiaoTan Luo Change-Id: I39588e906e047b9e59a60f3dd7dedf729a3a35f8 --- drivers/gpu/drm/rockchip/rk618/rk618_hdmi.c | 44 ++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/rk618/rk618_hdmi.c b/drivers/gpu/drm/rockchip/rk618/rk618_hdmi.c index fd21102a4fc3..ca75ce2ca577 100644 --- a/drivers/gpu/drm/rockchip/rk618/rk618_hdmi.c +++ b/drivers/gpu/drm/rockchip/rk618/rk618_hdmi.c @@ -440,6 +440,9 @@ struct rk618_hdmi { struct switch_dev switchdev; #endif struct rockchip_drm_sub_dev sub_dev; + hdmi_codec_plugged_cb plugged_cb; + struct device *codec_dev; + enum drm_connector_status last_connector_result; }; enum { @@ -545,6 +548,26 @@ static inline void hdmi_writeb(struct rk618_hdmi *hdmi, u16 offset, u32 val) regmap_write(hdmi->regmap, (RK618_HDMI_BASE + ((offset) << 2)), val); } +static void handle_plugged_change(struct rk618_hdmi *hdmi, bool plugged) +{ + if (hdmi->plugged_cb && hdmi->codec_dev) + hdmi->plugged_cb(hdmi->codec_dev, plugged); +} + +static int rk618_hdmi_set_plugged_cb(struct rk618_hdmi *hdmi, + hdmi_codec_plugged_cb fn, + struct device *codec_dev) +{ + bool plugged; + + hdmi->plugged_cb = fn; + hdmi->codec_dev = codec_dev; + plugged = hdmi->last_connector_result == connector_status_connected; + handle_plugged_change(hdmi, plugged); + + return 0; +} + static void rk618_hdmi_set_polarity(struct rk618_hdmi *hdmi, int vic) { u32 val, mask = HDMI_HSYNC_POL_INV | HDMI_VSYNC_POL_INV; @@ -946,14 +969,23 @@ rk618_hdmi_connector_detect(struct drm_connector *connector, bool force) { struct rk618_hdmi *hdmi = connector_to_hdmi(connector); bool status; + enum drm_connector_status result; status = rk618_hdmi_hpd_detect(hdmi); #ifdef CONFIG_SWITCH switch_set_state(&hdmi->switchdev, status); #endif - return status ? connector_status_connected : + result = status ? connector_status_connected : connector_status_disconnected; + if (result != hdmi->last_connector_result) { + dev_dbg(hdmi->dev, "rk618_hdmi read_hpd result: %d", result); + handle_plugged_change(hdmi, + result == connector_status_connected); + hdmi->last_connector_result = result; + } + + return result; } static int rk618_hdmi_connector_get_modes(struct drm_connector *connector) @@ -1287,11 +1319,21 @@ static int rk618_hdmi_audio_get_eld(struct device *dev, void *d, return ret; } +static int rk618_hdmi_hook_plugged_cb(struct device *dev, void *data, + hdmi_codec_plugged_cb fn, + struct device *codec_dev) +{ + struct rk618_hdmi *hdmi = dev_get_drvdata(dev); + + return rk618_hdmi_set_plugged_cb(hdmi, fn, codec_dev); +} + static const struct hdmi_codec_ops audio_codec_ops = { .hw_params = rk618_hdmi_audio_hw_params, .audio_shutdown = rk618_hdmi_audio_shutdown, .mute_stream = rk618_hdmi_audio_mute_stream, .get_eld = rk618_hdmi_audio_get_eld, + .hook_plugged_cb = rk618_hdmi_hook_plugged_cb, }; static int rk618_hdmi_audio_codec_init(struct rk618_hdmi *hdmi,