From patchwork Tue May 12 20:52:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Alencar <455.rodrigo.alencar@gmail.com> X-Patchwork-Id: 11543977 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EC40215E6 for ; Tue, 12 May 2020 20:53:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D3D3820747 for ; Tue, 12 May 2020 20:53:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ay/yQBI1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728275AbgELUxH (ORCPT ); Tue, 12 May 2020 16:53:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725938AbgELUxH (ORCPT ); Tue, 12 May 2020 16:53:07 -0400 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2262DC061A0C; Tue, 12 May 2020 13:53:07 -0700 (PDT) Received: by mail-qk1-x742.google.com with SMTP id g185so15161165qke.7; Tue, 12 May 2020 13:53:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=oplmARCG9wf41YuyXYjcW5ILjydS54+070hhehLyIek=; b=Ay/yQBI1yrdv38SVM16gxQTwMzOQX3nlCpkNmvPWIhg2tyurwydIEpxEEb4CdGrPRT p+mDoRR5YbNpl9Op/82Ls/S5/SVbykYuIFfAdf7JmwZnnSvUWoDsw3yxA4UNaYac81qp ee2itBNCx3MbX0cyovTenZuB0Hv35cOiiKF/sQq9EPUYQkWGTC/nrkTKP08b99PhSDes 8abIz2l/TlOabEcW0kDmHRql79spbeTbrNzJYSyjBNeqKG0TK2mJUFcOOT6xAIVL0Bbp iiiVkNYWpdy4mKc5CnCcfIhGBBboMIJChXRk5fMA6EOhij+MmiwNUxuRDI66fXnli0Pt Fskg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=oplmARCG9wf41YuyXYjcW5ILjydS54+070hhehLyIek=; b=HctNExQQ6/z2glBjaAtg2BoN3hIGxjPOeB8zHJ4Dtf/Ann2yOWUPOKNul28nZHpm0v qPx40U17nAq2z8oxquCdHXbpssvg9keixE07YOK8eyemSJtsMJWuPtFk+mqTqtmWEDcK wnQmsdYrzQCfuB1nGYgx2uJxHv/mzo7LiYODo4xvFabiHDGAj2HpJelxH8ODwu6NFoYw Vuc63q+4L9/VBVJpkhPqT4huMfFe9XK1iYDWD9iBwpN+1rkZWIVSX8qM21ZbrBBw1GCl 8HUGSLbDV3WzATaoq+1Nx3ZVeP5AKKbzliynU0jDPL7eXTSKuPxJzGsF3kdVsTWyWSc1 YPmw== X-Gm-Message-State: AGi0PuZtywoTp7jwjaU1KJ0ZgR3GOBmqr2TSCTRLG/jvZ4Vsy2FOjF2U Y/CqPcGV7qopI8+1cEWtOEwG9gFhaX7rUQ== X-Google-Smtp-Source: APiQypKTkapszzFqBaWJAmaiIYZQe+S7kVU0oZgpbsKJg27XcAMTCxOR9Capz4PUMlGG7oxHBE3nRA== X-Received: by 2002:a37:8d85:: with SMTP id p127mr23039011qkd.44.1589316785938; Tue, 12 May 2020 13:53:05 -0700 (PDT) Received: from sca.dev ([201.17.110.164]) by smtp.gmail.com with ESMTPSA id h6sm9503374qkf.61.2020.05.12.13.53.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 May 2020 13:53:05 -0700 (PDT) From: Rodrigo Rolim Mendes de Alencar <455.rodrigo.alencar@gmail.com> X-Google-Original-From: Rodrigo Rolim Mendes de Alencar To: linux-fbdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, maxime.ripard@free-electrons.com, alencar.fmce@imbel.gov.br, Rodrigo Alencar <455.rodrigo.alencar@gmail.com> Subject: [PATCH 1/3] video: fbdev: ssd1307fb: Added support to Column offset Date: Tue, 12 May 2020 17:52:47 -0300 Message-Id: <1589316769-13277-1-git-send-email-alencar.fmce@imbel.gov.br> X-Mailer: git-send-email 1.9.3 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org This patch provides support for displays like VGM128064B0W10, which requires a column offset of 2, i.e., its segments starts in SEG2 and ends in SEG129. Signed-off-by: Rodrigo Alencar <455.rodrigo.alencar@gmail.com> --- Documentation/devicetree/bindings/display/ssd1307fb.txt | 1 + drivers/video/fbdev/ssd1307fb.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/display/ssd1307fb.txt b/Documentation/devicetree/bindings/display/ssd1307fb.txt index 27333b9551b3..74a7b228bcef 100644 --- a/Documentation/devicetree/bindings/display/ssd1307fb.txt +++ b/Documentation/devicetree/bindings/display/ssd1307fb.txt @@ -23,6 +23,7 @@ Optional properties: - solomon,com-lrremap: Display uses left-right COM pin remap - solomon,com-invdir: Display uses inverted COM pin scan direction - solomon,com-offset: Number of the COM pin wired to the first display line + - solomon,col-offset: Offset of columns (SEG) that the screen is mapped to. - solomon,prechargep1: Length of deselect period (phase 1) in clock cycles. - solomon,prechargep2: Length of precharge period (phase 2) in clock cycles. This needs to be the higher, the higher the capacitance diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c index 12fa1050f3eb..ac88bbe174b6 100644 --- a/drivers/video/fbdev/ssd1307fb.c +++ b/drivers/video/fbdev/ssd1307fb.c @@ -77,6 +77,7 @@ struct ssd1307fb_par { struct fb_info *info; u8 lookup_table[4]; u32 page_offset; + u32 col_offset; u32 prechargep1; u32 prechargep2; struct pwm_device *pwm; @@ -468,11 +469,11 @@ static int ssd1307fb_init(struct ssd1307fb_par *par) if (ret < 0) return ret; - ret = ssd1307fb_write_cmd(par->client, 0x0); + ret = ssd1307fb_write_cmd(par->client, par->col_offset); if (ret < 0) return ret; - ret = ssd1307fb_write_cmd(par->client, par->width - 1); + ret = ssd1307fb_write_cmd(par->client, par->col_offset + par->width - 1); if (ret < 0) return ret; @@ -644,6 +645,9 @@ static int ssd1307fb_probe(struct i2c_client *client, if (of_property_read_u32(node, "solomon,page-offset", &par->page_offset)) par->page_offset = 1; + if (of_property_read_u32(node, "solomon,col-offset", &par->col_offset)) + par->col_offset = 0; + if (of_property_read_u32(node, "solomon,com-offset", &par->com_offset)) par->com_offset = 0; From patchwork Tue May 12 20:52:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Alencar <455.rodrigo.alencar@gmail.com> X-Patchwork-Id: 11543979 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5C1EB92A for ; Tue, 12 May 2020 20:53:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 42F3C20753 for ; Tue, 12 May 2020 20:53:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Uz0A7RWo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727971AbgELUxS (ORCPT ); Tue, 12 May 2020 16:53:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725938AbgELUxS (ORCPT ); Tue, 12 May 2020 16:53:18 -0400 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 756DEC061A0C; Tue, 12 May 2020 13:53:18 -0700 (PDT) Received: by mail-qk1-x742.google.com with SMTP id g185so15161708qke.7; Tue, 12 May 2020 13:53:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PwIASv/vhd/qRGtzr/TQ79wPBnNWX1XktPXzdN45PYQ=; b=Uz0A7RWoZ1quDAqVxJAzo+fnpEPgA00dcQ8c0v7lWV3lxQ8kWiT6sT6jNRnreRn9O0 kkibGiJXw3E+hvr6tBfeBWjBIYr2SyEprqLPu5ju2upXf/JbkCXt/RRAUi5umt0hImC8 RftDgpDFclwPr9Hb7NUsMXR2JHWX0Br0yts0sd0f3ZGLCyuiZRDWfnCdTAdKXL9euUJj TRrrnWRmmv0fEYOjb9Qey3lpywCXTSJkCUVvXkSEM+a1EoIMqPzFWg5QVNVkCthuOruW zmynbk8bmUYiUuHlwPJxVPJxIwqWzOikRWl6wtnsAERS427pWk5AmVGyEOcgYE2hPQE4 IUnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PwIASv/vhd/qRGtzr/TQ79wPBnNWX1XktPXzdN45PYQ=; b=HI4nzgjIcAskWUSi25y/dLPvr5m0KeM3TXdjGx7cM6lYdKEAziVUDuso7PyFjUSzcq QAEedBsE4uQqWsN3mnpzg9x8xK404s5f16CtP8fYIz0ZKC7iRw0JoGhWShmjOG/2LJQQ zqpU90pV9bG6ekb8LK4Je9kblcAzZmJlkgizkKwO0Kj4kws65bfIVBPdJ+xq0pIrTKXh W3PJDh2lW+w8KAqFksL/w4BMlyTwPV5XGyxQp89ghgKCmaCEMFblAIYa/d3rnk/mjTFC 6D3B/rU4uB2AVT9keiA2hBdu45xX+eqWkH6oRjiEmOakbjWnxlyhvAPiN0ad3N5Ocn+3 Jblw== X-Gm-Message-State: AOAM532cVza6U6UJ+jmZTbgrHA/39YiVGTVwRGcb0WwqGMzLSccvKryh GMwTc2PxYQqHyG3JMYM3kXlnOnVc2JC6eg== X-Google-Smtp-Source: ABdhPJy7cc7mfQY0TzVYXpHv6JOuNU3+msIJpUP//ezvdJM4xXgs7lmdlDWrQyj3wI5VtHWN4sURjQ== X-Received: by 2002:a37:a3d6:: with SMTP id m205mr4731164qke.241.1589316797287; Tue, 12 May 2020 13:53:17 -0700 (PDT) Received: from sca.dev ([201.17.110.164]) by smtp.gmail.com with ESMTPSA id h6sm9503374qkf.61.2020.05.12.13.53.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 May 2020 13:53:16 -0700 (PDT) From: Rodrigo Rolim Mendes de Alencar <455.rodrigo.alencar@gmail.com> X-Google-Original-From: Rodrigo Rolim Mendes de Alencar To: linux-fbdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, maxime.ripard@free-electrons.com, alencar.fmce@imbel.gov.br, Rodrigo Alencar <455.rodrigo.alencar@gmail.com> Subject: [PATCH 2/3] video: fbdev: ssd1307fb: Support to pixel inversion Date: Tue, 12 May 2020 17:52:48 -0300 Message-Id: <1589316769-13277-2-git-send-email-alencar.fmce@imbel.gov.br> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1589316769-13277-1-git-send-email-alencar.fmce@imbel.gov.br> References: <1589316769-13277-1-git-send-email-alencar.fmce@imbel.gov.br> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Pixel inversion in hardware is performed by issuing the command 0xa7. This patch adds a boolean property to control color inversion. Signed-off-by: Rodrigo Alencar <455.rodrigo.alencar@gmail.com> --- .../devicetree/bindings/display/ssd1307fb.txt | 1 + drivers/video/fbdev/ssd1307fb.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/display/ssd1307fb.txt b/Documentation/devicetree/bindings/display/ssd1307fb.txt index 74a7b228bcef..3076b71ede68 100644 --- a/Documentation/devicetree/bindings/display/ssd1307fb.txt +++ b/Documentation/devicetree/bindings/display/ssd1307fb.txt @@ -22,6 +22,7 @@ Optional properties: - solomon,com-seq: Display uses sequential COM pin configuration - solomon,com-lrremap: Display uses left-right COM pin remap - solomon,com-invdir: Display uses inverted COM pin scan direction + - solomon,color-inv: Set Inverse display mode (invert pixel color) - solomon,com-offset: Number of the COM pin wired to the first display line - solomon,col-offset: Offset of columns (SEG) that the screen is mapped to. - solomon,prechargep1: Length of deselect period (phase 1) in clock cycles. diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c index ac88bbe174b6..748c21c0567b 100644 --- a/drivers/video/fbdev/ssd1307fb.c +++ b/drivers/video/fbdev/ssd1307fb.c @@ -31,8 +31,9 @@ #define SSD1307FB_SET_LOOKUP_TABLE 0x91 #define SSD1307FB_CHARGE_PUMP 0x8d #define SSD1307FB_SEG_REMAP_ON 0xa1 -#define SSD1307FB_DISPLAY_OFF 0xae +#define SSD1307FB_DISPLAY_NORMAL 0xa6 #define SSD1307FB_SET_MULTIPLEX_RATIO 0xa8 +#define SSD1307FB_DISPLAY_OFF 0xae #define SSD1307FB_DISPLAY_ON 0xaf #define SSD1307FB_START_PAGE_ADDRESS 0xb0 #define SSD1307FB_SET_DISPLAY_OFFSET 0xd3 @@ -62,6 +63,7 @@ struct ssd1307fb_deviceinfo { struct ssd1307fb_par { unsigned area_color_enable : 1; unsigned com_invdir : 1; + unsigned color_inv : 1; unsigned com_lrremap : 1; unsigned com_seq : 1; unsigned lookup_table_set : 1; @@ -492,6 +494,12 @@ static int ssd1307fb_init(struct ssd1307fb_par *par) if (ret < 0) return ret; + /* Set normal or inverse */ + ret = ssd1307fb_write_cmd(par->client, + SSD1307FB_DISPLAY_NORMAL | (par->color_inv & 0x1)); + if (ret < 0) + return ret; + /* Clear the screen */ ssd1307fb_update_display(par); @@ -666,6 +674,7 @@ static int ssd1307fb_probe(struct i2c_client *client, par->com_seq = of_property_read_bool(node, "solomon,com-seq"); par->com_lrremap = of_property_read_bool(node, "solomon,com-lrremap"); par->com_invdir = of_property_read_bool(node, "solomon,com-invdir"); + par->color_inv = of_property_read_bool(node, "solomon,color-inv"); par->area_color_enable = of_property_read_bool(node, "solomon,area-color-enable"); par->low_power = of_property_read_bool(node, "solomon,low-power"); From patchwork Tue May 12 20:52:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Alencar <455.rodrigo.alencar@gmail.com> X-Patchwork-Id: 11543981 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2C94D92A for ; Tue, 12 May 2020 20:53:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1492120753 for ; Tue, 12 May 2020 20:53:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RDTWOYNZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731171AbgELUxX (ORCPT ); Tue, 12 May 2020 16:53:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725938AbgELUxW (ORCPT ); Tue, 12 May 2020 16:53:22 -0400 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45270C061A0C; Tue, 12 May 2020 13:53:22 -0700 (PDT) Received: by mail-qk1-x742.google.com with SMTP id f83so15144653qke.13; Tue, 12 May 2020 13:53:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OyS6mmNv0q65u62hC5nV/TgLYdLkGis5cCl6PdzqkEw=; b=RDTWOYNZFw5NrEI6k34m0CvGM/VljYk9JpYUDU2JUU4ujF+SMcR/IG9rddtmv11V4M HhSKPLqzLJJ6pEGFDRODF5eN4gRdg88TKm2IZ337xqOgktJ9zkUb74ongeklO9XvKCva Sb49D79rmoDYGgCSPyWhgGW5i4R8VxUZgzURvXZTYkqJUlYc5NB24D24JkH2zCuqSYGa IDK9Iz3oU4rKsWoJqJDGM+BRVv83HL60erDVZXXKgCnblKn5xBdMCklFoHms0pyOJwY6 RAauDIOzMG7F4YM0T8b9l+D+bDeJlZqh6TrP+u+zJhGglxmMmlCGXpfYXJsyt0QjDru/ Th/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OyS6mmNv0q65u62hC5nV/TgLYdLkGis5cCl6PdzqkEw=; b=htgmLaXB8I+4szb7oRLl8WNwTwOqjh75xuXxs/G6xjFM1U4UAaZ9X9tsfkgN1kpPaX 12V1+Vmp4KFZu0IrReuqmfOsuplT0vH/ZkLFbWf/Q/XCMaGLv2GRmSvILBdLLmRse/q3 yShdSfnhOjr3qVKZEJAUKuAX3a1AdA9FPT/E5AyQ04AL4vKEUbNJGV5RfrFB7q2W2K0Q iOglSi+g/hgSkvDXBEfpt4hH+6EoxPkyRwWmgJtL8sJ82+E9J76yjf5DWFrRZh5kVo0p gutIdC+dw9zPg+BXbmebYW0OuQNVlL3DopQw6UuruH3EZNBSROqXuEgGwGwf1sA6SL2f 0m5Q== X-Gm-Message-State: AGi0PubI4wmC9lqdvmWfuW9R3MaNufEttOS4YLHJ+rMXdCxTZpZS9k5C D0aOii6+SQby1+xB+OxZCDXYF8VN/Sd+Cg== X-Google-Smtp-Source: APiQypI82NkVBwdJGZemhVT0kn8euOjsBIY+zrqpnGJBxNXvrgVaMrsGokVs1ycgaD031Ugz8CCfEA== X-Received: by 2002:a05:620a:662:: with SMTP id a2mr20537000qkh.304.1589316801088; Tue, 12 May 2020 13:53:21 -0700 (PDT) Received: from sca.dev ([201.17.110.164]) by smtp.gmail.com with ESMTPSA id h6sm9503374qkf.61.2020.05.12.13.53.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 May 2020 13:53:20 -0700 (PDT) From: Rodrigo Rolim Mendes de Alencar <455.rodrigo.alencar@gmail.com> X-Google-Original-From: Rodrigo Rolim Mendes de Alencar To: linux-fbdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, maxime.ripard@free-electrons.com, alencar.fmce@imbel.gov.br Subject: [PATCH 3/3] video: fbdev: ssd1307fb: Switch to atomic PWM API Date: Tue, 12 May 2020 17:52:49 -0300 Message-Id: <1589316769-13277-3-git-send-email-alencar.fmce@imbel.gov.br> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1589316769-13277-1-git-send-email-alencar.fmce@imbel.gov.br> References: <1589316769-13277-1-git-send-email-alencar.fmce@imbel.gov.br> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Signed-off-by: Rodrigo Rolim Mendes de Alencar --- drivers/video/fbdev/ssd1307fb.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c index 748c21c0567b..b1cac4a3722f 100644 --- a/drivers/video/fbdev/ssd1307fb.c +++ b/drivers/video/fbdev/ssd1307fb.c @@ -303,7 +303,7 @@ static int ssd1307fb_init(struct ssd1307fb_par *par) { int ret; u32 precharge, dclk, com_invdir, compins; - struct pwm_args pargs; + struct pwm_state pstate; if (par->device_info->need_pwm) { par->pwm = pwm_get(&par->client->dev, NULL); @@ -312,18 +312,18 @@ static int ssd1307fb_init(struct ssd1307fb_par *par) return PTR_ERR(par->pwm); } - /* - * FIXME: pwm_apply_args() should be removed when switching to - * the atomic PWM API. - */ - pwm_apply_args(par->pwm); + pwm_init_state(par->pwm, &pstate); + par->pwm_period = pstate.period; - pwm_get_args(par->pwm, &pargs); - - par->pwm_period = pargs.period; /* Enable the PWM */ - pwm_config(par->pwm, par->pwm_period / 2, par->pwm_period); - pwm_enable(par->pwm); + pstate.enabled = true; + pstate.duty_cycle = pstate.period / 2; + + ret = pwm_apply_state(par->pwm, &pstate); + if (ret) { + dev_err(&par->client->dev, "Failed to apply PWM state: %d\n", ret); + return ret; + } dev_dbg(&par->client->dev, "Using PWM%d with a %dns period.\n", par->pwm->pwm, par->pwm_period);