From patchwork Tue Mar 24 17:05:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11456051 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 AEA34139A for ; Tue, 24 Mar 2020 17:05:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9A0D3206F6 for ; Tue, 24 Mar 2020 17:05:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727304AbgCXRFg (ORCPT ); Tue, 24 Mar 2020 13:05:36 -0400 Received: from mga02.intel.com ([134.134.136.20]:21606 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727295AbgCXRFg (ORCPT ); Tue, 24 Mar 2020 13:05:36 -0400 IronPort-SDR: 45A3N9rNAvbWDSoc05FhwbGdbcwGSzjdRPTNrRrQc7bYeCX8quIYXUaCdnFEETBw6NtzejGqHI OzjTvnm9Ne7Q== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2020 10:05:35 -0700 IronPort-SDR: RKGsBswksdHt7HFGNuI+iVdAchD7DYRhS1Pe9ExiiC6/82b4EyD2cosT1BfMkBCvOd8iBdM6+F 7nNJAuNgwXuQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,301,1580803200"; d="scan'208";a="446302980" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga005.fm.intel.com with ESMTP; 24 Mar 2020 10:05:34 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 51ED011D; Tue, 24 Mar 2020 19:05:33 +0200 (EET) From: Andy Shevchenko To: Bartlomiej Zolnierkiewicz , linux-fbdev@vger.kernel.org, xllacyx@gmail.com Cc: Andy Shevchenko Subject: [PATCH v1 1/5] video: ssd1307fb: Convert driver to use ->probe_new() Date: Tue, 24 Mar 2020 19:05:28 +0200 Message-Id: <20200324170532.44384-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Use the ->probe_new() callback. The driver does not use const struct i2c_device_id * argument, so convert it to utilise the simplified I²C driver registration. Signed-off-by: Andy Shevchenko --- drivers/video/fbdev/ssd1307fb.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c index 142535267fec..397eae246c2c 100644 --- a/drivers/video/fbdev/ssd1307fb.c +++ b/drivers/video/fbdev/ssd1307fb.c @@ -586,8 +586,7 @@ static const struct of_device_id ssd1307fb_of_match[] = { }; MODULE_DEVICE_TABLE(of, ssd1307fb_of_match); -static int ssd1307fb_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int ssd1307fb_probe(struct i2c_client *client) { struct backlight_device *bl; char bl_name[12]; @@ -599,11 +598,6 @@ static int ssd1307fb_probe(struct i2c_client *client, void *vmem; int ret; - if (!node) { - dev_err(&client->dev, "No device tree data found!\n"); - return -EINVAL; - } - info = framebuffer_alloc(sizeof(struct ssd1307fb_par), &client->dev); if (!info) return -ENOMEM; @@ -808,7 +802,7 @@ static const struct i2c_device_id ssd1307fb_i2c_id[] = { MODULE_DEVICE_TABLE(i2c, ssd1307fb_i2c_id); static struct i2c_driver ssd1307fb_driver = { - .probe = ssd1307fb_probe, + .probe_new = ssd1307fb_probe, .remove = ssd1307fb_remove, .id_table = ssd1307fb_i2c_id, .driver = { From patchwork Tue Mar 24 17:05:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11456055 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 0BBF117EF for ; Tue, 24 Mar 2020 17:05:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EBE2C206F6 for ; Tue, 24 Mar 2020 17:05:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727324AbgCXRFg (ORCPT ); Tue, 24 Mar 2020 13:05:36 -0400 Received: from mga06.intel.com ([134.134.136.31]:39626 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727133AbgCXRFg (ORCPT ); Tue, 24 Mar 2020 13:05:36 -0400 IronPort-SDR: qlupSQ7eBBoBR17LkbybVkTZJri5SzBkKGOc/J72j/9e6ORow1Z2ouyJPcfq+L8aw0BSn3kBWl OHJr8oF6AJbA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2020 10:05:35 -0700 IronPort-SDR: 6Nb4hp976Vbe4Rp/ytYLLRxNys4igwR71G4Tlvp9wjRV0y5+Y37Yk/gzuglmg73SpOZxVX2jF/ yQuI9Rrf4Wqg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,301,1580803200"; d="scan'208";a="240328465" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 24 Mar 2020 10:05:34 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 5AC7E65; Tue, 24 Mar 2020 19:05:33 +0200 (EET) From: Andy Shevchenko To: Bartlomiej Zolnierkiewicz , linux-fbdev@vger.kernel.org, xllacyx@gmail.com Cc: Andy Shevchenko Subject: [PATCH v1 2/5] video: ssd1307fb: Introduce temporary variable to increase readability Date: Tue, 24 Mar 2020 19:05:29 +0200 Message-Id: <20200324170532.44384-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200324170532.44384-1-andriy.shevchenko@linux.intel.com> References: <20200324170532.44384-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Introduce temporary variable to increase readability of the code. Signed-off-by: Andy Shevchenko --- drivers/video/fbdev/ssd1307fb.c | 34 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c index 397eae246c2c..84dfd7b0f682 100644 --- a/drivers/video/fbdev/ssd1307fb.c +++ b/drivers/video/fbdev/ssd1307fb.c @@ -588,6 +588,7 @@ MODULE_DEVICE_TABLE(of, ssd1307fb_of_match); static int ssd1307fb_probe(struct i2c_client *client) { + struct device *dev = &client->dev; struct backlight_device *bl; char bl_name[12]; struct fb_info *info; @@ -598,7 +599,7 @@ static int ssd1307fb_probe(struct i2c_client *client) void *vmem; int ret; - info = framebuffer_alloc(sizeof(struct ssd1307fb_par), &client->dev); + info = framebuffer_alloc(sizeof(struct ssd1307fb_par), dev); if (!info) return -ENOMEM; @@ -608,23 +609,20 @@ static int ssd1307fb_probe(struct i2c_client *client) par->device_info = of_device_get_match_data(&client->dev); - par->reset = devm_gpiod_get_optional(&client->dev, "reset", - GPIOD_OUT_LOW); + par->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(par->reset)) { - dev_err(&client->dev, "failed to get reset gpio: %ld\n", - PTR_ERR(par->reset)); + dev_err(dev, "failed to get reset gpio: %ld\n", PTR_ERR(par->reset)); ret = PTR_ERR(par->reset); goto fb_alloc_error; } - par->vbat_reg = devm_regulator_get_optional(&client->dev, "vbat"); + par->vbat_reg = devm_regulator_get_optional(dev, "vbat"); if (IS_ERR(par->vbat_reg)) { ret = PTR_ERR(par->vbat_reg); if (ret == -ENODEV) { par->vbat_reg = NULL; } else { - dev_err(&client->dev, "failed to get VBAT regulator: %d\n", - ret); + dev_err(dev, "failed to get VBAT regulator: %d\n", ret); goto fb_alloc_error; } } @@ -674,15 +672,14 @@ static int ssd1307fb_probe(struct i2c_client *client) vmem = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, get_order(vmem_size)); if (!vmem) { - dev_err(&client->dev, "Couldn't allocate graphical memory.\n"); + dev_err(dev, "Couldn't allocate graphical memory.\n"); ret = -ENOMEM; goto fb_alloc_error; } - ssd1307fb_defio = devm_kzalloc(&client->dev, sizeof(*ssd1307fb_defio), - GFP_KERNEL); + ssd1307fb_defio = devm_kzalloc(dev, sizeof(*ssd1307fb_defio), GFP_KERNEL); if (!ssd1307fb_defio) { - dev_err(&client->dev, "Couldn't allocate deferred io.\n"); + dev_err(dev, "Couldn't allocate deferred io.\n"); ret = -ENOMEM; goto fb_alloc_error; } @@ -720,8 +717,7 @@ static int ssd1307fb_probe(struct i2c_client *client) if (par->vbat_reg) { ret = regulator_enable(par->vbat_reg); if (ret) { - dev_err(&client->dev, "failed to enable VBAT: %d\n", - ret); + dev_err(dev, "failed to enable VBAT: %d\n", ret); goto reset_oled_error; } } @@ -732,17 +728,15 @@ static int ssd1307fb_probe(struct i2c_client *client) ret = register_framebuffer(info); if (ret) { - dev_err(&client->dev, "Couldn't register the framebuffer\n"); + dev_err(dev, "Couldn't register the framebuffer\n"); goto panel_init_error; } snprintf(bl_name, sizeof(bl_name), "ssd1307fb%d", info->node); - bl = backlight_device_register(bl_name, &client->dev, par, - &ssd1307fb_bl_ops, NULL); + bl = backlight_device_register(bl_name, dev, par, &ssd1307fb_bl_ops, NULL); if (IS_ERR(bl)) { ret = PTR_ERR(bl); - dev_err(&client->dev, "unable to register backlight device: %d\n", - ret); + dev_err(dev, "unable to register backlight device: %d\n", ret); goto bl_init_error; } @@ -750,7 +744,7 @@ static int ssd1307fb_probe(struct i2c_client *client) bl->props.max_brightness = MAX_CONTRAST; info->bl_dev = bl; - dev_info(&client->dev, "fb%d: %s framebuffer device registered, using %d bytes of video memory\n", info->node, info->fix.id, vmem_size); + dev_info(dev, "fb%d: %s framebuffer device registered, using %d bytes of video memory\n", info->node, info->fix.id, vmem_size); return 0; From patchwork Tue Mar 24 17:05:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11456057 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 4EBC61731 for ; Tue, 24 Mar 2020 17:05:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3A336206F6 for ; Tue, 24 Mar 2020 17:05:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727133AbgCXRFh (ORCPT ); Tue, 24 Mar 2020 13:05:37 -0400 Received: from mga05.intel.com ([192.55.52.43]:48953 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726962AbgCXRFg (ORCPT ); Tue, 24 Mar 2020 13:05:36 -0400 IronPort-SDR: etCopCZB0Nc2+9M0s085vmuN5fsY86QLIX0ZIa9lpxrQce31stxV6DZdmN2YA9M25EkMqgBGCA 49Avgm9oL1Hw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2020 10:05:36 -0700 IronPort-SDR: U/V0Ku8vqBuZm1PTdbCMsXWEWFk6oo7s7hyQcEqviocpE2MAPgUtbLXcdce9fpuCMb6BIBb5f/ Pj0yhenGXDmA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,301,1580803200"; d="scan'208";a="265224187" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 24 Mar 2020 10:05:34 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 643EB3F3; Tue, 24 Mar 2020 19:05:33 +0200 (EET) From: Andy Shevchenko To: Bartlomiej Zolnierkiewicz , linux-fbdev@vger.kernel.org, xllacyx@gmail.com Cc: Andy Shevchenko Subject: [PATCH v1 3/5] video: ssd1307fb: Make use of device properties Date: Tue, 24 Mar 2020 19:05:30 +0200 Message-Id: <20200324170532.44384-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200324170532.44384-1-andriy.shevchenko@linux.intel.com> References: <20200324170532.44384-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Device property API allows to gather device resources from different sources, such as ACPI. Convert the drivers to unleash the power of device property API. Signed-off-by: Andy Shevchenko --- drivers/video/fbdev/ssd1307fb.c | 40 ++++++++++++++++----------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c index 84dfd7b0f682..7a6a44a0b7a6 100644 --- a/drivers/video/fbdev/ssd1307fb.c +++ b/drivers/video/fbdev/ssd1307fb.c @@ -12,8 +12,7 @@ #include #include #include -#include -#include +#include #include #include #include @@ -592,7 +591,6 @@ static int ssd1307fb_probe(struct i2c_client *client) struct backlight_device *bl; char bl_name[12]; struct fb_info *info; - struct device_node *node = client->dev.of_node; struct fb_deferred_io *ssd1307fb_defio; u32 vmem_size; struct ssd1307fb_par *par; @@ -607,7 +605,7 @@ static int ssd1307fb_probe(struct i2c_client *client) par->info = info; par->client = client; - par->device_info = of_device_get_match_data(&client->dev); + par->device_info = device_get_match_data(dev); par->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(par->reset)) { @@ -627,44 +625,44 @@ static int ssd1307fb_probe(struct i2c_client *client) } } - if (of_property_read_u32(node, "solomon,width", &par->width)) + if (device_property_read_u32(dev, "solomon,width", &par->width)) par->width = 96; - if (of_property_read_u32(node, "solomon,height", &par->height)) + if (device_property_read_u32(dev, "solomon,height", &par->height)) par->height = 16; - if (of_property_read_u32(node, "solomon,page-offset", &par->page_offset)) + if (device_property_read_u32(dev, "solomon,page-offset", &par->page_offset)) par->page_offset = 1; - if (of_property_read_u32(node, "solomon,com-offset", &par->com_offset)) + if (device_property_read_u32(dev, "solomon,com-offset", &par->com_offset)) par->com_offset = 0; - if (of_property_read_u32(node, "solomon,prechargep1", &par->prechargep1)) + if (device_property_read_u32(dev, "solomon,prechargep1", &par->prechargep1)) par->prechargep1 = 2; - if (of_property_read_u32(node, "solomon,prechargep2", &par->prechargep2)) + if (device_property_read_u32(dev, "solomon,prechargep2", &par->prechargep2)) par->prechargep2 = 2; - if (!of_property_read_u8_array(node, "solomon,lookup-table", - par->lookup_table, - ARRAY_SIZE(par->lookup_table))) + if (!device_property_read_u8_array(dev, "solomon,lookup-table", + par->lookup_table, + ARRAY_SIZE(par->lookup_table))) par->lookup_table_set = 1; - par->seg_remap = !of_property_read_bool(node, "solomon,segment-no-remap"); - 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->seg_remap = !device_property_read_bool(dev, "solomon,segment-no-remap"); + par->com_seq = device_property_read_bool(dev, "solomon,com-seq"); + par->com_lrremap = device_property_read_bool(dev, "solomon,com-lrremap"); + par->com_invdir = device_property_read_bool(dev, "solomon,com-invdir"); par->area_color_enable = - of_property_read_bool(node, "solomon,area-color-enable"); - par->low_power = of_property_read_bool(node, "solomon,low-power"); + device_property_read_bool(dev, "solomon,area-color-enable"); + par->low_power = device_property_read_bool(dev, "solomon,low-power"); par->contrast = 127; par->vcomh = par->device_info->default_vcomh; /* Setup display timing */ - if (of_property_read_u32(node, "solomon,dclk-div", &par->dclk_div)) + if (device_property_read_u32(dev, "solomon,dclk-div", &par->dclk_div)) par->dclk_div = par->device_info->default_dclk_div; - if (of_property_read_u32(node, "solomon,dclk-frq", &par->dclk_frq)) + if (device_property_read_u32(dev, "solomon,dclk-frq", &par->dclk_frq)) par->dclk_frq = par->device_info->default_dclk_frq; vmem_size = DIV_ROUND_UP(par->width, 8) * par->height; From patchwork Tue Mar 24 17:05:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11456053 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 E124D913 for ; Tue, 24 Mar 2020 17:05:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CC881206F6 for ; Tue, 24 Mar 2020 17:05:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727295AbgCXRFg (ORCPT ); Tue, 24 Mar 2020 13:05:36 -0400 Received: from mga18.intel.com ([134.134.136.126]:63105 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726962AbgCXRFg (ORCPT ); Tue, 24 Mar 2020 13:05:36 -0400 IronPort-SDR: 40PxoHj0VBHF3dMrjspyTaI/OrwmJ76rCp6WXeOtLVLpENVtVs4wTRRAWjRPhcXuIBJV+2DV/m rgmCJZ3WaILg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2020 10:05:35 -0700 IronPort-SDR: eMH9CvK8/YoruOwWqa53+chBimw6Stn+61rXGhdH8XRlqkoo9HHrv0SdMsxqT3fHJVrLFsFcpv XBb2Cudqxf4Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,301,1580803200"; d="scan'208";a="281774597" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga002.fm.intel.com with ESMTP; 24 Mar 2020 10:05:34 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 6E1F33BA; Tue, 24 Mar 2020 19:05:33 +0200 (EET) From: Andy Shevchenko To: Bartlomiej Zolnierkiewicz , linux-fbdev@vger.kernel.org, xllacyx@gmail.com Cc: Andy Shevchenko Subject: [PATCH v1 4/5] video: ssd1307fb: Convert to atomic PWM API Date: Tue, 24 Mar 2020 19:05:31 +0200 Message-Id: <20200324170532.44384-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200324170532.44384-1-andriy.shevchenko@linux.intel.com> References: <20200324170532.44384-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Use the atomic API wherever appropriate and get rid of pwm_apply_args() call (the reference period and polarity are now explicitly set when calling pwm_apply_state()). We also make use of the pwm_set_relative_duty_cycle() helper to ease relative to absolute duty_cycle conversion. Signed-off-by: Andy Shevchenko --- drivers/video/fbdev/ssd1307fb.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c index 7a6a44a0b7a6..6e543396002a 100644 --- a/drivers/video/fbdev/ssd1307fb.c +++ b/drivers/video/fbdev/ssd1307fb.c @@ -79,7 +79,6 @@ struct ssd1307fb_par { u32 prechargep1; u32 prechargep2; struct pwm_device *pwm; - u32 pwm_period; struct gpio_desc *reset; struct regulator *vbat_reg; u32 vcomh; @@ -297,9 +296,9 @@ static void ssd1307fb_deferred_io(struct fb_info *info, static int ssd1307fb_init(struct ssd1307fb_par *par) { + struct pwm_state pwmstate; int ret; u32 precharge, dclk, com_invdir, compins; - struct pwm_args pargs; if (par->device_info->need_pwm) { par->pwm = pwm_get(&par->client->dev, NULL); @@ -308,21 +307,15 @@ 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, &pwmstate); + pwm_set_relative_duty_cycle(&pwmstate, 50, 100); + pwm_apply_state(par->pwm, &pwmstate); - 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); dev_dbg(&par->client->dev, "Using PWM%d with a %dns period.\n", - par->pwm->pwm, par->pwm_period); + par->pwm->pwm, pwm_get_period(par->pwm)); } /* Set initial contrast */ From patchwork Tue Mar 24 17:05:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11456059 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 50E9D139A for ; Tue, 24 Mar 2020 17:05:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 30A12206F6 for ; Tue, 24 Mar 2020 17:05:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727333AbgCXRFh (ORCPT ); Tue, 24 Mar 2020 13:05:37 -0400 Received: from mga12.intel.com ([192.55.52.136]:25067 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726962AbgCXRFh (ORCPT ); Tue, 24 Mar 2020 13:05:37 -0400 IronPort-SDR: qi4l4QAS3E9zlVUebjvrPzUSZaz7N94SaeJf6UDeI8OGqhbSoJ/HZaMoIoXNhKoBy3kE/H5N0U aW218l6OWyIQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2020 10:05:37 -0700 IronPort-SDR: O6nZ9ebeq1oDrK3CmezgbCKcp+WTtPTfcEuj6p3FaZ2zFtHyixvWHMg/QV8xGpl6eHXVZGKPrK xcjHK92qBtUQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,301,1580803200"; d="scan'208";a="235643659" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 24 Mar 2020 10:05:34 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 7D29D5A3; Tue, 24 Mar 2020 19:05:33 +0200 (EET) From: Andy Shevchenko To: Bartlomiej Zolnierkiewicz , linux-fbdev@vger.kernel.org, xllacyx@gmail.com Cc: Andy Shevchenko Subject: [PATCH v1 5/5] video: ssd1307fb: Remove redundant forward declaration Date: Tue, 24 Mar 2020 19:05:32 +0200 Message-Id: <20200324170532.44384-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200324170532.44384-1-andriy.shevchenko@linux.intel.com> References: <20200324170532.44384-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org There is no need to have forward declaration of struct ssd1307fb_par. Drop it for good. Signed-off-by: Andy Shevchenko --- drivers/video/fbdev/ssd1307fb.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c index 6e543396002a..509cab2c8b6c 100644 --- a/drivers/video/fbdev/ssd1307fb.c +++ b/drivers/video/fbdev/ssd1307fb.c @@ -48,8 +48,6 @@ static u_int refreshrate = REFRESHRATE; module_param(refreshrate, uint, 0); -struct ssd1307fb_par; - struct ssd1307fb_deviceinfo { u32 default_vcomh; u32 default_dclk_div;