From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E682FC48BE5 for ; Fri, 11 Jun 2021 16:16:45 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 74F5561287 for ; Fri, 11 Jun 2021 16:16:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 74F5561287 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=in.bosch.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EA209828FB; Fri, 11 Jun 2021 18:15:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=in.bosch.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=in.bosch.com header.i=@in.bosch.com header.b="PE9e8rV8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 563B8828A4; Fri, 11 Jun 2021 18:14:57 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20610.outbound.protection.outlook.com [IPv6:2a01:111:f400:7d00::610]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 914FA828D0 for ; Fri, 11 Jun 2021 18:14:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=in.bosch.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=Gireesh.Hiremath@in.bosch.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FaB2n+kwar31gRgM0LaxSsnqjcc6hJR9616S02JfcjAawEXaLUhs8huqdANPvFnWYGA24BFklWcfAr68T+r0IOCKty5W/LFoZCzfNG3LgR0GK0KpIewkB8wVdCGiZ/7wGcJsWTN+OzP0tvi7/D+zEd1p9goMtMsT0nuJRAMseAFqGwHJOVsDFhWyDalGMiEmz2uUTSSC08dJ8mwKUJgA4GUCz29kl5rMXw210s3Bjh08C/gBFFd6c9h5lRXOyxDgC/9m+bGsOlaPNGznJJdUIkM5HG8BDw2jdwLbkRlr/H2f4AOL55okZTpXTQQDIUnrp1f2H3j2S5uu1dDT/2aGfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iipVa7b/Yd2kDsM91GwMXIjgd1VLk4QPJySMgT5WEdY=; b=TIBU941D3bAzWMaKL8B8sbeUh2T3xcc8ukbAXTtD7uqXwnxTTT95VHCzxnpz0IjHPA7RsVHpTKbFMf6QdoasOPOhu9yje0kd1/9TWsWa9IsGKA2YH5KFQfsHLXjxGcJ+myRcATa4fz1Hwp7dewEE+33s2Velqarolp/rnmmR9GHG9OqZ19Xf2y48BJmHaLDu5wAx5xGIKgEvkZdofT0oRvuAhSaGjx4tPMOIhjvrWlQeQNWuC5B5y9DQq53VjoRoUixjyH8ZwhuhyqvF9xuD1qhf6gHyNthTK79lPMev0n+Bt0JAvnnBrzVF5nVhUK0T3vsfKrgYCC5XTll95R+nsA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 139.15.153.199) smtp.rcpttodomain=lists.denx.de smtp.mailfrom=in.bosch.com; dmarc=pass (p=reject sp=none pct=100) action=none header.from=in.bosch.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=in.bosch.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iipVa7b/Yd2kDsM91GwMXIjgd1VLk4QPJySMgT5WEdY=; b=PE9e8rV8Q3qF5LTyvdNpqe7tG9hZQL5hP2kE4jXsuW5FXtzQ/8goU211J9M1TOUyYgodtswgbJ9lF5qpARYdMtA4elzLlEF0U2gy6pWRmUSx01UAqfQD2a6rRWlBKxPYFJkKqq9NR9PvuyoUsNPmYEfafYjNtQWaaCP/a70eJmU= Received: from AS8PR05CA0020.eurprd05.prod.outlook.com (2603:10a6:20b:311::25) by VI1PR10MB2477.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:87::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.22; Fri, 11 Jun 2021 16:14:52 +0000 Received: from VE1EUR03FT025.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:311:cafe::42) by AS8PR05CA0020.outlook.office365.com (2603:10a6:20b:311::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21 via Frontend Transport; Fri, 11 Jun 2021 16:14:52 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 139.15.153.199) smtp.mailfrom=in.bosch.com; lists.denx.de; dkim=none (message not signed) header.d=none; lists.denx.de; dmarc=pass action=none header.from=in.bosch.com; Received-SPF: Pass (protection.outlook.com: domain of in.bosch.com designates 139.15.153.199 as permitted sender) receiver=protection.outlook.com; client-ip=139.15.153.199; helo=eop.bosch-org.com; Received: from eop.bosch-org.com (139.15.153.199) by VE1EUR03FT025.mail.protection.outlook.com (10.152.18.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21 via Frontend Transport; Fri, 11 Jun 2021 16:14:52 +0000 Received: from FE-EXCAS2001.de.bosch.com (10.139.217.200) by eop.bosch-org.com (139.15.153.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2176.14; Fri, 11 Jun 2021 18:14:37 +0200 Received: from SI-HUB2000.de.bosch.com (10.4.103.108) by FE-EXCAS2001.de.bosch.com (10.139.217.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2176.14; Fri, 11 Jun 2021 18:14:37 +0200 Received: from localhost.localdomain (10.141.230.85) by SI-HUB2000.de.bosch.com (10.4.103.108) with Microsoft SMTP Server id 15.1.2176.14; Fri, 11 Jun 2021 18:14:34 +0200 From: To: , , CC: , , Subject: [PATCH v4 12/18] am335x, guardian: Enable backlight Date: Fri, 11 Jun 2021 16:13:44 +0000 Message-ID: <20210611161350.2141-13-Gireesh.Hiremath@in.bosch.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210611161350.2141-1-Gireesh.Hiremath@in.bosch.com> References: <20210611161350.2141-1-Gireesh.Hiremath@in.bosch.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.141.230.85] X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3b466641-13f3-42c3-c4c7-08d92cf40b3a X-MS-TrafficTypeDiagnostic: VI1PR10MB2477: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1265; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: U2tUczOMIymgBC3TGTUoHGbOX49hyPBrHE8R5hPUUFh/VxONwnBy0GLMR7pxJxAFkwmYYMbprlyEqnwsbKnLjdLMEaX0tgEu9OET9CSH8iaCh6o2UgifI/ej19E4THSKZ5Pjlgmj9kOAsGcTN9ZDRElXD5ZlbtcIGUXlCZIldiNgyeB7MjJ2jSLi6maVmIWGKLBuXdC9B5CnLtCk4YqB8pes/hEk9pvh2wcCtuox8sHaXV+Z0vQjgAEK7sUzdCLKkwzeEtV6mw4hebDQvRxveMQJ9F1wfhC54pCAlUBl7g/txvjTDfsT1UwFjBxIMyBUpX6lUnJK+dMH1SyV9MjNX+L/wkrmMmslYT8Jg3SEl65KwuMQPXcVieTMe1eMo/ZabG+s/Zia8MXssner8aUgGvYCoaaAN4/vd/5wJNZQaDafd8nyBNYXoQRZgLY99lj1bz2YlQrOFODHZfFtbc0X7OP4x4NTIHmygMBrDdqhmp9+Syux3o0CG7gr4S7ljKRMxKSmPDQxgIYzQUcAH0Wa9OXan1ZRxs8LkLWdHt9TUs+tx89IsrANPUAvjQsgfEM2F0hHcV8Mfva+eoUoKO8z5OuTRGnrXR3JCXcRZWjutv+1EsuOjWM60PKrQY34cm/qrlflYT2QNC0ujpJ4QvSben6lbxjpqbXpE7Hyrc49LbLLVpvV9ubz+dqLngbzdPh5 X-Forefront-Antispam-Report: CIP:139.15.153.199; CTRY:DE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:eop.bosch-org.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(498600001)(2906002)(8936002)(47076005)(54906003)(336012)(8676002)(107886003)(86362001)(2876002)(70586007)(70206006)(110136005)(186003)(16526019)(4326008)(1076003)(2616005)(36860700001)(82310400003)(81166007)(5660300002)(356005)(26005)(6666004)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: in.bosch.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2021 16:14:52.0605 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3b466641-13f3-42c3-c4c7-08d92cf40b3a X-MS-Exchange-CrossTenant-Id: 0ae51e19-07c8-4e4b-bb6d-648ee58410f4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=0ae51e19-07c8-4e4b-bb6d-648ee58410f4; Ip=[139.15.153.199]; Helo=[eop.bosch-org.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT025.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB2477 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean From: Gireesh Hiremath Enable backlight, set brightness value and dimming frequency Signed-off-by: Gireesh Hiremath --- board/bosch/guardian/board.c | 26 ++++++++++++++++++++++++++ include/configs/am335x_guardian.h | 1 + 2 files changed, 27 insertions(+) diff --git a/board/bosch/guardian/board.c b/board/bosch/guardian/board.c index f14ceaa1f9..4388ef70d2 100644 --- a/board/bosch/guardian/board.c +++ b/board/bosch/guardian/board.c @@ -225,12 +225,38 @@ err: env_set("swi_status", "err"); } +void lcdbacklight_en(void) +{ + unsigned long brightness = env_get_ulong("backlight_brightness", 10, 50); + + if (brightness > 99 || brightness == 0) + brightness = 99; + + /* + * Brightness range: + * WLEDCTRL2 DUTY[6:0] + * + * 000 0000b = 1% + * 000 0001b = 2% + * ... + * 110 0010b = 99% + * 110 0011b = 100% + * + */ + + tps65217_reg_write(TPS65217_PROT_LEVEL_NONE, TPS65217_WLEDCTRL2, + brightness, 0xFF); + tps65217_reg_write(TPS65217_PROT_LEVEL_NONE, TPS65217_WLEDCTRL1, + brightness != 0 ? 0x0A : 0x02, 0xFF); +} + int board_late_init(void) { #ifdef CONFIG_LED_GPIO led_default_state(); #endif set_bootmode_env(); + lcdbacklight_en(); return 0; } #endif /* CONFIG_BOARD_LATE_INIT */ diff --git a/include/configs/am335x_guardian.h b/include/configs/am335x_guardian.h index c76f9b26fb..73248292f2 100644 --- a/include/configs/am335x_guardian.h +++ b/include/configs/am335x_guardian.h @@ -59,6 +59,7 @@ BOOTENV \ GUARDIAN_DEFAULT_PROD_ENV \ "autoload=no\0" \ + "backlight_brightness=50\0" \ "bootubivol=rootfs\0" \ "distro_bootcmd=" \ "setenv rootflags \"bulk_read,chk_data_crc\"; " \ -- 2.20.1