.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * linux/drivers/video/omap2/dss/dispc.c |
---|
3 | 4 | * |
---|
.. | .. |
---|
6 | 7 | * |
---|
7 | 8 | * Some code and ideas taken from drivers/video/omap/ driver |
---|
8 | 9 | * by Imre Deak. |
---|
9 | | - * |
---|
10 | | - * This program is free software; you can redistribute it and/or modify it |
---|
11 | | - * under the terms of the GNU General Public License version 2 as published by |
---|
12 | | - * the Free Software Foundation. |
---|
13 | | - * |
---|
14 | | - * This program is distributed in the hope that it will be useful, but WITHOUT |
---|
15 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
16 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
---|
17 | | - * more details. |
---|
18 | | - * |
---|
19 | | - * You should have received a copy of the GNU General Public License along with |
---|
20 | | - * this program. If not, see <http://www.gnu.org/licenses/>. |
---|
21 | 10 | */ |
---|
22 | 11 | |
---|
23 | 12 | #define DSS_SUBSYS_NAME "DISPC" |
---|
.. | .. |
---|
571 | 560 | } |
---|
572 | 561 | EXPORT_SYMBOL(dispc_mgr_get_sync_lost_irq); |
---|
573 | 562 | |
---|
574 | | -u32 dispc_wb_get_framedone_irq(void) |
---|
575 | | -{ |
---|
576 | | - return DISPC_IRQ_FRAMEDONEWB; |
---|
577 | | -} |
---|
578 | | - |
---|
579 | 563 | bool dispc_mgr_go_busy(enum omap_channel channel) |
---|
580 | 564 | { |
---|
581 | 565 | return mgr_fld_read(channel, DISPC_MGR_FLD_GO) == 1; |
---|
.. | .. |
---|
592 | 576 | mgr_fld_write(channel, DISPC_MGR_FLD_GO, 1); |
---|
593 | 577 | } |
---|
594 | 578 | EXPORT_SYMBOL(dispc_mgr_go); |
---|
595 | | - |
---|
596 | | -bool dispc_wb_go_busy(void) |
---|
597 | | -{ |
---|
598 | | - return REG_GET(DISPC_CONTROL2, 6, 6) == 1; |
---|
599 | | -} |
---|
600 | | - |
---|
601 | | -void dispc_wb_go(void) |
---|
602 | | -{ |
---|
603 | | - enum omap_plane plane = OMAP_DSS_WB; |
---|
604 | | - bool enable, go; |
---|
605 | | - |
---|
606 | | - enable = REG_GET(DISPC_OVL_ATTRIBUTES(plane), 0, 0) == 1; |
---|
607 | | - |
---|
608 | | - if (!enable) |
---|
609 | | - return; |
---|
610 | | - |
---|
611 | | - go = REG_GET(DISPC_CONTROL2, 6, 6) == 1; |
---|
612 | | - if (go) { |
---|
613 | | - DSSERR("GO bit not down for WB\n"); |
---|
614 | | - return; |
---|
615 | | - } |
---|
616 | | - |
---|
617 | | - REG_FLD_MOD(DISPC_CONTROL2, 1, 6, 6); |
---|
618 | | -} |
---|
619 | 579 | |
---|
620 | 580 | static void dispc_ovl_write_firh_reg(enum omap_plane plane, int reg, u32 value) |
---|
621 | 581 | { |
---|
.. | .. |
---|
931 | 891 | static void dispc_ovl_configure_burst_type(enum omap_plane plane, |
---|
932 | 892 | enum omap_dss_rotation_type rotation_type) |
---|
933 | 893 | { |
---|
934 | | - if (dss_has_feature(FEAT_BURST_2D) == 0) |
---|
| 894 | + if (!dss_has_feature(FEAT_BURST_2D)) |
---|
935 | 895 | return; |
---|
936 | 896 | |
---|
937 | 897 | if (rotation_type == OMAP_DSS_ROT_TILER) |
---|
.. | .. |
---|
1040 | 1000 | case 3: |
---|
1041 | 1001 | return OMAP_DSS_CHANNEL_WB; |
---|
1042 | 1002 | } |
---|
1043 | | -} |
---|
1044 | | - |
---|
1045 | | -void dispc_wb_set_channel_in(enum dss_writeback_channel channel) |
---|
1046 | | -{ |
---|
1047 | | - enum omap_plane plane = OMAP_DSS_WB; |
---|
1048 | | - |
---|
1049 | | - REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), channel, 18, 16); |
---|
1050 | 1003 | } |
---|
1051 | 1004 | |
---|
1052 | 1005 | static void dispc_ovl_set_burst_size(enum omap_plane plane, |
---|
.. | .. |
---|
1649 | 1602 | { |
---|
1650 | 1603 | int scale_x = out_width != orig_width; |
---|
1651 | 1604 | int scale_y = out_height != orig_height; |
---|
1652 | | - bool chroma_upscale = plane != OMAP_DSS_WB ? true : false; |
---|
| 1605 | + bool chroma_upscale = plane != OMAP_DSS_WB; |
---|
1653 | 1606 | |
---|
1654 | 1607 | if (!dss_has_feature(FEAT_HANDLE_UV_SEPARATE)) |
---|
1655 | 1608 | return; |
---|
.. | .. |
---|
1908 | 1861 | if (color_mode == OMAP_DSS_COLOR_YUV2 || |
---|
1909 | 1862 | color_mode == OMAP_DSS_COLOR_UYVY) |
---|
1910 | 1863 | width = width >> 1; |
---|
1911 | | - /* fall through */ |
---|
| 1864 | + fallthrough; |
---|
1912 | 1865 | case OMAP_DSS_ROT_90: |
---|
1913 | 1866 | case OMAP_DSS_ROT_270: |
---|
1914 | 1867 | *offset1 = 0; |
---|
.. | .. |
---|
1931 | 1884 | if (color_mode == OMAP_DSS_COLOR_YUV2 || |
---|
1932 | 1885 | color_mode == OMAP_DSS_COLOR_UYVY) |
---|
1933 | 1886 | width = width >> 1; |
---|
1934 | | - /* fall through */ |
---|
| 1887 | + fallthrough; |
---|
1935 | 1888 | case OMAP_DSS_ROT_90 + 4: |
---|
1936 | 1889 | case OMAP_DSS_ROT_270 + 4: |
---|
1937 | 1890 | *offset1 = 0; |
---|
.. | .. |
---|
2819 | 2772 | } |
---|
2820 | 2773 | EXPORT_SYMBOL(dispc_ovl_setup); |
---|
2821 | 2774 | |
---|
2822 | | -int dispc_wb_setup(const struct omap_dss_writeback_info *wi, |
---|
2823 | | - bool mem_to_mem, const struct omap_video_timings *mgr_timings) |
---|
2824 | | -{ |
---|
2825 | | - int r; |
---|
2826 | | - u32 l; |
---|
2827 | | - enum omap_plane plane = OMAP_DSS_WB; |
---|
2828 | | - const int pos_x = 0, pos_y = 0; |
---|
2829 | | - const u8 zorder = 0, global_alpha = 0; |
---|
2830 | | - const bool replication = false; |
---|
2831 | | - bool truncation; |
---|
2832 | | - int in_width = mgr_timings->x_res; |
---|
2833 | | - int in_height = mgr_timings->y_res; |
---|
2834 | | - enum omap_overlay_caps caps = |
---|
2835 | | - OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA; |
---|
2836 | | - |
---|
2837 | | - DSSDBG("dispc_wb_setup, pa %x, pa_uv %x, %d,%d -> %dx%d, cmode %x, " |
---|
2838 | | - "rot %d, mir %d\n", wi->paddr, wi->p_uv_addr, in_width, |
---|
2839 | | - in_height, wi->width, wi->height, wi->color_mode, wi->rotation, |
---|
2840 | | - wi->mirror); |
---|
2841 | | - |
---|
2842 | | - r = dispc_ovl_setup_common(plane, caps, wi->paddr, wi->p_uv_addr, |
---|
2843 | | - wi->buf_width, pos_x, pos_y, in_width, in_height, wi->width, |
---|
2844 | | - wi->height, wi->color_mode, wi->rotation, wi->mirror, zorder, |
---|
2845 | | - wi->pre_mult_alpha, global_alpha, wi->rotation_type, |
---|
2846 | | - replication, mgr_timings, mem_to_mem); |
---|
2847 | | - |
---|
2848 | | - switch (wi->color_mode) { |
---|
2849 | | - case OMAP_DSS_COLOR_RGB16: |
---|
2850 | | - case OMAP_DSS_COLOR_RGB24P: |
---|
2851 | | - case OMAP_DSS_COLOR_ARGB16: |
---|
2852 | | - case OMAP_DSS_COLOR_RGBA16: |
---|
2853 | | - case OMAP_DSS_COLOR_RGB12U: |
---|
2854 | | - case OMAP_DSS_COLOR_ARGB16_1555: |
---|
2855 | | - case OMAP_DSS_COLOR_XRGB16_1555: |
---|
2856 | | - case OMAP_DSS_COLOR_RGBX16: |
---|
2857 | | - truncation = true; |
---|
2858 | | - break; |
---|
2859 | | - default: |
---|
2860 | | - truncation = false; |
---|
2861 | | - break; |
---|
2862 | | - } |
---|
2863 | | - |
---|
2864 | | - /* setup extra DISPC_WB_ATTRIBUTES */ |
---|
2865 | | - l = dispc_read_reg(DISPC_OVL_ATTRIBUTES(plane)); |
---|
2866 | | - l = FLD_MOD(l, truncation, 10, 10); /* TRUNCATIONENABLE */ |
---|
2867 | | - l = FLD_MOD(l, mem_to_mem, 19, 19); /* WRITEBACKMODE */ |
---|
2868 | | - if (mem_to_mem) |
---|
2869 | | - l = FLD_MOD(l, 1, 26, 24); /* CAPTUREMODE */ |
---|
2870 | | - else |
---|
2871 | | - l = FLD_MOD(l, 0, 26, 24); /* CAPTUREMODE */ |
---|
2872 | | - dispc_write_reg(DISPC_OVL_ATTRIBUTES(plane), l); |
---|
2873 | | - |
---|
2874 | | - if (mem_to_mem) { |
---|
2875 | | - /* WBDELAYCOUNT */ |
---|
2876 | | - REG_FLD_MOD(DISPC_OVL_ATTRIBUTES2(plane), 0, 7, 0); |
---|
2877 | | - } else { |
---|
2878 | | - int wbdelay; |
---|
2879 | | - |
---|
2880 | | - wbdelay = min(mgr_timings->vfp + mgr_timings->vsw + |
---|
2881 | | - mgr_timings->vbp, 255); |
---|
2882 | | - |
---|
2883 | | - /* WBDELAYCOUNT */ |
---|
2884 | | - REG_FLD_MOD(DISPC_OVL_ATTRIBUTES2(plane), wbdelay, 7, 0); |
---|
2885 | | - } |
---|
2886 | | - |
---|
2887 | | - return r; |
---|
2888 | | -} |
---|
2889 | | - |
---|
2890 | 2775 | int dispc_ovl_enable(enum omap_plane plane, bool enable) |
---|
2891 | 2776 | { |
---|
2892 | 2777 | DSSDBG("dispc_enable_plane %d, %d\n", plane, enable); |
---|
.. | .. |
---|
2916 | 2801 | return !!mgr_fld_read(channel, DISPC_MGR_FLD_ENABLE); |
---|
2917 | 2802 | } |
---|
2918 | 2803 | EXPORT_SYMBOL(dispc_mgr_is_enabled); |
---|
2919 | | - |
---|
2920 | | -void dispc_wb_enable(bool enable) |
---|
2921 | | -{ |
---|
2922 | | - dispc_ovl_enable(OMAP_DSS_WB, enable); |
---|
2923 | | -} |
---|
2924 | | - |
---|
2925 | | -bool dispc_wb_is_enabled(void) |
---|
2926 | | -{ |
---|
2927 | | - return dispc_ovl_enabled(OMAP_DSS_WB); |
---|
2928 | | -} |
---|
2929 | 2804 | |
---|
2930 | 2805 | static void dispc_lcd_enable_signal_polarity(bool act_high) |
---|
2931 | 2806 | { |
---|
.. | .. |
---|
3114 | 2989 | unsigned long pclk) |
---|
3115 | 2990 | { |
---|
3116 | 2991 | if (dss_mgr_is_lcd(channel)) |
---|
3117 | | - return pclk <= dispc.feat->max_lcd_pclk ? true : false; |
---|
| 2992 | + return pclk <= dispc.feat->max_lcd_pclk; |
---|
3118 | 2993 | else |
---|
3119 | | - return pclk <= dispc.feat->max_tv_pclk ? true : false; |
---|
| 2994 | + return pclk <= dispc.feat->max_tv_pclk; |
---|
3120 | 2995 | } |
---|
3121 | 2996 | |
---|
3122 | 2997 | bool dispc_mgr_timings_ok(enum omap_channel channel, |
---|