From 2168b49a22d8fb2e745a72d5fb47adfbc4a64234 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Sat, 3 Oct 2015 16:46:31 +0530 Subject: drivers/video/fbdev/i740fb: remove unused variable The value of d_best is always 0 and never changes. Signed-off-by: Sudip Mukherjee Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/i740fb.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'drivers') diff --git a/drivers/video/fbdev/i740fb.c b/drivers/video/fbdev/i740fb.c index 452e1163ad02..cf5ccd0f2252 100644 --- a/drivers/video/fbdev/i740fb.c +++ b/drivers/video/fbdev/i740fb.c @@ -346,11 +346,10 @@ static void i740_calc_vclk(u32 freq, struct i740fb_par *par) const u32 err_target = freq / (1000 * I740_RFREQ / I740_FFIX); u32 err_best = 512 * I740_FFIX; u32 f_err, f_vco; - int m_best = 0, n_best = 0, p_best = 0, d_best = 0; + int m_best = 0, n_best = 0, p_best = 0; int m, n; p_best = min(15, ilog2(I740_MAX_VCO_FREQ / (freq / I740_RFREQ_FIX))); - d_best = 0; f_vco = (freq * (1 << p_best)) / I740_RFREQ_FIX; freq = freq / I740_RFREQ_FIX; @@ -363,7 +362,7 @@ static void i740_calc_vclk(u32 freq, struct i740fb_par *par) m = 3; { - u32 f_out = (((m * I740_REF_FREQ * (4 << 2 * d_best)) + u32 f_out = (((m * I740_REF_FREQ * 4) / n) + ((1 << p_best) / 2)) / (1 << p_best); f_err = (freq - f_out); @@ -386,8 +385,7 @@ static void i740_calc_vclk(u32 freq, struct i740fb_par *par) par->video_clk2_n = (n_best - 2) & 0xFF; par->video_clk2_mn_msbs = ((((n_best - 2) >> 4) & VCO_N_MSBS) | (((m_best - 2) >> 8) & VCO_M_MSBS)); - par->video_clk2_div_sel = - ((p_best << 4) | (d_best ? 4 : 0) | REF_DIV_1); + par->video_clk2_div_sel = ((p_best << 4) | REF_DIV_1); } static int i740fb_decode_var(const struct fb_var_screeninfo *var, -- cgit v1.2.3 From 814740e759afe908eb60fcd973cae014c778a641 Mon Sep 17 00:00:00 2001 From: Chen-Yu Tsai Date: Tue, 17 Nov 2015 12:31:03 +0800 Subject: simplefb: Claim and enable regulators This claims and enables regulators listed in the simple framebuffer dt node. This is needed so that regulators powering the display pipeline and external hardware, described in the device node and known by the kernel code, will remain properly enabled. Signed-off-by: Chen-Yu Tsai Acked-by: Mark Brown Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/simplefb.c | 120 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 119 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c index 52c5c7e63b52..48ccf6db62a2 100644 --- a/drivers/video/fbdev/simplefb.c +++ b/drivers/video/fbdev/simplefb.c @@ -28,7 +28,10 @@ #include #include #include +#include #include +#include +#include static struct fb_fix_screeninfo simplefb_fix = { .id = "simple", @@ -174,6 +177,10 @@ struct simplefb_par { int clk_count; struct clk **clks; #endif +#if defined CONFIG_OF && defined CONFIG_REGULATOR + u32 regulator_count; + struct regulator **regulators; +#endif }; #if defined CONFIG_OF && defined CONFIG_COMMON_CLK @@ -269,6 +276,110 @@ static int simplefb_clocks_init(struct simplefb_par *par, static void simplefb_clocks_destroy(struct simplefb_par *par) { } #endif +#if defined CONFIG_OF && defined CONFIG_REGULATOR + +#define SUPPLY_SUFFIX "-supply" + +/* + * Regulator handling code. + * + * Here we handle the num-supplies and vin*-supply properties of our + * "simple-framebuffer" dt node. This is necessary so that we can make sure + * that any regulators needed by the display hardware that the bootloader + * set up for us (and for which it provided a simplefb dt node), stay up, + * for the life of the simplefb driver. + * + * When the driver unloads, we cleanly disable, and then release the + * regulators. + * + * We only complain about errors here, no action is taken as the most likely + * error can only happen due to a mismatch between the bootloader which set + * up simplefb, and the regulator definitions in the device tree. Chances are + * that there are no adverse effects, and if there are, a clean teardown of + * the fb probe will not help us much either. So just complain and carry on, + * and hope that the user actually gets a working fb at the end of things. + */ +static int simplefb_regulators_init(struct simplefb_par *par, + struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + struct property *prop; + struct regulator *regulator; + const char *p; + int count = 0, i = 0, ret; + + if (dev_get_platdata(&pdev->dev) || !np) + return 0; + + /* Count the number of regulator supplies */ + for_each_property_of_node(np, prop) { + p = strstr(prop->name, SUPPLY_SUFFIX); + if (p && p != prop->name) + count++; + } + + if (!count) + return 0; + + par->regulators = devm_kcalloc(&pdev->dev, count, + sizeof(struct regulator *), GFP_KERNEL); + if (!par->regulators) + return -ENOMEM; + + /* Get all the regulators */ + for_each_property_of_node(np, prop) { + char name[32]; /* 32 is max size of property name */ + + p = strstr(prop->name, SUPPLY_SUFFIX); + if (!p || p == prop->name) + continue; + + strlcpy(name, prop->name, + strlen(prop->name) - strlen(SUPPLY_SUFFIX) + 1); + regulator = devm_regulator_get_optional(&pdev->dev, name); + if (IS_ERR(regulator)) { + if (PTR_ERR(regulator) == -EPROBE_DEFER) + return -EPROBE_DEFER; + dev_err(&pdev->dev, "regulator %s not found: %ld\n", + name, PTR_ERR(regulator)); + continue; + } + par->regulators[i++] = regulator; + } + par->regulator_count = i; + + /* Enable all the regulators */ + for (i = 0; i < par->regulator_count; i++) { + ret = regulator_enable(par->regulators[i]); + if (ret) { + dev_err(&pdev->dev, + "failed to enable regulator %d: %d\n", + i, ret); + devm_regulator_put(par->regulators[i]); + par->regulators[i] = NULL; + } + } + + return 0; +} + +static void simplefb_regulators_destroy(struct simplefb_par *par) +{ + int i; + + if (!par->regulators) + return; + + for (i = 0; i < par->regulator_count; i++) + if (par->regulators[i]) + regulator_disable(par->regulators[i]); +} +#else +static int simplefb_regulators_init(struct simplefb_par *par, + struct platform_device *pdev) { return 0; } +static void simplefb_regulators_destroy(struct simplefb_par *par) { } +#endif + static int simplefb_probe(struct platform_device *pdev) { int ret; @@ -340,6 +451,10 @@ static int simplefb_probe(struct platform_device *pdev) if (ret < 0) goto error_unmap; + ret = simplefb_regulators_init(par, pdev); + if (ret < 0) + goto error_clocks; + dev_info(&pdev->dev, "framebuffer at 0x%lx, 0x%x bytes, mapped to 0x%p\n", info->fix.smem_start, info->fix.smem_len, info->screen_base); @@ -351,13 +466,15 @@ static int simplefb_probe(struct platform_device *pdev) ret = register_framebuffer(info); if (ret < 0) { dev_err(&pdev->dev, "Unable to register simplefb: %d\n", ret); - goto error_clocks; + goto error_regulators; } dev_info(&pdev->dev, "fb%d: simplefb registered!\n", info->node); return 0; +error_regulators: + simplefb_regulators_destroy(par); error_clocks: simplefb_clocks_destroy(par); error_unmap: @@ -373,6 +490,7 @@ static int simplefb_remove(struct platform_device *pdev) struct simplefb_par *par = info->par; unregister_framebuffer(info); + simplefb_regulators_destroy(par); simplefb_clocks_destroy(par); framebuffer_release(info); -- cgit v1.2.3 From 16379ad8552e183b4cf41a177ed2bad1e44d383d Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sun, 8 Nov 2015 22:34:53 +0100 Subject: video: constify geode ops structures These geode ops structures are never modified, so declare them as const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/geode/display_gx1.c | 2 +- drivers/video/fbdev/geode/display_gx1.h | 2 +- drivers/video/fbdev/geode/geodefb.h | 4 ++-- drivers/video/fbdev/geode/video_cs5530.c | 2 +- drivers/video/fbdev/geode/video_cs5530.h | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers') diff --git a/drivers/video/fbdev/geode/display_gx1.c b/drivers/video/fbdev/geode/display_gx1.c index 926d53eeb549..b383eb9882bf 100644 --- a/drivers/video/fbdev/geode/display_gx1.c +++ b/drivers/video/fbdev/geode/display_gx1.c @@ -208,7 +208,7 @@ static void gx1_set_hw_palette_reg(struct fb_info *info, unsigned regno, writel(val, par->dc_regs + DC_PAL_DATA); } -struct geode_dc_ops gx1_dc_ops = { +const struct geode_dc_ops gx1_dc_ops = { .set_mode = gx1_set_mode, .set_palette_reg = gx1_set_hw_palette_reg, }; diff --git a/drivers/video/fbdev/geode/display_gx1.h b/drivers/video/fbdev/geode/display_gx1.h index 671c05558c79..e1cc41b343ca 100644 --- a/drivers/video/fbdev/geode/display_gx1.h +++ b/drivers/video/fbdev/geode/display_gx1.h @@ -18,7 +18,7 @@ unsigned gx1_gx_base(void); int gx1_frame_buffer_size(void); -extern struct geode_dc_ops gx1_dc_ops; +extern const struct geode_dc_ops gx1_dc_ops; /* GX1 configuration I/O registers */ diff --git a/drivers/video/fbdev/geode/geodefb.h b/drivers/video/fbdev/geode/geodefb.h index ae04820e0c57..e2e07934868f 100644 --- a/drivers/video/fbdev/geode/geodefb.h +++ b/drivers/video/fbdev/geode/geodefb.h @@ -31,8 +31,8 @@ struct geodefb_par { int panel_y; void __iomem *dc_regs; void __iomem *vid_regs; - struct geode_dc_ops *dc_ops; - struct geode_vid_ops *vid_ops; + const struct geode_dc_ops *dc_ops; + const struct geode_vid_ops *vid_ops; }; #endif /* !__GEODEFB_H__ */ diff --git a/drivers/video/fbdev/geode/video_cs5530.c b/drivers/video/fbdev/geode/video_cs5530.c index 649c3943d431..880613200ecf 100644 --- a/drivers/video/fbdev/geode/video_cs5530.c +++ b/drivers/video/fbdev/geode/video_cs5530.c @@ -186,7 +186,7 @@ static int cs5530_blank_display(struct fb_info *info, int blank_mode) return 0; } -struct geode_vid_ops cs5530_vid_ops = { +const struct geode_vid_ops cs5530_vid_ops = { .set_dclk = cs5530_set_dclk_frequency, .configure_display = cs5530_configure_display, .blank_display = cs5530_blank_display, diff --git a/drivers/video/fbdev/geode/video_cs5530.h b/drivers/video/fbdev/geode/video_cs5530.h index 56cecca7f1ce..c843348bfa20 100644 --- a/drivers/video/fbdev/geode/video_cs5530.h +++ b/drivers/video/fbdev/geode/video_cs5530.h @@ -15,7 +15,7 @@ #ifndef __VIDEO_CS5530_H__ #define __VIDEO_CS5530_H__ -extern struct geode_vid_ops cs5530_vid_ops; +extern const struct geode_vid_ops cs5530_vid_ops; /* CS5530 Video device registers */ -- cgit v1.2.3 From 34280340b1dc74c521e636f45cd728f9abf56ee2 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Fri, 4 Dec 2015 17:01:43 +0100 Subject: fbdev: Remove unused SH-Mobile HDMI driver As of commit 44d88c754e57a6d9 ("ARM: shmobile: Remove legacy SoC code for R-Mobile A1"), the SH-Mobile HDMI driver is no longer used. In theory it could still be used on R-Mobile A1 SoCs, but that requires adding DT support to the driver, which is not planned. Remove the driver, it can be resurrected from git history when needed. Signed-off-by: Geert Uytterhoeven Acked-by: Simon Horman Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/Kconfig | 10 - drivers/video/fbdev/Makefile | 1 - drivers/video/fbdev/sh_mobile_hdmi.c | 1489 ---------------------------------- include/video/sh_mobile_hdmi.h | 49 -- 4 files changed, 1549 deletions(-) delete mode 100644 drivers/video/fbdev/sh_mobile_hdmi.c delete mode 100644 include/video/sh_mobile_hdmi.h (limited to 'drivers') diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index e6d16d65e4e6..9c5d884294ff 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -1990,16 +1990,6 @@ config FB_SH_MOBILE_LCDC ---help--- Frame buffer driver for the on-chip SH-Mobile LCD controller. -config FB_SH_MOBILE_HDMI - tristate "SuperH Mobile HDMI controller support" - depends on FB_SH_MOBILE_LCDC - select FB_MODE_HELPERS - select SOUND - select SND - select SND_SOC - ---help--- - Driver for the on-chip SH-Mobile HDMI controller. - config FB_TMIO tristate "Toshiba Mobile IO FrameBuffer support" depends on FB && (MFD_TMIO || COMPILE_TEST) diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile index 50ed1b4fc2bf..65fb15075c8f 100644 --- a/drivers/video/fbdev/Makefile +++ b/drivers/video/fbdev/Makefile @@ -118,7 +118,6 @@ obj-$(CONFIG_FB_UDL) += udlfb.o obj-$(CONFIG_FB_SMSCUFX) += smscufx.o obj-$(CONFIG_FB_XILINX) += xilinxfb.o obj-$(CONFIG_SH_MIPI_DSI) += sh_mipi_dsi.o -obj-$(CONFIG_FB_SH_MOBILE_HDMI) += sh_mobile_hdmi.o obj-$(CONFIG_FB_SH_MOBILE_MERAM) += sh_mobile_meram.o obj-$(CONFIG_FB_SH_MOBILE_LCDC) += sh_mobile_lcdcfb.o obj-$(CONFIG_FB_OMAP) += omap/ diff --git a/drivers/video/fbdev/sh_mobile_hdmi.c b/drivers/video/fbdev/sh_mobile_hdmi.c deleted file mode 100644 index 7c72a3f02056..000000000000 --- a/drivers/video/fbdev/sh_mobile_hdmi.c +++ /dev/null @@ -1,1489 +0,0 @@ -/* - * SH-Mobile High-Definition Multimedia Interface (HDMI) driver - * for SLISHDMI13T and SLIPHDMIT IP cores - * - * Copyright (C) 2010, Guennadi Liakhovetski - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include